Vue 和 Typescript 项目的 ESLint 配置。
pnpm add eslint @trscd/eslint-config -D # JavaScript, TypeScript, Vue 3
pnpm add eslint @trscd/eslint-config-basic -D # JavaScript only
pnpm add eslint @trscd/eslint-config-ts -D # JavaScript and TypeScript
// .eslintrc.js
module.exports = {
extends: [
'@trscd' // JavaScript, TypeScript, Vue 3
'@trscd/basic' // JavaScript only
'@trscd/ts' // JavaScript and TypeScript
],
};
public
dist
添加需要检测的语言类型:
{
"eslint.validate": [
"vue",
"html",
"javascript",
"typescript",
],
"eslint.probe": [
"vue",
"html",
"javascript",
"typescript",
]
}
保存时自动修复:
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}