Skip to content

Commit 192f05b

Browse files
committed
chore: add commitlint and prettier
1 parent 0a649d0 commit 192f05b

File tree

11 files changed

+1424
-7
lines changed

11 files changed

+1424
-7
lines changed

.github/workflows/lint.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Linting
2+
3+
on: [push, pull_request]
4+
permissions:
5+
contents: write
6+
pull-requests: write
7+
8+
jobs:
9+
# Example file at
10+
# https://commitlint.js.org/guides/ci-setup.html
11+
# doest work. Found a solution at
12+
# https://github.com/conventional-changelog/commitlint/pull/4132
13+
commitlint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Use Node.js
18+
uses: actions/setup-node@v4
19+
- name: Print versions
20+
run: |
21+
git --version
22+
node --version
23+
npm --version
24+
npx commitlint --version
25+
- name: Install commitlint
26+
run: |
27+
npm install conventional-changelog-conventionalcommits
28+
npm install commitlint@latest
29+
30+
- name: Validate current commit (last commit) with commitlint
31+
if: github.event_name == 'push'
32+
run: npx commitlint --last --verbose
33+
34+
- name: Validate PR commits with commitlint
35+
if: github.event_name == 'pull_request'
36+
run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose

.husky/.gitignore

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

.husky/commit-msg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx --no -- commitlint --edit $1

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npm run format:check

.prettierignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Prettier ignore list
2+
# (everything from .gitignore is already excluded)
3+
4+
tests/test_bake
5+
template/.prettierrc
6+
7+
# Ugly preventing pass Prettier but just copy from Sphinx Basic theme
8+
template/src/{{ project_slug }}/domainindex.html
9+
template/src/{{ project_slug }}/genindex.html
10+
template/src/{{ project_slug }}/static/doctools.js
11+
template/src/{{ project_slug }}/static/documentation_options.js.jinja
12+
template/src/{{ project_slug }}/static/language_data.js.jinja
13+
template/src/{{ project_slug }}/static/searchtools.js
14+
template/src/{{ project_slug }}/static/sphinx_highlight.js

.prettierrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"plugins": ["prettier-plugin-jinja-template", "prettier-plugin-tailwindcss"],
3+
4+
"overrides": [
5+
{
6+
"files": ["*.html"],
7+
"options": {
8+
"parser": "jinja-template"
9+
}
10+
}
11+
]
12+
}

commitlint.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type { UserConfig } from "@commitlint/types";
2+
3+
const Configuration: UserConfig = {
4+
extends: ["@commitlint/config-conventional"],
5+
};
6+
7+
export default Configuration;

docs/source/usage.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ The `package.json` must contain the following `scripts` tasks. They are called b
2828
"scripts": {
2929
"theme:build": "...",
3030
"theme:watch": "..."
31-
},
32-
...
31+
}
32+
}
3333
```
3434

3535
For example, if you want to build just Node.js assets, call `npm run theme:build`.

0 commit comments

Comments
 (0)