90 lines
2.6 KiB
JavaScript
90 lines
2.6 KiB
JavaScript
/* eslint-disable */
|
|
module.exports = {
|
|
root: true,
|
|
env: {
|
|
node: true
|
|
},
|
|
'extends': [
|
|
'plugin:vue/essential',
|
|
// '@vue/standard'
|
|
],
|
|
rules: {
|
|
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
|
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
|
|
// =========我自己的配置==============
|
|
/**
|
|
* 禁止 for 循环出现方向错误的循环,比如 for (i = 0; i < 10; i--)
|
|
* @category Possible Errors
|
|
*/
|
|
'for-direction': 'error',
|
|
/**
|
|
* 禁止将 await 写在循环里,因为这样就无法同时发送多个异步请求了
|
|
* @category Possible Errors
|
|
* @reason 要求太严格了,有时需要在循环中写 await
|
|
*/
|
|
'no-await-in-loop': 'off',
|
|
/**
|
|
* 禁止与负零进行比较
|
|
* @category Possible Errors
|
|
*/
|
|
'no-compare-neg-zero': 'error',
|
|
/**
|
|
* 禁止在判断表达式中使用赋值语句,除非这个赋值语句被括号包起来了
|
|
* @category Possible Errors
|
|
*/
|
|
'no-cond-assign': ['error', 'except-parens'],
|
|
/**
|
|
* 禁止在函数参数中出现重复名称的参数
|
|
* @category Possible Errors
|
|
*/
|
|
'no-dupe-args': 'error',
|
|
|
|
/**
|
|
* 禁止在对象字面量中出现重复名称的键名
|
|
* @category Possible Errors
|
|
*/
|
|
'no-dupe-keys': 'error',
|
|
/**
|
|
* 变量必须先定义后使用
|
|
* @category Variables
|
|
*/
|
|
'no-use-before-define': [
|
|
'error',
|
|
{
|
|
functions: false,
|
|
classes: false,
|
|
variables: false
|
|
}
|
|
],
|
|
//强制驼峰法命名
|
|
"camelcase": 2,
|
|
//禁止省略浮点数中的0 .5 3.
|
|
"no-floating-decimal": 2,
|
|
//禁止使用eval
|
|
"no-eval": 1,
|
|
//函数参数不能重复
|
|
"no-dupe-args": 2,
|
|
//禁止使用alert confirm prompt
|
|
"no-alert": 0,
|
|
// 不检查结尾分号
|
|
'semi': 0,
|
|
// 函数名和括号之间空格不检查
|
|
'space-before-function-paren': 0,
|
|
// 不检查单双引号
|
|
'quotes': 0
|
|
// ================================
|
|
},
|
|
parserOptions: {
|
|
parser: 'babel-eslint'
|
|
},
|
|
overrides: [
|
|
{
|
|
files: [
|
|
'**/__tests__/*.{j,t}s?(x)'
|
|
],
|
|
env: {
|
|
jest: true
|
|
}
|
|
}
|
|
]
|
|
} |