ESLint/规则:修订间差异
来自康健生活
| 第131行: | 第131行: | ||
| no-multi-str || 2 || 字符串不能用\换行 | | no-multi-str || 2 || 字符串不能用\换行 | ||
|- | |- | ||
| no-multiple-empty-lines || [1, { | | no-multiple-empty-lines || <pre>[1, { | ||
"max": 2 | "max": 2 | ||
}] || 空行最多不能超过2行 | }]</pre> || 空行最多不能超过2行 | ||
|- | |- | ||
| no-native-reassign || 2 || 不能重写native对象 | | no-native-reassign || 2 || 不能重写native对象 | ||
| 第217行: | 第217行: | ||
| no-unused-expressions || 2 || 禁止无用的表达式 | | no-unused-expressions || 2 || 禁止无用的表达式 | ||
|- | |- | ||
| no-unused-vars || [2, { | | no-unused-vars || <pre>[2, { | ||
"vars": "all", | "vars": "all", | ||
"args": "after-used" | "args": "after-used" | ||
}] || 不能有声明后未被使用的变量或参数 | }]</pre> || 不能有声明后未被使用的变量或参数 | ||
|- | |- | ||
| no-use-before-define || 2 || 未定义前不能使用 | | no-use-before-define || 2 || 未定义前不能使用 | ||
| 第230行: | 第230行: | ||
| no-var || 0 || 禁用var,用let和const代替 | | no-var || 0 || 禁用var,用let和const代替 | ||
|- | |- | ||
| no-warning-comments || [1, { | | no-warning-comments || <pre>[1, { | ||
"terms": ["todo", "fixme", "xxx"], | "terms": ["todo", "fixme", "xxx"], | ||
"location": "start" | "location": "start" | ||
}] || 不能有警告备注 | }]</pre> || 不能有警告备注 | ||
|- | |- | ||
| no-with || 2 || 禁用with | | no-with || 2 || 禁用with | ||
| 第275行: | 第275行: | ||
| dot-location || 0 || 对象访问符的位置,换行的时候在行首还是行尾 | | dot-location || 0 || 对象访问符的位置,换行的时候在行首还是行尾 | ||
|- | |- | ||
| dot-notation || [0, { | | dot-notation || <pre>[0, { | ||
"allowKeywords": true | "allowKeywords": true | ||
}] || 避免不必要的方括号 | }]</pre> || 避免不必要的方括号 | ||
|- | |- | ||
| eol-last || 0 || 文件以单一的换行符结束 | | eol-last || 0 || 文件以单一的换行符结束 | ||
| 第299行: | 第299行: | ||
| init-declarations || 0 || 声明时必须赋初值 | | init-declarations || 0 || 声明时必须赋初值 | ||
|- | |- | ||
| key-spacing || [0, { | | key-spacing || <pre>[0, { | ||
"beforeColon": false, | "beforeColon": false, | ||
"afterColon": true | "afterColon": true | ||
}] || 对象字面量中冒号的前后空格 | }]</pre> || 对象字面量中冒号的前后空格 | ||
|- | |- | ||
| lines-around-comment || 0 || 行前/行后备注 | | lines-around-comment || 0 || 行前/行后备注 | ||
| 第352行: | 第352行: | ||
| semi || [0, "always"] || 语句强制分号结尾 | | semi || [0, "always"] || 语句强制分号结尾 | ||
|- | |- | ||
| semi-spacing || [0, { | | semi-spacing || <pre>[0, { | ||
"before": false, | "before": false, | ||
"after": true | "after": true | ||
}] || 分号前后空格 | }]</pre> || 分号前后空格 | ||
|- | |- | ||
| sort-vars || 0 || 变量声明时排序 | | sort-vars || 0 || 变量声明时排序 | ||
| 第371行: | 第371行: | ||
| space-return-throw-case || 0 || return throw case后面要不要加空格 | | space-return-throw-case || 0 || return throw case后面要不要加空格 | ||
|- | |- | ||
| space-unary-ops || [0, { | | space-unary-ops || <pre>[0, { | ||
"words": true, | "words": true, | ||
"nonwords": false | "nonwords": false | ||
} || 一元运算符的前/后要不要加空格 | }</pre> || 一元运算符的前/后要不要加空格 | ||
|- | |- | ||
| spaced-comment || 0 || 注释风格要不要有空格什么的 | | spaced-comment || 0 || 注释风格要不要有空格什么的 | ||