"quotes":[1,"single"],//引号类型 `` "" '' Use /* eslint-disable */ to ignore all warnings in a file. 还有一种万能方法,就是在报错的JS文件中第一行写上 代码语言:javascript 代码运行次数:0 运行 AI代码解释 /* eslint-disable */ 如下图 这样就可以和Eslint携手并进了 配置(我主要用第...
/* eslint-disable */ alert('foo'); /* eslint-enable */ 下面的代码会关闭某一行的所有规则 alert('foo'); // eslint-disable-line // eslint-disable-next-line alert('foo'); 下面的代码在某一行关闭指定的规则 alert('foo'); // eslint-disable-line no-alert // eslint-disable-next-li...
complexity 指定程序中允许的最大环路复杂度 consistent-return 要求 return 语句要么总是指定返回的值,要么不指定 curly 强制所有控制语句使用一致的括号风格 default-case 要求 switch 语句中有 default 分支 dot-location 强制在点号之前和之后一致的换行 dot-notation 强制在任何允许的时候使用点号 eqeqeq 要求使用 ...
complexity 指定程序中允许的最大环路复杂度 consistent-return 要求 return 语句要么总是指定返回的值,要么不指定 curly 强制所有控制语句使用一致的括号风格 default-case 要求 switch 语句中有 default 分支 dot-location 强制在点号之前和之后一致的换行
// eslint-disable-next-line no-alert alert('foo'); 1. 2. 3. 4. 给项目配置eslintrc.js // https://eslint.org/docs/user-guide/configuring module.exports = { //此项是用来告诉eslint找当前配置文件不能往父级查找 root: true,
[2, "last"],//逗号风格,换行时在行首还是行尾 "complexity": [0, 11],//循环复杂度 "computed-property-spacing": [0, "never"],//是否允许计算后的键名什么的 "consistent-return": 0,//return 后面是否允许省略 "consistent-this": [2, "that"],//this别名 "constructor-super": 0,//非派生...
"complexity": 0, // 限制条件语句的复杂度 "consistent-return": 2, // 无论有没有返回值都强制要求return语句返回一个值 "curly": ["error", "all"], // 强制使用花括号的风格 "default-case": 0, // 在switch语句中需要有default语句
complexity嵌套复杂度 🟢 使用该规则:["error", 10] 尽量将每个函数写小一点, 增加代码可读性. 但考虑到整体团队和项目具体的情况, 需要选择一个合适的值. consistent-return一致性的返回 🟢 使用该规则:error. 帮助我们思考, 这个函数为什么要这样用, 该不该这样用, 同时避免一些低级错误如 map 的特殊情况...
"complexity": 0, //限制条件语句的复杂度 "consistent-return": 2, //无论有没有返回值都强制要求return语句返回一个值 "curly": ["error", "all"], //强制使用花括号的风格 "default-case": 0, //在switch语句中需要有default语句 "dot-notation": ["error", {"allowKeywords": false, "allowPatt...
[2, "last"],//逗号风格,换行时在行首还是行尾 "complexity": [0, 11],//循环复杂度 "computed-property-spacing": [0, "never"],//是否允许计算后的键名什么的 "consistent-return": 0,//return 后面是否允许省略 "consistent-this": [2, "that"],//this别名 "constructor-super": 0,//非派生...