Skip to content

Commit e2c75d0

Browse files
authored
Format codebase, enforce formatting (#201)
1 parent 4d11574 commit e2c75d0

File tree

159 files changed

+12279
-12080
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+12279
-12080
lines changed

.github/dependabot.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
version: 2
77
updates:
8-
- package-ecosystem: gitsubmodule
9-
directory: "/"
10-
schedule:
11-
interval: daily
12-
open-pull-requests-limit: 20
8+
- package-ecosystem: gitsubmodule
9+
directory: "/"
10+
schedule:
11+
interval: daily
12+
open-pull-requests-limit: 20

.github/workflows/build.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Build with Hugo
22

3-
on: [push, pull_request]
3+
on: [push, pull_request, workflow_dispatch]
44

55
jobs:
66
build:
@@ -12,6 +12,13 @@ jobs:
1212
fetch-depth: 0
1313
- name: Install dependencies
1414
run: npm ci
15+
- name: Run Prettier
16+
id: runPrettier
17+
run: npm run format
18+
- name: Show formatter diff if it exists
19+
# https://docs.github.com/en/actions/learn-github-actions/expressions#failure
20+
if: ${{ failure() }}
21+
run: git diff
1522
- name: Build site to check for errors
1623
run: npm run build:ci
1724
- name: check that links are all valid

.github/workflows/hugo.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
- name: Install Hugo CLI
3838
run: |
3939
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
40-
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
40+
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
4141
- name: Install Dart Sass
4242
run: sudo snap install dart-sass
4343
- name: Checkout
@@ -59,7 +59,7 @@ jobs:
5959
hugo \
6060
--gc \
6161
--minify \
62-
--baseURL "${{ steps.pages.outputs.base_url }}/"
62+
--baseURL "${{ steps.pages.outputs.base_url }}/"
6363
- name: Upload artifact
6464
uses: actions/upload-pages-artifact@v3
6565
with:
@@ -75,4 +75,4 @@ jobs:
7575
steps:
7676
- name: Deploy to GitHub Pages
7777
id: deployment
78-
uses: actions/deploy-pages@v4
78+
uses: actions/deploy-pages@v4

.prettierignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Generated files by hugo
2+
/public/
3+
/resources/
4+
/assets/jsconfig.json
5+
hugo_stats.json
6+
7+
# Executable may be added to repository
8+
hugo.exe
9+
hugo.darwin
10+
hugo.linux
11+
12+
# Temporary lock file while building
13+
/.hugo_build.lock
14+
15+
# Node
16+
node_modules
17+
18+
# A11y checker
19+
test-results
20+
21+
# Upstream submodules
22+
themes/hugo-book
23+
themes/hugo-notice

.vscode/dev.code-snippets

+11-14
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,17 @@
1818
"Notice": {
1919
"scope": "markdown",
2020
"prefix": "%",
21-
"body": [
22-
"{{< notice $1 >}}$2{{< /notice >}}",
23-
"$0"
24-
],
25-
"description": "Notice shortcode"
21+
"body": ["{{< notice $1 >}}$2{{< /notice >}}", "$0"],
22+
"description": "Notice shortcode",
2623
},
2724
"CSpell toggle": {
28-
"scope": "markdown",
29-
"prefix": "%",
30-
"body": [
31-
"{{% comment %}} cspell:disable {{% /comment %}}",
32-
"{{% comment %}} cspell:enable {{% /comment %}}",
33-
"$0"
34-
],
35-
"description": "Toggle CSpell for a block of code"
36-
}
25+
"scope": "markdown",
26+
"prefix": "%",
27+
"body": [
28+
"{{% comment %}} cspell:disable {{% /comment %}}",
29+
"{{% comment %}} cspell:enable {{% /comment %}}",
30+
"$0",
31+
],
32+
"description": "Toggle CSpell for a block of code",
33+
},
3734
}

.vscode/extensions.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"recommendations": [
3-
"streetsidesoftware.code-spell-checker-cspell-bundled-dictionaries"
4-
]
5-
}
2+
"recommendations": [
3+
"streetsidesoftware.code-spell-checker-cspell-bundled-dictionaries"
4+
]
5+
}

.vscode/settings.json

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
{
2-
"editor.formatOnSave": false,
2+
"editor.formatOnSave": true,
33
"cSpell.enabledFileTypes": {
44
"*": false,
55
"markdown": true
66
},
7-
"cSpell.files": [
8-
"/content/**",
9-
"README.md",
10-
]
7+
"cSpell.files": ["/content/**", "README.md"]
118
}

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ See [About](content/about/_index.md) for more information
1515
- scripts
1616
-`build`: Builds the site to ensure changes are valid
1717
-`build:ci`: Builds the site but fails if any warnings are detected. Used in our CI pipeline.
18-
-`format:fix`: Fixes formatting of the `package.json` file
18+
-`format`: Fixes formatting of the codebase
1919
-`start`: Builds and serves the site at http://localhost:1313 with Hugo.
2020
-`test:a11y`: Builds and serves the site, then uses Playwright and axe to test accessibility
2121
-`test:a11y:tests`: Not meant for independent use, only as part of `test:a11y`
@@ -26,6 +26,8 @@ See [About](content/about/_index.md) for more information
2626
- devDependencies
2727
-[`@axe-core/playwright`](https://npmjs.com/package/@axe-core/playwright): A11y tester bindings for Playwright
2828
-[`@playwright/test`](https://npmjs.com/package/@playwright/test): Browser automation and test library
29-
-[`cspell`](https://npmjs.com/package/cspell): Spellchecker
29+
-[`cspell`](https://npmjs.com/package/cspell): Spell-checker
30+
- linkinator: Link-checker (WIP)
31+
- prettier: Formatter (exact version pinned per [official recommendation](https://prettier.io/docs/next/install#summary))
3032
-[`sort-package-json`](https://npmjs.com/package/sort-package-json): Sorts package.json files for consistency
3133
-[`start-server-and-test`](https://npmjs.com/package/start-server-and-test): Allows easy setup and teardown of complex tests, like our a11y tests

a11y/a11y.test.ts

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
import{test,expect}from'@playwright/test';
2-
importAxeBuilderfrom'@axe-core/playwright';
1+
import{test,expect}from"@playwright/test";
2+
importAxeBuilderfrom"@axe-core/playwright";
33

4-
test.describe('homepage',()=>{
5-
test('should not have any automatically detectable accessibility issues',async({ page })=>{
6-
awaitpage.goto('http://localhost:1313/');
4+
test.describe("homepage",()=>{
5+
test("should not have any automatically detectable accessibility issues",async({
6+
page,
7+
})=>{
8+
awaitpage.goto("http://localhost:1313/");
79

810
constresults=awaitnewAxeBuilder({ page }).analyze();
911

1012
expect(results.violations).toEqual([]);
1113
});
12-
});
14+
});

assets/_custom.scss

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.container {
2-
max-width: 90rem;
2+
max-width: 90rem;
33
}
44

55
.markdownimg {
6-
/* Circumvent SCSS min function, we need the browser's one */
7-
max-width: #{"min(100%, 32rem)"};
6+
/* Circumvent SCSS min function, we need the browser's one */
7+
max-width: #{"min(100%, 32rem)"};
88
}

content/_index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
title: Main Page
3-
type: 'docs'
3+
type: "docs"
44
aliases:
5-
- "/Main_Page"
5+
- "/Main_Page"
66
---
77

88
# Luanti Documentation

content/about/_index.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: About
33
bookCollapseSection: true
44
aliases:
5-
- /about-this-site
5+
- /about-this-site
66
---
77

88
# About
@@ -26,8 +26,8 @@ Luanti Documentation is the central resource for the Luanti project. Contributor
2626

2727
Documentation will cover:
2828

29-
* Comprehensive API reference, examples, and guides
30-
* Engine reference and internal structures
31-
* Server and platform (player-facing) usage and guides
29+
- Comprehensive API reference, examples, and guides
30+
- Engine reference and internal structures
31+
- Server and platform (player-facing) usage and guides
3232

3333
This project began in December 2024. Our roadmap can be found at [GitHub issue #113: Roadmap](https://github.com/luanti-org/docs.luanti.org/issues/113).

0 commit comments

Comments
 (0)
close