Skip to content
This repository was archived by the owner on Jul 23, 2025. It is now read-only.

Commit 6d4f322

Browse files
authored
Add linting and format checks (#20)
* Add VS Code, markdownlint, and prettier configs * Format and lint all files * Add ESLint and MDX plugin * Add GitHub Actions * Add pre-commit hooks and update markdownlint step
1 parent 3f1a86a commit 6d4f322

22 files changed

+5414
-278
lines changed

.github/actions/setup/action.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: 'Setup Action'
2+
description: 'Checks out the repo, sets up node, and installs dependencies'
3+
runs:
4+
using: 'composite'
5+
steps:
6+
- name: Checkout repository
7+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
8+
9+
- name: Set up Node.js
10+
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
11+
with:
12+
node-version: '22'
13+
14+
- name: Cache dependencies
15+
id: cache
16+
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
17+
with:
18+
path: ./node_modules
19+
key: modules-${{ hashFiles('package-lock.json') }}
20+
21+
- name: Install dependencies
22+
if: steps.cache.outputs.cache-hit != 'true'
23+
run: npm ci
24+
shell: bash

.github/dependabot.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: 'npm'
4+
directory: '/'
5+
schedule:
6+
interval: 'daily'
7+
groups:
8+
docusaurus:
9+
patterns:
10+
- '*docusaurus*'
11+
ignore:
12+
# Pin key docusaurus dependencies to major versions
13+
- dependency-name: '@mdx-js/react'
14+
update-types: ['version-update:semver-major']
15+
- dependency-name: 'prism-react-renderer'
16+
update-types: ['version-update:semver-major']
17+
- package-ecosystem: 'github-actions'
18+
directory: '/'
19+
schedule:
20+
interval: 'daily'

.github/dependabot.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Static checks
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
lint:
8+
name: Lint and format checks
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
13+
14+
- name: Setup
15+
uses: ./.github/actions/setup
16+
17+
- name: Run ESLint
18+
run: npm run eslint
19+
20+
- name: Run markdownlint
21+
run: npm run markdownlint
22+
23+
- name: Run Prettier
24+
run: npm run prettier
25+
26+
build:
27+
name: Build site
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout Repository
31+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
32+
33+
- name: Setup
34+
uses: ./.github/actions/setup
35+
36+
- name: Build site
37+
run: npm run build

.github/workflows/on-pr.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: On PR
2+
3+
on:
4+
pull_request:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
static-checks:
11+
name: Static checks
12+
uses: ./.github/workflows/_static-checks.yaml
13+
secrets: inherit

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx lint-staged

.lintstagedrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"*.{js,jsx,ts,tsx,mjs,cjs}": ["npx prettier --write", "npx eslint --fix"],
3+
"*.md": ["npx prettier --write", "npx markdownlint-cli2 --fix"],
4+
"*.css": ["npx prettier --write"]
5+
}

.markdownlint.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"heading-style": {
3+
"style": "atx"
4+
},
5+
"ul-style": {
6+
"style": "dash"
7+
},
8+
"line-length": {
9+
"line_length": 80,
10+
"code_blocks": false,
11+
"tables": false
12+
},
13+
"hr-style": {
14+
"style": "---"
15+
},
16+
"proper-names": {
17+
"names": ["CodeGate", "Copilot", "GitHub"],
18+
"code_blocks": false
19+
},
20+
"code-block-style": {
21+
"style": "fenced"
22+
},
23+
"code-fence-style": {
24+
"style": "backtick"
25+
},
26+
"emphasis-style": {
27+
"style": "underscore"
28+
},
29+
"strong-style": {
30+
"style": "asterisk"
31+
},
32+
"table-pipe-style": {
33+
"style": "leading_and_trailing"
34+
}
35+
}

.prettierignore

Whitespace-only changes.

.prettierrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"jsxSingleQuote": true,
3+
"printWidth": 80,
4+
"proseWrap": "always",
5+
"singleQuote": true,
6+
"tabWidth": 2,
7+
"trailingComma": "es5",
8+
"useTabs": false
9+
}

0 commit comments

Comments
 (0)