Skip to content

Commit b808712

Browse files
committed
lint test
1 parent 8dd0ef7 commit b808712

File tree

4 files changed

+174
-0
lines changed

4 files changed

+174
-0
lines changed

.clang-format

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BasedOnStyle: LLVM
2+
IndentWidth: 4

.github/workflows/lint.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: Lint & Format
2+
3+
permissions:
4+
contents: write
5+
6+
7+
on:
8+
push:
9+
branches: [main]
10+
11+
workflow_dispatch:
12+
13+
concurrency:
14+
group: lint
15+
cancel-in-progress: false
16+
17+
jobs:
18+
lint:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
- name: Setup Git
26+
env:
27+
GHT: ${{ github.token }}
28+
run: |
29+
echo $GHT | gh auth login --with-token
30+
gh auth status
31+
gh auth setup-git
32+
git config --global user.name 'github-actions[bot]'
33+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
34+
35+
- name: Setup Node
36+
uses: actions/setup-node@v4
37+
with:
38+
node-version-file: package.json
39+
check-latest: true
40+
#cache: yarn
41+
42+
- name: Setup yarn
43+
run: |
44+
corepack enable
45+
yarn set version stable
46+
47+
48+
- name: Get yarn cachedir
49+
id: yarn-cachedir
50+
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
51+
52+
- name: Cache yarn
53+
uses: actions/cache@v4
54+
with:
55+
path: ${{ steps.yarn-cachedir.outputs.dir }}
56+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
57+
restore-keys: |
58+
${{ runner.os }}-yarn-
59+
60+
- name: Install dependencies
61+
run: yarn install
62+
63+
- name: Cpp Lint (clang-format & clang-tidy)
64+
uses: cpp-linter/cpp-linter-action@v2
65+
with:
66+
style: file
67+
thread-comments: update
68+
continue-on-error: true
69+
70+
- name: ESLint (+vue +prettier)
71+
run: yarn run eslint --fix --ignore-pattern .gitignore
72+
continue-on-error: true
73+
74+
- name: Prettier
75+
run: yarn run prettier --write .
76+
continue-on-error: true
77+
78+
- name: Markdown Lint
79+
uses: DavidAnson/markdownlint-cli2-action@v19
80+
with:
81+
globs: '**/*.{md,markdown} !node_modules'
82+
fix: true
83+
continue-on-error: true
84+
85+
- name: Autocorrect (Pangu)
86+
id: autocorrect
87+
uses: huacnlee/autocorrect-action@v2
88+
with:
89+
use_npm: true
90+
continue-on-error: true
91+
- name: Report ReviewDog
92+
if: steps.autocorrect.outcome == 'failure'
93+
uses: huacnlee/autocorrect-action@v2
94+
env:
95+
REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }}
96+
with:
97+
reviewdog: true
98+
99+
- name: Create PullRequest
100+
permissions:
101+
workflows: write
102+
run: |
103+
git branch -f lint
104+
git switch lint
105+
git add .
106+
git commit -m "lint:${{ github.ref }}"
107+
git push -f origin lint
108+
gh pr create --fill
109+

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
},
99
"devDependencies": {
1010
"@eslint/js": "^9.19.0",
11+
"autocorrect-node": "^2.13.0",
1112
"eslint": "^9.19.0",
1213
"eslint-config-prettier": "^10.0.1",
1314
"eslint-plugin-prettier": "^5.2.3",

yarn.lock

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,6 +1822,67 @@ __metadata:
18221822
languageName: node
18231823
linkType: hard
18241824

1825+
"autocorrect-node-darwin-arm64@npm:2.13.0":
1826+
version: 2.13.0
1827+
resolution: "autocorrect-node-darwin-arm64@npm:2.13.0"
1828+
conditions: os=darwin & cpu=arm64
1829+
languageName: node
1830+
linkType: hard
1831+
1832+
"autocorrect-node-darwin-x64@npm:2.13.0":
1833+
version: 2.13.0
1834+
resolution: "autocorrect-node-darwin-x64@npm:2.13.0"
1835+
conditions: os=darwin & cpu=x64
1836+
languageName: node
1837+
linkType: hard
1838+
1839+
"autocorrect-node-linux-x64-gnu@npm:2.13.0":
1840+
version: 2.13.0
1841+
resolution: "autocorrect-node-linux-x64-gnu@npm:2.13.0"
1842+
conditions: os=linux & cpu=x64 & libc=glibc
1843+
languageName: node
1844+
linkType: hard
1845+
1846+
"autocorrect-node-linux-x64-musl@npm:2.13.0":
1847+
version: 2.13.0
1848+
resolution: "autocorrect-node-linux-x64-musl@npm:2.13.0"
1849+
conditions: os=linux & cpu=x64 & libc=musl
1850+
languageName: node
1851+
linkType: hard
1852+
1853+
"autocorrect-node-win32-x64-msvc@npm:2.13.0":
1854+
version: 2.13.0
1855+
resolution: "autocorrect-node-win32-x64-msvc@npm:2.13.0"
1856+
conditions: os=win32 & cpu=x64
1857+
languageName: node
1858+
linkType: hard
1859+
1860+
"autocorrect-node@npm:^2.13.0":
1861+
version: 2.13.0
1862+
resolution: "autocorrect-node@npm:2.13.0"
1863+
dependencies:
1864+
autocorrect-node-darwin-arm64: "npm:2.13.0"
1865+
autocorrect-node-darwin-x64: "npm:2.13.0"
1866+
autocorrect-node-linux-x64-gnu: "npm:2.13.0"
1867+
autocorrect-node-linux-x64-musl: "npm:2.13.0"
1868+
autocorrect-node-win32-x64-msvc: "npm:2.13.0"
1869+
dependenciesMeta:
1870+
autocorrect-node-darwin-arm64:
1871+
optional: true
1872+
autocorrect-node-darwin-x64:
1873+
optional: true
1874+
autocorrect-node-linux-x64-gnu:
1875+
optional: true
1876+
autocorrect-node-linux-x64-musl:
1877+
optional: true
1878+
autocorrect-node-win32-x64-msvc:
1879+
optional: true
1880+
bin:
1881+
autocorrect: cli.js
1882+
checksum: 10c0/18da306651f207243b2d0268c877270a8438fdc7a36710e5f83bf71d7c66999fab9faa44b44d23358086ae45f4015be429808d8e83a20379a78ce68a2d16d5ee
1883+
languageName: node
1884+
linkType: hard
1885+
18251886
"balanced-match@npm:^1.0.0":
18261887
version: 1.0.2
18271888
resolution: "balanced-match@npm:1.0.2"
@@ -5500,6 +5561,7 @@ __metadata:
55005561
resolution: "vitepress@workspace:."
55015562
dependencies:
55025563
"@eslint/js": "npm:^9.19.0"
5564+
autocorrect-node: "npm:^2.13.0"
55035565
eslint: "npm:^9.19.0"
55045566
eslint-config-prettier: "npm:^10.0.1"
55055567
eslint-plugin-prettier: "npm:^5.2.3"

0 commit comments

Comments
 (0)