Skip to content

Commit 883645c

Browse files
🔧 chore: align lint-staged and lint tooling with lobe-ui
Wire husky pre-commit (type-check, lint:circular, lint-staged), add stylelint/remark configs and scripts, and hoist remark/stylelint for CLI plugin resolution. Adapt globs to src/site/playground; omit stylelint on mjs/cjs.
1 parent 9e70faf commit 883645c

8 files changed

Lines changed: 293 additions & 36 deletions

File tree

‎.husky/pre-commit‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env sh
2+
3+
npm run type-check
4+
npm run lint:circular
5+
npx --no-install lint-staged

‎.prettierignore‎

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,56 @@
1+
# Prettierignore for docs-kit
2+
################################################################
3+
4+
# general
5+
.DS_Store
6+
.editorconfig
7+
.idea
8+
.vscode
9+
.history
10+
.temp
11+
.env.local
12+
.husky
13+
.npmrc
14+
.gitkeep
15+
venv
16+
temp
17+
tmp
18+
LICENSE
19+
20+
# dependencies
121
**/node_modules
2-
**/dist
3-
**/.react-router
22+
*.log
23+
*.lock
24+
package-lock.json
25+
pnpm-lock.yaml
26+
27+
# ci / caches
428
coverage
29+
.coverage
30+
.eslintcache
31+
.stylelintcache
532
.vitest
6-
pnpm-lock.yaml
7-
CHANGELOG.md
833
site/compiler/.cache
34+
test-output
35+
__snapshots__
36+
*.snap
37+
38+
# production
39+
**/.react-router/
40+
**/dist
41+
es
42+
lib
43+
logs
44+
45+
# generated / changelog
46+
CHANGELOG.md
47+
48+
# ignore files
49+
.*ignore
50+
51+
# image
52+
*.webp
53+
*.gif
54+
*.png
55+
*.jpg
56+
*.ico

‎.remarkrc.mjs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { remarklint } from '@lobehub/lint';
2+
3+
export default remarklint;

‎AGENTS.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,13 @@ pnpm build:playground # full static build + artifact audit of playground/ (w
6262
pnpm test # vitest run (cwd = playground/)
6363
pnpm exec vitest run <path>
6464
pnpm lint # eslint .
65-
pnpm type-check # tsc --noEmit
65+
pnpm lint:style # stylelint on src/site/playground
66+
pnpm lint:md # remark markdown lint
67+
pnpm lint:circular # dpdm circular import check
68+
pnpm type-check # tsrs --noEmit
6669
```
6770

6871
- CI (`.github/workflows/test.yml`) runs `pnpm install --frozen-lockfile`, lint, type-check, `test:coverage` and `build:playground`. Commit `pnpm-lock.yaml` with any dependency change.
6972
- Restart `pnpm dev` after editing `playground/docs.config.ts`.
70-
- The only git hook is `commit-msg` (commitlint). Never use `--no-verify`.
73+
- Git hooks (husky): `pre-commit` runs `type-check`, `lint:circular`, and `lint-staged` (prettier + stylelint + eslint on staged files); `commit-msg` runs commitlint. Never use `--no-verify`.
7174
- Commits: gitmoji + conventional commit with a lowercase scope, enforced by commitlint, e.g. `✨ feat(cli): ...`, `🐛 fix(search): ...`, `📝 docs: ...`, `✨ feat(playground): ...`. semantic-release publishes to npm from `main`; never bump versions by hand.

‎package.json‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,40 @@
3535
"build:playground": "pnpm --filter docs-kit-playground run build",
3636
"dev": "pnpm --filter docs-kit-playground run dev",
3737
"lint": "eslint .",
38+
"lint:circular": "dpdm \"{src,site}/**/*.{ts,tsx}\" --warning false --tree false --exit-code circular:1 -T true",
3839
"lint:fix": "eslint . --fix",
40+
"lint:md": "remark . --quiet --frail --output",
41+
"lint:style": "stylelint \"{src,site,playground}/**/*.{ts,tsx}\" --fix",
3942
"prepare": "husky",
43+
"prettier": "prettier -c --write --no-error-on-unmatched-pattern \"**/**\"",
4044
"release": "semantic-release",
4145
"test": "vitest run",
4246
"test:coverage": "vitest run --coverage",
4347
"test:watch": "vitest",
4448
"type-check": "tsrs --noEmit"
4549
},
50+
"lint-staged": {
51+
"*.{md,mdx}": [
52+
"prettier --write --no-error-on-unmatched-pattern"
53+
],
54+
"*.json": [
55+
"prettier --write --no-error-on-unmatched-pattern"
56+
],
57+
"*.{js,jsx}": [
58+
"prettier --write",
59+
"stylelint --fix",
60+
"eslint --fix"
61+
],
62+
"*.{mjs,cjs}": [
63+
"prettier --write",
64+
"eslint --fix"
65+
],
66+
"*.{ts,tsx}": [
67+
"prettier --parser=typescript --write",
68+
"stylelint --fix",
69+
"eslint --fix"
70+
]
71+
},
4672
"dependencies": {
4773
"@giscus/react": "^3.1.0",
4874
"@lobehub/ui": "^6.15.2",
@@ -82,14 +108,19 @@
82108
"@types/unist": "^3.0.3",
83109
"@vitest/coverage-v8": "^5.1.0",
84110
"conventional-changelog-gitmoji-config": "1.5.2",
111+
"dpdm": "^4.3.0",
85112
"eslint": "^10.14.0",
86113
"husky": "^9.1.7",
87114
"jsdom": "^29.1.1",
115+
"lint-staged": "^17.6.0",
88116
"prettier": "^3.9.10",
89117
"react": "^19.3.1",
90118
"react-dom": "^19.3.1",
91119
"react-router": "8.4.0",
120+
"remark": "^15.0.1",
121+
"remark-cli": "^12.0.1",
92122
"semantic-release": "^25.0.9",
123+
"stylelint": "^16.26.1",
93124
"tsrs": "0.18.0-ts7.1.0-dev.20260929",
94125
"tsx": "^4.23.15",
95126
"vite": "8.3.4",

0 commit comments

Comments
 (0)