eslint自定義
module.exports = {
root: true,
env: {
node: true
},
extends: [
'plugin:vue/essential',
'@vue/standard'
],
parserOptions: {
parser: 'babel-eslint'
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'semi': ["error", "always"],
"prefer-const": "off",
"no-multiple-empty-lines": "off",
"no-unused-vars": "off",
"prefer-promise-reject-errors": "off",
"dot-notation": "off",
"space-before-function-paren": "off",
"space-infix-ops": "off",
"quotes": "off",
"no-useless-escap": "off",
"no-useless-escape": "off",
"import/first": "off",
"no-prototype-builtins": "off",
"vue/no-unused-components": "off",
"eqeqeq": "off"
}
}
Vetur插件設(shè)置
{
// tab 大小為2個空格
"editor.tabSize": 2,
//禁止保存的時候格式化
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
//函數(shù)名稱前 加一個空格
"javascript.format.insertSpaceBeforeFunctionParenthesis": false,
//格式化插件配置,設(shè)置為vetur
"[vue]": {
"editor.defaultFormatter": "octref.vetur"
},
"vetur.format.defaultFormatterOptions": {
"js-beautify-html": {
// #vue組件中html代碼格式化樣式
"wrap_attributes": "force-aligned", //也可以設(shè)置為“auto”,效果會不一樣
"wrap_line_length": 200,
"end_with_newline": false,
"semi": true,
"singleQuote": true
},
"prettier": {
//設(shè)置分號
"semi": true,
//雙引號變成單引號
"singleQuote": true,
//禁止隨時添加逗號,這個很重要田弥。找了好久
"trailingComma": "none"
}
},
"[javascript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
}
}