//详细配置教程请参考:http://eslint.cn/docs/user-guide/configuring
module.exports = {
"plugins": [
"html"
],
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
},
"allowImportExportEverywhere": false
},
"rules":{
// 强制使用单引号
'quotes': ['error', 'single'],
// 禁止连续空格
'no-multi-spaces': 'error',
// 强制函数左括号前加空格
'space-before-function-paren': ['error', 'always'],
// 禁止行尾空格
'no-trailing-spaces': 'error',
// 禁止使用分号代替 ASI
'semi': [
'error',
'never',
{
'beforeStatementContinuationChars': 'never'
}
],
// 强制操作符前后有空格
'space-infix-ops': ['error', {'int32Hint': false}],
// 禁止拖尾逗号
'comma-dangle': ['error', 'never'],
// 强制在对象字面量的键和值之间使用一致的空格
'key-spacing': ['error', { 'afterColon': true }],
// 强制在花括号中使用一致的空格
'object-curly-spacing': ['error', 'always'],
// 强制使用2个空格的缩进
'indent': ['error', 2, { 'SwitchCase': 1 }]
}
};