//.eslintrc.js
module.exports = {
root: true,
env: {
node: true
},
extends: ["plugin:vue/essential"],
parserOptions: {
parser: "babel-eslint"
},
rules: {
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
quotes: [1, "double"], // 引号类型 `` "" ''
semi: 0,
"space-before-function-paren": 0,
eqeqeq: ["off"]
},
overrides: [
{
files: [
"**/__tests__/*.{j,t}s?(x)",
"**/tests/unit/**/*.spec.{j,t}s?(x)"
],
env: {
jest: true
}
}
]
};
//vscode配置eslint
{
"editor.renderIndentGuides": false,
"[vue]": {
"editor.defaultFormatter": "octref.vetur"
},
"explorer.confirmDelete": false,
"editor.formatOnType": true,
"editor.formatOnSave": true,
"eslint.autoFixOnSave": true, //保存自动修复eslint错误
"eslint.validate": [
"javascript",
"javascriptreact",
"html",
"vue",
{
"language": "vue",
"autoFix": true
}
],
"eslint.options": { //指定eslint配置文件位置
"configFile": ".eslintrc.js" //指定项目根目录中的eslint配置文件
},
"files.autoSave": "off",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
}