Skip to content

Commit 2a8d1d8

Browse files
committed
引入 ESLint
1 parent a411beb commit 2a8d1d8

File tree

23 files changed

+992
-33
lines changed

23 files changed

+992
-33
lines changed

.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue,css,scss,sass,less,styl}]
2+
charset = utf-8
3+
indent_size = 2
4+
indent_style = space
5+
insert_final_newline = true
6+
trim_trailing_whitespace = true
7+
end_of_line = lf
8+
max_line_length = 100

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,5 @@ coverage
3030
*.tsbuildinfo
3131
/chunk-analysis.html
3232
__pycache__
33-
.env
33+
.env
34+
.eslintcache

.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
auto-install-peers=true
2+
node-linker=hoisted

.vscode/extensions.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
{
2-
"recommendations": [
3-
"Vue.volar",
4-
"esbenp.prettier-vscode"
5-
]
2+
"recommendations": ["Vue.volar", "esbenp.prettier-vscode", "dbaeumer.vscode-eslint"]
63
}

eslint.config.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'
2+
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'
3+
import pluginVue from 'eslint-plugin-vue'
4+
import { globalIgnores } from 'eslint/config'
5+
6+
// To allow more languages other than `ts` in `.vue` files, uncomment the following lines:
7+
// import { configureVueProject } from '@vue/eslint-config-typescript'
8+
// configureVueProject({ scriptLangs: ['ts', 'tsx'] })
9+
// More info at https://github.com/vuejs/eslint-config-typescript/#advanced-setup
10+
11+
export default defineConfigWithVueTs(
12+
{
13+
name: 'app/files-to-lint',
14+
files: ['**/*.{vue,ts,mts,tsx}'],
15+
},
16+
17+
globalIgnores(['**/dist/**', '**/dist-ssr/**', '**/coverage/**', '**/vendors/**', 'env.d.ts']),
18+
19+
...pluginVue.configs['flat/essential'],
20+
vueTsConfigs.recommended,
21+
22+
skipFormatting,
23+
24+
{
25+
rules: {
26+
'vue/multi-word-component-names': 'off',
27+
'@typescript-eslint/no-unused-vars': [
28+
'warn',
29+
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
30+
],
31+
'@typescript-eslint/no-namespace': 'off',
32+
'@typescript-eslint/no-explicit-any': 'off',
33+
'vue/no-mutating-props': 'off',
34+
'vue/require-v-for-key': 'off',
35+
'vue/valid-v-for': 'off',
36+
},
37+
},
38+
)

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"preview": "vite preview",
1616
"build-only": "vite build",
1717
"type-check": "vue-tsc --build",
18+
"lint": "eslint . --fix --cache",
1819
"format": "prettier --write src/",
1920
"knip": "knip",
2021
"dict-rebuild": "python pipelines/prosoticDictGen/scripts/corrected2csv.py && tsx pipelines/prosoticDictGen/scripts/csv2dictJson.ts"
@@ -66,8 +67,12 @@
6667
"@types/node": "^22.19.3",
6768
"@types/wicg-file-system-access": "^2023.10.7",
6869
"@vitejs/plugin-vue": "^6.0.3",
70+
"@vue/eslint-config-prettier": "^10.2.0",
71+
"@vue/eslint-config-typescript": "^14.6.0",
6972
"@vue/tsconfig": "^0.8.1",
7073
"dotenv": "^17.2.3",
74+
"eslint": "^9.39.2",
75+
"eslint-plugin-vue": "~10.6.2",
7176
"knip": "^5.78.0",
7277
"npm-run-all2": "^8.0.4",
7378
"prettier": "^3.7.4",

0 commit comments

Comments
 (0)