feat: 添加 ESLint 配置并集成到 VSCode
pnpm dlx @antfu/eslint-config@latest
This commit is contained in:
parent
9c074652e1
commit
79c333e647
67
.vscode/settings.json
vendored
67
.vscode/settings.json
vendored
@ -1,14 +1,14 @@
|
|||||||
{
|
{
|
||||||
// 默认格式化工具选择prettier
|
// 默认格式化工具选择prettier
|
||||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||||
// 保存的时候自动格式化
|
// // 保存的时候自动格式化
|
||||||
"editor.formatOnSave": true,
|
// "editor.formatOnSave": true,
|
||||||
//开启自动修复
|
// //开启自动修复
|
||||||
"editor.codeActionsOnSave": {
|
// "editor.codeActionsOnSave": {
|
||||||
"source.fixAll": "explicit",
|
// "source.fixAll": "explicit",
|
||||||
"source.fixAll.eslint": "explicit",
|
// "source.fixAll.eslint": "explicit",
|
||||||
"source.fixAll.stylelint": "explicit"
|
// "source.fixAll.stylelint": "explicit"
|
||||||
},
|
// },
|
||||||
// 配置stylelint检查的文件类型范围
|
// 配置stylelint检查的文件类型范围
|
||||||
"stylelint.validate": ["css", "scss", "vue", "html"], // 与package.json的scripts对应
|
"stylelint.validate": ["css", "scss", "vue", "html"], // 与package.json的scripts对应
|
||||||
"stylelint.enable": true,
|
"stylelint.enable": true,
|
||||||
@ -61,5 +61,54 @@
|
|||||||
"pages.config.ts": "manifest.config.ts,openapi-ts-request.config.ts",
|
"pages.config.ts": "manifest.config.ts,openapi-ts-request.config.ts",
|
||||||
"package.json": "pnpm-lock.yaml,pnpm-workspace.yaml,LICENSE,.gitattributes,.gitignore,.gitpod.yml,CNAME,.npmrc,.browserslistrc",
|
"package.json": "pnpm-lock.yaml,pnpm-workspace.yaml,LICENSE,.gitattributes,.gitignore,.gitpod.yml,CNAME,.npmrc,.browserslistrc",
|
||||||
".oxlintrc.json": "tsconfig.json,.commitlintrc.*,.prettier*,.editorconfig,.commitlint.cjs,.eslint*"
|
".oxlintrc.json": "tsconfig.json,.commitlintrc.*,.prettier*,.editorconfig,.commitlint.cjs,.eslint*"
|
||||||
}
|
},
|
||||||
|
// Disable the default formatter, use eslint instead
|
||||||
|
"prettier.enable": false,
|
||||||
|
"editor.formatOnSave": false,
|
||||||
|
|
||||||
|
// Auto fix
|
||||||
|
"editor.codeActionsOnSave": {
|
||||||
|
"source.fixAll.eslint": "explicit",
|
||||||
|
"source.organizeImports": "never"
|
||||||
|
},
|
||||||
|
|
||||||
|
// Silent the stylistic rules in you IDE, but still auto fix them
|
||||||
|
"eslint.rules.customizations": [
|
||||||
|
{ "rule": "style/*", "severity": "off", "fixable": true },
|
||||||
|
{ "rule": "format/*", "severity": "off", "fixable": true },
|
||||||
|
{ "rule": "*-indent", "severity": "off", "fixable": true },
|
||||||
|
{ "rule": "*-spacing", "severity": "off", "fixable": true },
|
||||||
|
{ "rule": "*-spaces", "severity": "off", "fixable": true },
|
||||||
|
{ "rule": "*-order", "severity": "off", "fixable": true },
|
||||||
|
{ "rule": "*-dangle", "severity": "off", "fixable": true },
|
||||||
|
{ "rule": "*-newline", "severity": "off", "fixable": true },
|
||||||
|
{ "rule": "*quotes", "severity": "off", "fixable": true },
|
||||||
|
{ "rule": "*semi", "severity": "off", "fixable": true }
|
||||||
|
],
|
||||||
|
|
||||||
|
// Enable eslint for all supported languages
|
||||||
|
"eslint.validate": [
|
||||||
|
"javascript",
|
||||||
|
"javascriptreact",
|
||||||
|
"typescript",
|
||||||
|
"typescriptreact",
|
||||||
|
"vue",
|
||||||
|
"html",
|
||||||
|
"markdown",
|
||||||
|
"json",
|
||||||
|
"json5",
|
||||||
|
"jsonc",
|
||||||
|
"yaml",
|
||||||
|
"toml",
|
||||||
|
"xml",
|
||||||
|
"gql",
|
||||||
|
"graphql",
|
||||||
|
"astro",
|
||||||
|
"svelte",
|
||||||
|
"css",
|
||||||
|
"less",
|
||||||
|
"scss",
|
||||||
|
"pcss",
|
||||||
|
"postcss"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
6
eslint.config.mjs
Normal file
6
eslint.config.mjs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import antfu from '@antfu/eslint-config'
|
||||||
|
|
||||||
|
export default antfu({
|
||||||
|
unocss: true,
|
||||||
|
vue: true,
|
||||||
|
})
|
@ -158,6 +158,9 @@
|
|||||||
"unplugin-auto-import": "^0.17.8",
|
"unplugin-auto-import": "^0.17.8",
|
||||||
"vite": "5.2.8",
|
"vite": "5.2.8",
|
||||||
"vite-plugin-restart": "^0.4.2",
|
"vite-plugin-restart": "^0.4.2",
|
||||||
"vue-tsc": "^2.2.10"
|
"vue-tsc": "^2.2.10",
|
||||||
|
"@antfu/eslint-config": "^4.15.0",
|
||||||
|
"eslint": "^9.29.0",
|
||||||
|
"@unocss/eslint-plugin": "^66.2.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2123
pnpm-lock.yaml
generated
2123
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user