1.0.1 • Published 11 months ago

eslint-config-sz v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
11 months ago

eslint统一配置

1.JS 规范,继承 eslint-config-airbnb-base,并进行调整, https://github.com/airbnb/javascript

'comma-dangle': 'off', // 结尾使用额外的逗号
'quote-props': 'off', // 只对非法标识符的属性使用引号
'max-len': 'off', // 最大长度限制
'linebreak-style': 'off', // 强制统一的换行符
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-alert': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-console': 'off', // 可打印消息
'no-param-reassign': 'off', // 关闭禁止参数不可修改
'func-names': 'off', // 匿名方法
'camelcase': 'off', // 可用使用下划线标识私有变量
'prefer-object-spread': 'off', // 对象解构赋值
'no-underscore-dangle': 'off', // 使用下划线
'prefer-destructuring': 'off', // 使用解构
'no-mixed-operators': 'off', // 混合使用运算符

'import/extensions': 'off', // import文件扩展名
'import/no-dynamic-require': 'off', // 动态require,node中可用
'import/no-extraneous-dependencies': 'off',
'indent': ['error', 4], // 缩进4

2.vue 风格规范,继承 eslint-plugin-vue, 并进行调整,https://eslint.vuejs.org/rules/

// 每一行attributes的个数限制
'vue/max-attributes-per-line': 'off',
// vue组件template属性的顺序
'vue/attributes-order': 'off',
'vue/component-name-in-template-casing': ['error', 'kebab-case', {
    'ignores': []
}],
// 闭合标签不单独一行
'vue/html-closing-bracket-newline': ['error', {
    'singleline': 'never',
    'multiline': 'never'
}],
// 组件名称驼峰命名规则
'vue/multi-word-component-names': 'off',
// 缩进4
'vue/html-indent': ['error', 4],
'vue/singleline-html-element-content-newline': 'off'