0.0.4 • Published 9 years ago
eslint-plugin-hfe v0.0.4
eslint-plugin-hfe
安装
1.安装eslint ESLint:
$ npm install eslint --save-dev
2.安装eslint-plugin-hfe eslint-plugin-hfe
:
$ npm install eslint-plugin-hfe --save-dev
Note: 如果eslint是全局安装(-g),eslint-plugin-hfe也应该全局安装(-g)
使用
将以下代码加入到.eslintrc
配置文件中:
{
"plugins": [
"hfe"
],
"rules": {
"hfe/default-para-last": 2,
"hfe/for-condition": 2,
"hfe/for-direction": 2,
"hfe/no-label-in-switch": 2,
"hfe/short-circuit-prevent-null-pointer": 2,
"hfe/new-function": 2
}
}
Supported Rules
- 0."for" loop incrementers should modify the variable being tested in the loop's stop condition
- 1."new" operators should be used with functions
- 2."switch" statements should not contain non-case labels
- 3.A "for" loop update clause should move the counter in the right direction
- 4.Function parameters with default values should be last,
- 5.Short-circuit logic should be used to prevent null pointer dereferences in conditionals
参考文档
- http://eslint.org/docs/developer-guide/working-with-rules
- http://sonar.ep.sankuai.com/coding_rules#languages=js
License
Distributed under the MIT license. See LICENSE for details.