Skip to content

Commit c8571a5

Browse files
committed
feat: 全新的 ESLint 配置
1 parent 92d0778 commit c8571a5

File tree

8 files changed

+1756
-589
lines changed

8 files changed

+1756
-589
lines changed

.eslintignore

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

.eslintrc.cjs

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

.prettierignore

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

.vscode/settings.json

Lines changed: 48 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,52 @@
11
{
22
"typescript.tsdk": "node_modules/typescript/lib",
3-
"prettier.enable": true,
3+
4+
// Disable the default formatter, use eslint instead
5+
"prettier.enable": false,
6+
"editor.formatOnSave": false,
7+
8+
// Auto fix
49
"editor.codeActionsOnSave": {
5-
"source.fixAll.eslint": "explicit"
6-
},
7-
"[vue]": {
8-
"editor.defaultFormatter": "esbenp.prettier-vscode"
9-
},
10-
"[javascript]": {
11-
"editor.defaultFormatter": "esbenp.prettier-vscode"
12-
},
13-
"[typescript]": {
14-
"editor.defaultFormatter": "esbenp.prettier-vscode"
15-
},
16-
"[json]": {
17-
"editor.defaultFormatter": "esbenp.prettier-vscode"
18-
},
19-
"[jsonc]": {
20-
"editor.defaultFormatter": "esbenp.prettier-vscode"
21-
},
22-
"[html]": {
23-
"editor.defaultFormatter": "esbenp.prettier-vscode"
24-
},
25-
"[css]": {
26-
"editor.defaultFormatter": "esbenp.prettier-vscode"
27-
},
28-
"[scss]": {
29-
"editor.defaultFormatter": "esbenp.prettier-vscode"
30-
}
10+
"source.fixAll.eslint": "explicit",
11+
"source.organizeImports": "never"
12+
},
13+
14+
// Silent the stylistic rules in you IDE, but still auto fix them
15+
"eslint.rules.customizations": [
16+
{ "rule": "style/*", "severity": "off", "fixable": true },
17+
{ "rule": "format/*", "severity": "off", "fixable": true },
18+
{ "rule": "*-indent", "severity": "off", "fixable": true },
19+
{ "rule": "*-spacing", "severity": "off", "fixable": true },
20+
{ "rule": "*-spaces", "severity": "off", "fixable": true },
21+
{ "rule": "*-order", "severity": "off", "fixable": true },
22+
{ "rule": "*-dangle", "severity": "off", "fixable": true },
23+
{ "rule": "*-newline", "severity": "off", "fixable": true },
24+
{ "rule": "*quotes", "severity": "off", "fixable": true },
25+
{ "rule": "*semi", "severity": "off", "fixable": true }
26+
],
27+
28+
// Enable eslint for all supported languages
29+
"eslint.validate": [
30+
"javascript",
31+
"javascriptreact",
32+
"typescript",
33+
"typescriptreact",
34+
"vue",
35+
"html",
36+
"markdown",
37+
"json",
38+
"jsonc",
39+
"yaml",
40+
"toml",
41+
"xml",
42+
"gql",
43+
"graphql",
44+
"astro",
45+
"svelte",
46+
"css",
47+
"less",
48+
"scss",
49+
"pcss",
50+
"postcss"
51+
]
3152
}

eslint.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import antfu from '@antfu/eslint-config'
2+
3+
export default antfu()

package.json

Lines changed: 20 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,38 @@
11
{
22
"name": "v3-admin-vite",
3+
"type": "module",
34
"version": "4.5.4",
45
"description": "一个免费开源的中后台管理系统基础解决方案,基于 Vue3、TypeScript、Element Plus、Pinia 和 Vite 等主流技术",
56
"author": {
67
"name": "pany",
78
"email": "[email protected]",
89
"url": "https://github.com/pany-ang"
910
},
11+
"license": "MIT",
1012
"repository": {
1113
"type": "git",
1214
"url": "https://github.com/un-pany/v3-admin-vite.git"
1315
},
14-
"type": "module",
16+
"keywords": [
17+
"vue",
18+
"vue3",
19+
"admin",
20+
"vue-admin",
21+
"vue3-admin",
22+
"vite",
23+
"vite-admin",
24+
"element-plus",
25+
"element-plus-admin",
26+
"ts",
27+
"typescript"
28+
],
1529
"scripts": {
1630
"dev": "vite",
1731
"build:stage": "vue-tsc --noEmit && vite build --mode staging",
1832
"build:prod": "vue-tsc --noEmit && vite build",
1933
"preview:stage": "pnpm build:stage && vite preview",
2034
"preview:prod": "pnpm build:prod && vite preview",
21-
"lint:eslint": "eslint --cache --max-warnings 0 \"{src,tests,types}/**/*.{vue,js,jsx,ts,tsx}\" --fix",
22-
"lint:prettier": "prettier --write \"{src,tests,types}/**/*.{vue,js,jsx,ts,tsx,json,css,less,scss,html,md}\"",
23-
"lint": "pnpm lint:eslint && pnpm lint:prettier",
35+
"lint": "eslint . --fix",
2436
"prepare": "husky",
2537
"test": "vitest"
2638
},
@@ -45,21 +57,16 @@
4557
"xe-utils": "3.5.31"
4658
},
4759
"devDependencies": {
60+
"@antfu/eslint-config": "3.9.1",
4861
"@types/js-cookie": "3.0.6",
4962
"@types/lodash-es": "4.17.12",
5063
"@types/node": "22.9.0",
5164
"@types/nprogress": "0.2.3",
5265
"@types/path-browserify": "1.0.3",
53-
"@typescript-eslint/eslint-plugin": "8.14.0",
54-
"@typescript-eslint/parser": "8.14.0",
5566
"@vitejs/plugin-vue": "5.2.0",
5667
"@vitejs/plugin-vue-jsx": "4.1.0",
57-
"@vue/eslint-config-prettier": "9.0.0",
58-
"@vue/eslint-config-typescript": "13.0.0",
5968
"@vue/test-utils": "2.4.6",
60-
"eslint": "8.57.1",
61-
"eslint-plugin-prettier": "5.2.1",
62-
"eslint-plugin-vue": "9.31.0",
69+
"eslint": "9.15.0",
6370
"husky": "9.1.6",
6471
"jsdom": "25.0.1",
6572
"lint-staged": "15.2.10",
@@ -71,33 +78,9 @@
7178
"vite-plugin-svg-icons": "2.0.1",
7279
"vite-svg-loader": "5.1.0",
7380
"vitest": "2.1.5",
74-
"vue-eslint-parser": "9.4.3",
7581
"vue-tsc": "2.1.10"
7682
},
7783
"lint-staged": {
78-
"*.{vue,js,jsx,ts,tsx}": [
79-
"eslint --fix",
80-
"prettier --write"
81-
],
82-
"*.{css,less,scss,html,md}": [
83-
"prettier --write"
84-
],
85-
"package.json": [
86-
"prettier --write"
87-
]
88-
},
89-
"keywords": [
90-
"vue",
91-
"vue3",
92-
"admin",
93-
"vue-admin",
94-
"vue3-admin",
95-
"vite",
96-
"vite-admin",
97-
"element-plus",
98-
"element-plus-admin",
99-
"ts",
100-
"typescript"
101-
],
102-
"license": "MIT"
84+
"*": "eslint --fix"
85+
}
10386
}

0 commit comments

Comments
 (0)