Skip to content

Commit fe2f8b2

Browse files
committed
feat(eslint-config): upgrade to eslint v9 and flat config (close #9)
BREAKING CHANGE: upgrade to eslint v9 and flat config
1 parent bcbfe34 commit fe2f8b2

28 files changed

+5435
-4138
lines changed

.commitlintrc.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

.eslintignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

.eslintrc.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ node_modules/
66

77
# Log files
88
*.log
9+
10+
# Dist files
11+
dist/

.vscode/settings.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@
1010
"[markdown]": {
1111
"files.trimTrailingWhitespace": false
1212
},
13+
"typescript.tsdk": "node_modules/typescript/lib",
14+
"eslint.useFlatConfig": true,
1315
"eslint.validate": [
1416
"javascript",
1517
"javascriptreact",
18+
"markdown",
1619
"typescript",
1720
"typescriptreact",
1821
"vue"
19-
],
20-
"cSpell.words": ["commitlintrc"]
22+
]
2123
}

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
## Packages
66

77
- [eslint-config-vuepress](https://github.com/vuepress/configs/tree/main/packages/eslint-config-vuepress)
8-
- [eslint-config-vuepress-typescript](https://github.com/vuepress/configs/tree/main/packages/eslint-config-vuepress-typescript)
98
- [prettier-config-vuepress](https://github.com/vuepress/configs/tree/main/packages/prettier-config-vuepress)
109
- [tsconfig-vuepress](https://github.com/vuepress/configs/tree/main/packages/tsconfig-vuepress)
1110

commitlint.config.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import * as fs from 'node:fs'
2+
import * as path from 'node:path'
3+
import type { UserConfig } from '@commitlint/types'
4+
5+
const packages = fs.readdirSync(path.resolve(__dirname, 'packages'))
6+
const scopes = packages.map((name) => name.replace(/-vuepress$/, ''))
7+
8+
export default {
9+
extends: ['@commitlint/config-conventional'],
10+
rules: {
11+
'scope-enum': [2, 'always', scopes],
12+
'footer-max-line-length': [0],
13+
},
14+
} satisfies UserConfig

eslint.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import process from 'node:process'
2+
import { env, vuepress } from 'eslint-config-vuepress'
3+
4+
const shouldCheckTest = process.env.CHECK_TEST === 'true' || env.IS_EDITOR
5+
6+
export default vuepress({
7+
ignores: shouldCheckTest ? [] : ['test/**'],
8+
})

lerna.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
"allowBranch": "main",
77
"conventionalCommits": true,
88
"exact": true,
9-
"ignoreChanges": [
10-
"**/*.md"
11-
],
9+
"ignoreChanges": ["**/*.md"],
1210
"message": "build: publish %s"
1311
}
1412
}

package.json

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
{
22
"name": "@vuepress/configs",
33
"private": true,
4+
"type": "module",
45
"scripts": {
5-
"format": "prettier --write packages",
6-
"lint": "eslint packages && prettier --check packages",
7-
"lint:all": "eslint --ext .js,.ts,.vue .",
6+
"build": "pnpm -r run build",
7+
"clean": "pnpm -r run clean",
8+
"format": "prettier --write .",
9+
"lint": "eslint . && prettier --check .",
10+
"lint:test": "CHECK_TEST=true eslint test",
811
"prepare": "husky",
9-
"release": "pnpm lint && lerna publish"
12+
"release": "pnpm release:check && pnpm release:publish",
13+
"release:check": "pnpm clean && pnpm build && pnpm lint",
14+
"release:publish": "lerna publish"
1015
},
1116
"lint-staged": {
1217
"!(test)/**/*.(js)": [
@@ -18,19 +23,21 @@
1823
},
1924
"prettier": "prettier-config-vuepress",
2025
"devDependencies": {
21-
"@commitlint/cli": "^19.2.1",
22-
"@commitlint/config-conventional": "^19.1.0",
23-
"@lerna-lite/cli": "^3.3.1",
24-
"@lerna-lite/publish": "^3.3.1",
25-
"eslint": "^8.57.0",
26+
"@commitlint/cli": "^19.4.0",
27+
"@commitlint/config-conventional": "^19.2.2",
28+
"@commitlint/types": "^19.0.3",
29+
"@lerna-lite/cli": "^3.8.0",
30+
"@lerna-lite/publish": "^3.8.0",
31+
"eslint": "^9.9.0",
2632
"eslint-config-vuepress": "workspace:*",
27-
"eslint-config-vuepress-typescript": "workspace:*",
28-
"husky": "^9.0.11",
29-
"lint-staged": "^15.2.2",
30-
"prettier": "^3.2.5",
33+
"husky": "^9.1.4",
34+
"lint-staged": "^15.2.9",
35+
"prettier": "^3.3.3",
3136
"prettier-config-vuepress": "workspace:*",
32-
"sort-package-json": "^2.8.0",
37+
"sort-package-json": "^2.10.0",
3338
"tsconfig-vuepress": "workspace:*",
34-
"typescript": "^5.4.3"
35-
}
39+
"typescript": "^5.5.4",
40+
"unbuild": "^2.0.0"
41+
},
42+
"packageManager": "[email protected]"
3643
}

packages/eslint-config-vuepress-typescript/CHANGELOG.md

Lines changed: 0 additions & 240 deletions
This file was deleted.

0 commit comments

Comments
 (0)