Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b28c5a7

Browse files
fix: 升级 eslint9 相关配置
1 parent cf25514 commit b28c5a7

File tree

6 files changed

+223
-60
lines changed

6 files changed

+223
-60
lines changed

‎.eslintrc.js‎

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

‎.gitignore‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ coverage
1818
/cypress/screenshots/
1919

2020
# Editor directories and files
21-
.vscode/*
22-
!.vscode/extensions.json
23-
!.vscode/vue3.2.code-snippets
2421
.idea
2522
*.suo
2623
*.ntvs*

‎.vscode/settings.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"editor.formatOnSave": true,
3+
"eslint.format.enable": true
4+
}

‎eslint.config.js‎

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
import js from "@eslint/js";
2+
import pluginVue from "eslint-plugin-vue";
3+
import * as parserVue from "vue-eslint-parser";
4+
import configPrettier from "eslint-config-prettier";
5+
import pluginPrettier from "eslint-plugin-prettier";
6+
import {
7+
defineFlatConfig
8+
} from "eslint-define-config";
9+
import * as parserTypeScript from "@typescript-eslint/parser";
10+
import pluginTypeScript from "@typescript-eslint/eslint-plugin";
11+
import globals from 'globals';
12+
13+
export default defineFlatConfig([{
14+
...js.configs.recommended,
15+
ignores: [
16+
"**/.*",
17+
"dist/*",
18+
"*.d.ts",
19+
"public/*",
20+
"src/assets/**"
21+
],
22+
languageOptions: {
23+
globals: globals.browser
24+
},
25+
plugins: {
26+
prettier: pluginPrettier
27+
},
28+
rules: {
29+
...configPrettier.rules,
30+
...pluginPrettier.configs.recommended.rules,
31+
"no-debugger": "off",
32+
"no-unused-vars": [
33+
"error",
34+
{
35+
argsIgnorePattern: "^_",
36+
varsIgnorePattern: "^_"
37+
}
38+
],
39+
"prettier/prettier": [
40+
"error",
41+
{
42+
endOfLine: "auto"
43+
}
44+
]
45+
}
46+
},
47+
{
48+
files: ["**/*.?([cm])ts", "**/*.?([cm])tsx"],
49+
languageOptions: {
50+
parser: parserTypeScript,
51+
parserOptions: {
52+
sourceType: "module"
53+
}
54+
},
55+
plugins: {
56+
"@typescript-eslint": pluginTypeScript
57+
},
58+
rules: {
59+
...pluginTypeScript.configs.strict.rules,
60+
"@typescript-eslint/ban-types": "off",
61+
"@typescript-eslint/no-redeclare": "error",
62+
"@typescript-eslint/ban-ts-comment": "off",
63+
"@typescript-eslint/no-explicit-any": "off",
64+
"@typescript-eslint/prefer-as-const": "warn",
65+
"@typescript-eslint/no-empty-function": "off",
66+
"@typescript-eslint/no-non-null-assertion": "off",
67+
"@typescript-eslint/no-import-type-side-effects": "error",
68+
"@typescript-eslint/explicit-module-boundary-types": "off",
69+
"@typescript-eslint/consistent-type-imports": [
70+
"error",
71+
{
72+
disallowTypeAnnotations: false,
73+
fixStyle: "inline-type-imports"
74+
}
75+
],
76+
"@typescript-eslint/prefer-literal-enum-member": [
77+
"error",
78+
{
79+
allowBitwiseExpressions: true
80+
}
81+
],
82+
"@typescript-eslint/no-unused-vars": [
83+
"error",
84+
{
85+
argsIgnorePattern: "^_",
86+
varsIgnorePattern: "^_"
87+
}
88+
]
89+
}
90+
},
91+
{
92+
files: ["**/*.d.ts"],
93+
rules: {
94+
"eslint-comments/no-unlimited-disable": "off",
95+
"import/no-duplicates": "off",
96+
"unused-imports/no-unused-vars": "off"
97+
}
98+
},
99+
{
100+
files: ["**/*.?([cm])js"],
101+
rules: {
102+
"@typescript-eslint/no-require-imports": "off",
103+
"@typescript-eslint/no-var-requires": "off"
104+
}
105+
},
106+
{
107+
files: ["**/*.vue"],
108+
languageOptions: {
109+
globals: {
110+
$: "readonly",
111+
$$: "readonly",
112+
$computed: "readonly",
113+
$customRef: "readonly",
114+
$ref: "readonly",
115+
$shallowRef: "readonly",
116+
$toRef: "readonly"
117+
},
118+
parser: parserVue,
119+
parserOptions: {
120+
ecmaFeatures: {
121+
jsx: true
122+
},
123+
extraFileExtensions: [".vue"],
124+
parser: "@typescript-eslint/parser",
125+
sourceType: "module"
126+
}
127+
},
128+
plugins: {
129+
vue: pluginVue
130+
},
131+
processor: pluginVue.processors[".vue"],
132+
rules: {
133+
...pluginVue.configs.base.rules,
134+
...pluginVue.configs["vue3-essential"].rules,
135+
...pluginVue.configs["vue3-recommended"].rules,
136+
"no-undef": "off",
137+
"no-unused-vars": "off",
138+
"vue/no-v-html": "off",
139+
"vue/require-default-prop": "off",
140+
"vue/require-explicit-emits": "off",
141+
"vue/multi-word-component-names": "off",
142+
"vue/no-setup-props-reactivity-loss": "off",
143+
"vue/html-self-closing": [
144+
"error",
145+
{
146+
html: {
147+
void: "always",
148+
normal: "always",
149+
component: "always"
150+
},
151+
svg: "always",
152+
math: "always"
153+
}
154+
]
155+
}
156+
}
157+
]);

‎package.json‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,25 @@
3434
},
3535
"devDependencies": {
3636
"@commitlint/config-conventional": "^19.2.2",
37+
"@eslint/js": "^9.3.0",
3738
"@rushstack/eslint-patch": "^1.10.2",
3839
"@types/node": "^20.12.12",
3940
"@types/nprogress": "^0.2.3",
41+
"@typescript-eslint/eslint-plugin": "^7.9.0",
4042
"@typescript-eslint/parser": "^7.9.0",
4143
"@vitejs/plugin-vue": "^5.0.4",
4244
"@vitejs/plugin-vue-jsx": "^3.1.0",
43-
"@vue/eslint-config-prettier": "^9.0.0",
4445
"@vue/eslint-config-typescript": "^13.0.0",
4546
"@vue/tsconfig": "^0.5.1",
4647
"autoprefixer": "^10.4.19",
4748
"cnjm-postcss-px-to-viewport": "^1.0.1",
4849
"commitlint": "^19.3.0",
4950
"eslint": "^9.2.0",
51+
"eslint-config-prettier": "^9.1.0",
52+
"eslint-define-config": "^2.1.0",
53+
"eslint-plugin-prettier": "^5.1.3",
5054
"eslint-plugin-vue": "^9.26.0",
55+
"globals": "^15.2.0",
5156
"husky": "^9.0.11",
5257
"less": "^4.2.0",
5358
"mockjs": "^1.1.0",
@@ -57,6 +62,7 @@
5762
"standard-version": "^9.5.0",
5863
"tailwindcss": "^3.4.3",
5964
"typescript": "~5.4.5",
65+
"typescript-eslint": "^7.9.0",
6066
"unplugin-vue-components": "^0.27.0",
6167
"vite": "^5.2.11",
6268
"vite-plugin-cdn2": "^1.1.0",

‎pnpm-lock.yaml‎

Lines changed: 55 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /