vscode 编辑设置
- 在 settings 文件中将以下代码替换
-
文件 –> 首选项 –> 设置
{ "workbench.colorTheme": "Dracula Soft", "security.workspace.trust.untrustedFiles": "open", "bracketPairColorizer.depreciation-notice": false, "[vue]": {"editor.defaultFormatter": "octref.vetur"}, "": {"editor.defaultFormatter":"vscode.html-language-features"},"diffEditor.ignoreTrimWhitespace": false,"editor.codeActionsOnSave": {"source.fixAll.eslint": true}, "eslint.format.enable": true, //autoFix 默认开启,只需输出字符串数组即可 "eslint.validate": ["javascript", "vue", "html"] }
.eslintrc.js
文件配置
module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint',
sourceType: 'module',
},
env: {
browser: true,
node: true,
es6: true,
},
extends: ['plugin:vue/recommended', 'eslint:recommended'],
rules: {
'vue/max-attributes-per-line': [
2,
{
singleline: 10,
multiline: {
max: 1,
allowFirstLine: false,
},
},
],
'vue/singleline-html-element-content-newline': 'off',
'vue/multiline-html-element-content-newline': 'off',
'vue/name-property-casing': ['error', 'PascalCase'],
'vue/no-v-html': 'off',
'vue/html-self-closing': 'off'
},
// add your custom rules here
//it is base on https://github.com/vuejs/eslint-config-vue
};