Skip to content

Commit

Permalink
Format codebase, enforce formatting (#201)
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-wiemer authored Feb 24, 2025
1 parent 4d11574 commit e2c75d0
Show file tree
Hide file tree
Showing 159 changed files with 12,279 additions and 12,080 deletions.
10 changes: 5 additions & 5 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

version: 2
updates:
- package-ecosystem: gitsubmodule
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 20
- package-ecosystem: gitsubmodule
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 20
9 changes: 8 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Build with Hugo

on: [push, pull_request]
on: [push, pull_request, workflow_dispatch]

jobs:
build:
Expand All @@ -12,6 +12,13 @@ jobs:
fetch-depth: 0
- name: Install dependencies
run: npm ci
- name: Run Prettier
id: runPrettier
run: npm run format
- name: Show formatter diff if it exists
# https://docs.github.com/en/actions/learn-github-actions/expressions#failure
if: ${{ failure() }}
run: git diff
- name: Build site to check for errors
run: npm run build:ci
- name: check that links are all valid
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/hugo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Install Dart Sass
run: sudo snap install dart-sass
- name: Checkout
Expand All @@ -59,7 +59,7 @@ jobs:
hugo \
--gc \
--minify \
--baseURL "${{ steps.pages.outputs.base_url }}/"
--baseURL "${{ steps.pages.outputs.base_url }}/"
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
Expand All @@ -75,4 +75,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@v4
23 changes: 23 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated files by hugo
/public/
/resources/
/assets/jsconfig.json
hugo_stats.json

# Executable may be added to repository
hugo.exe
hugo.darwin
hugo.linux

# Temporary lock file while building
/.hugo_build.lock

# Node
node_modules

# A11y checker
test-results

# Upstream submodules
themes/hugo-book
themes/hugo-notice
25 changes: 11 additions & 14 deletions .vscode/dev.code-snippets
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,17 @@
"Notice": {
"scope": "markdown",
"prefix": "%",
"body": [
"{{< notice $1 >}}$2{{< /notice >}}",
"$0"
],
"description": "Notice shortcode"
"body": ["{{< notice $1 >}}$2{{< /notice >}}", "$0"],
"description": "Notice shortcode",
},
"CSpell toggle": {
"scope": "markdown",
"prefix": "%",
"body": [
"{{% comment %}} cspell:disable {{% /comment %}}",
"{{% comment %}} cspell:enable {{% /comment %}}",
"$0"
],
"description": "Toggle CSpell for a block of code"
}
"scope": "markdown",
"prefix": "%",
"body": [
"{{% comment %}} cspell:disable {{% /comment %}}",
"{{% comment %}} cspell:enable {{% /comment %}}",
"$0",
],
"description": "Toggle CSpell for a block of code",
},
}
8 changes: 4 additions & 4 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"recommendations": [
"streetsidesoftware.code-spell-checker-cspell-bundled-dictionaries"
]
}
"recommendations": [
"streetsidesoftware.code-spell-checker-cspell-bundled-dictionaries"
]
}
7 changes: 2 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
{
"editor.formatOnSave": false,
"editor.formatOnSave": true,
"cSpell.enabledFileTypes": {
"*": false,
"markdown": true
},
"cSpell.files": [
"/content/**",
"README.md",
]
"cSpell.files": ["/content/**", "README.md"]
}
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ See [About](content/about/_index.md) for more information
- scripts
- `build`: Builds the site to ensure changes are valid
- `build:ci`: Builds the site but fails if any warnings are detected. Used in our CI pipeline.
- `format:fix`: Fixes formatting of the `package.json` file
- `format`: Fixes formatting of the codebase
- `start`: Builds and serves the site at http://localhost:1313 with Hugo.
- `test:a11y`: Builds and serves the site, then uses Playwright and axe to test accessibility
- `test:a11y:tests`: Not meant for independent use, only as part of `test:a11y`
Expand All @@ -26,6 +26,8 @@ See [About](content/about/_index.md) for more information
- devDependencies
- [`@axe-core/playwright`](https://npmjs.com/package/@axe-core/playwright): A11y tester bindings for Playwright
- [`@playwright/test`](https://npmjs.com/package/@playwright/test): Browser automation and test library
- [`cspell`](https://npmjs.com/package/cspell): Spellchecker
- [`cspell`](https://npmjs.com/package/cspell): Spell-checker
- linkinator: Link-checker (WIP)
- prettier: Formatter (exact version pinned per [official recommendation](https://prettier.io/docs/next/install#summary))
- [`sort-package-json`](https://npmjs.com/package/sort-package-json): Sorts package.json files for consistency
- [`start-server-and-test`](https://npmjs.com/package/start-server-and-test): Allows easy setup and teardown of complex tests, like our a11y tests
14 changes: 8 additions & 6 deletions a11y/a11y.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { test, expect } from '@playwright/test';
import AxeBuilder from '@axe-core/playwright';
import { test, expect } from "@playwright/test";
import AxeBuilder from "@axe-core/playwright";

test.describe('homepage', () => {
test('should not have any automatically detectable accessibility issues', async ({ page }) => {
await page.goto('http://localhost:1313/');
test.describe("homepage", () => {
test("should not have any automatically detectable accessibility issues", async ({
page,
}) => {
await page.goto("http://localhost:1313/");

const results = await new AxeBuilder({ page }).analyze();

expect(results.violations).toEqual([]);
});
});
});
6 changes: 3 additions & 3 deletions assets/_custom.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.container {
max-width: 90rem;
max-width: 90rem;
}

.markdown img {
/* Circumvent SCSS min function, we need the browser's one */
max-width: #{"min(100%, 32rem)"};
/* Circumvent SCSS min function, we need the browser's one */
max-width: #{"min(100%, 32rem)"};
}
4 changes: 2 additions & 2 deletions content/_index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
title: Main Page
type: 'docs'
type: "docs"
aliases:
- "/Main_Page"
- "/Main_Page"
---

# Luanti Documentation
Expand Down
8 changes: 4 additions & 4 deletions content/about/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: About
bookCollapseSection: true
aliases:
- /about-this-site
- /about-this-site
---

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

Documentation will cover:

* Comprehensive API reference, examples, and guides
* Engine reference and internal structures
* Server and platform (player-facing) usage and guides
- Comprehensive API reference, examples, and guides
- Engine reference and internal structures
- Server and platform (player-facing) usage and guides

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).
Loading

0 comments on commit e2c75d0

Please sign in to comment.