Skip to content

Commit b1a551f

Browse files
committed
chore: migrate to @antfu/eslint-config
1 parent 1452f6c commit b1a551f

21 files changed

+4149
-2742
lines changed

.github/workflows/release-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Use Node.js v18
2020
uses: actions/setup-node@v3
2121
with:
22-
node-version: 18
22+
node-version: 20
2323
registry-url: https://registry.npmjs.org/
2424
cache: pnpm
2525

.github/workflows/sync-to-gitee.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Setup node
2727
uses: actions/setup-node@v3
2828
with:
29-
node-version: '18'
29+
node-version: '20'
3030
registry-url: https://registry.npmjs.com/
3131

3232
- name: Setup pnpm

.husky/commit-msg

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

.husky/common.sh

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

.husky/pre-commit

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

.prettierignore

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

.stylelintignore

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

.vscode/settings.json

Lines changed: 101 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,112 +1,113 @@
11
{
2-
"typescript.tsdk": "./node_modules/typescript/lib",
3-
"typescript.tsserver.maxTsServerMemory": 4096,
4-
"npm.packageManager": "pnpm",
5-
"editor.tabSize": 2,
6-
"editor.defaultFormatter": "esbenp.prettier-vscode",
7-
"files.eol": "\n",
8-
"editor.guides.bracketPairs": true,
9-
"editor.bracketPairColorization.enabled": true,
10-
"vue.inlayHints.missingProps": true,
11-
"vue.autoInsert.dotValue": true,
12-
"vue.server.maxOldSpaceSize": 4096,
13-
"explorer.copyRelativePathSeparator": "/",
14-
"search.exclude": {
15-
"**/node_modules": true,
16-
"**/*.log": true,
17-
"**/*.log*": true,
18-
"**/bower_components": true,
19-
"**/dist": true,
20-
"**/elehukouben": true,
21-
"**/.git": true,
22-
"**/.gitignore": true,
23-
"**/.svn": true,
24-
"**/.DS_Store": true,
25-
"**/.idea": true,
26-
"**/.vscode": false,
27-
"**/yarn.lock": true,
28-
"**/tmp": true,
29-
"out": true,
30-
"dist": true,
31-
"node_modules": true,
32-
"CHANGELOG.md": true,
33-
"examples": true,
34-
"res": true,
35-
"screenshots": true,
36-
"yarn-error.log": true,
37-
"**/.yarn": true
38-
},
39-
"files.exclude": {
40-
"**/.cache": true,
41-
"**/.editorconfig": true,
42-
"**/.eslintcache": true,
43-
"**/bower_components": true,
44-
"**/.idea": true,
45-
"**/tmp": true,
46-
"**/.git": true,
47-
"**/.svn": true,
48-
"**/.hg": true,
49-
"**/CVS": true,
50-
"**/.DS_Store": true
51-
},
52-
"files.watcherExclude": {
53-
"**/.git/objects/**": true,
54-
"**/.git/subtree-cache/**": true,
55-
"**/.vscode/**": true,
56-
"**/node_modules/**": true,
57-
"**/tmp/**": true,
58-
"**/bower_components/**": true,
59-
"**/dist/**": true,
60-
"**/yarn.lock": true
61-
},
62-
"eslint.useFlatConfig": true,
63-
"stylelint.enable": true,
64-
"stylelint.validate": ["css", "less", "postcss", "scss", "vue", "sass"],
65-
"path-intellisense.mappings": {
66-
"@/": "${workspaceRoot}/src"
67-
},
68-
"[javascriptreact]": {
69-
"editor.defaultFormatter": "esbenp.prettier-vscode"
70-
},
71-
"[typescript]": {
72-
"editor.defaultFormatter": "esbenp.prettier-vscode"
73-
},
74-
"[typescriptreact]": {
75-
"editor.defaultFormatter": "esbenp.prettier-vscode"
76-
},
77-
"[html]": {
78-
"editor.defaultFormatter": "esbenp.prettier-vscode"
79-
},
80-
"[css]": {
81-
"editor.defaultFormatter": "esbenp.prettier-vscode"
82-
},
83-
"[less]": {
84-
"editor.defaultFormatter": "esbenp.prettier-vscode"
85-
},
86-
"[scss]": {
87-
"editor.defaultFormatter": "esbenp.prettier-vscode"
88-
},
89-
"[markdown]": {
90-
"editor.defaultFormatter": "esbenp.prettier-vscode"
91-
},
2+
"typescript.preferences.importModuleSpecifier": "non-relative",
3+
// Disable the default formatter, use eslint instead
4+
"prettier.enable": false,
5+
"editor.formatOnSave": false,
6+
// Auto fix
927
"editor.codeActionsOnSave": {
938
"source.fixAll.eslint": "explicit",
94-
"source.fixAll.stylelint": "explicit"
9+
"source.organizeImports": "never"
9510
},
96-
"[vue]": {
97-
"editor.codeActionsOnSave": {
98-
"source.fixAll.eslint": "explicit",
99-
"source.fixAll.stylelint": "explicit"
11+
// Silent the stylistic rules in you IDE, but still auto fix them
12+
"eslint.rules.customizations": [
13+
{
14+
"rule": "style/*",
15+
"severity": "off",
16+
"fixable": true
17+
},
18+
{
19+
"rule": "format/*",
20+
"severity": "off",
21+
"fixable": true
22+
},
23+
{
24+
"rule": "*-indent",
25+
"severity": "off",
26+
"fixable": true
27+
},
28+
{
29+
"rule": "*-spacing",
30+
"severity": "off",
31+
"fixable": true
32+
},
33+
{
34+
"rule": "*-spaces",
35+
"severity": "off",
36+
"fixable": true
37+
},
38+
{
39+
"rule": "*-order",
40+
"severity": "off",
41+
"fixable": true
10042
},
101-
"editor.defaultFormatter": "esbenp.prettier-vscode"
43+
{
44+
"rule": "*-dangle",
45+
"severity": "off",
46+
"fixable": true
47+
},
48+
{
49+
"rule": "*-newline",
50+
"severity": "off",
51+
"fixable": true
52+
},
53+
{
54+
"rule": "*quotes",
55+
"severity": "off",
56+
"fixable": true
57+
},
58+
{
59+
"rule": "*semi",
60+
"severity": "off",
61+
"fixable": true
62+
}
63+
],
64+
// Enable eslint for all supported languages
65+
"eslint.validate": [
66+
"javascript",
67+
"javascriptreact",
68+
"typescript",
69+
"typescriptreact",
70+
"vue",
71+
"html",
72+
"markdown",
73+
"json",
74+
"jsonc",
75+
"yaml",
76+
"toml",
77+
"xml",
78+
"gql",
79+
"graphql",
80+
"astro",
81+
"svelte",
82+
"css",
83+
"less",
84+
"scss",
85+
"pcss",
86+
"postcss"
87+
],
88+
"search.exclude": {
89+
"**/node_modules": true,
90+
"**/dist": true,
91+
"**/dist-vite": true,
92+
"**/out": true,
93+
"**/build": true,
94+
"**/.git": true,
95+
"**/.vscode": true
10296
},
103-
"i18n-ally.localesPaths": ["src/locales/lang"],
97+
"i18n-ally.localesPaths": [
98+
"src/locales/lang"
99+
],
104100
"i18n-ally.keystyle": "nested",
105101
"i18n-ally.sortKeys": true,
106102
"i18n-ally.namespace": true,
107103
"i18n-ally.pathMatcher": "{locale}/{namespaces}.{ext}",
108-
"i18n-ally.enabledParsers": ["json"],
104+
"i18n-ally.enabledParsers": [
105+
"json"
106+
],
109107
"i18n-ally.sourceLanguage": "en",
110108
"i18n-ally.displayLanguage": "zh-CN",
111-
"i18n-ally.enabledFrameworks": ["vue", "react"]
112-
}
109+
"i18n-ally.enabledFrameworks": [
110+
"vue",
111+
"react"
112+
]
113+
}

eslint.config.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import antfu from '@antfu/eslint-config'
2+
3+
export default antfu(
4+
{
5+
lessOpinionated: true,
6+
formatters: true,
7+
vue: true,
8+
typescript: true,
9+
unocss: true,
10+
ignores: [],
11+
},
12+
{
13+
// Without `files`, they are general rules for all files
14+
rules: {
15+
'no-console': 'off',
16+
// 'style/multiline-comment-style': ['error', 'starred-block'],
17+
'jsdoc/convert-to-jsdoc-comments': ['warn'],
18+
'n/prefer-global/process': 'off',
19+
'vue/first-attribute-linebreak': 'off',
20+
'ts/no-unused-expressions': 'off',
21+
'unused-imports/no-unused-vars': [
22+
'error',
23+
{
24+
caughtErrors: 'none',
25+
varsIgnorePattern: '^_', // 忽略以 _ 开头的变量
26+
argsIgnorePattern: '^_', // 忽略以 _ 开头的参数
27+
},
28+
],
29+
},
30+
},
31+
).override('antfu/regexp/rules', () => ({}))

0 commit comments

Comments
 (0)