Finger内部使用的,用于检测JavaScript代码
English Doc. : en
# npm
npm install eslint-config-finger --save-dev
## OR
#yarn
yarn add eslint-config-finger --dev
如果你使用了es6(es2015),es7的语法,没有使用任何框架(react, vue或angular2)
你只需要在你的eslint
配置文件中:
// .eslintrc
{
"extends": "finger"
}
如果你使用了react
框架。
你只需要在你的eslint
配置文件中:
// .eslintrc
{
"extends": "finger/react"
}
如果你使用了vue
框架。
你只需要在你的eslint
配置文件中:
// .eslintrc
{
"extends": "finger/vue"
}
如果你就是一般的代码。
你只需要在你的eslint
配置文件中:
// .eslintrc
{
"extends": "finger/common"
}
如果你对项目中的一些配置不满意,可以任意修改:
// .eslintrc
{
"extends": "finger",
"rules": {
// your own rules configuration
}
}
例如,你在项目中使用了mocha,当你写如下代码的时候:
describe("OwnClass", () => {
describe("#ownFunc", () => {
it('should return a boolean value', () => {
// some code
})
})
})
// error : You can not use `describe` before undefined.
// error : You can not use `it` before undefined.
这时候,你需要对eslint
配置文件进行修改:
{
"extends": "finger",
"env": ["mocha"]
}
这只是一个很常见的例子。
eslint
还有许多的环境参数,比如:jasmine
, jest
, commonjs
, prototypejs
等等。
在整个配置的设置上,我们并没有对代码的缩进大小
,缩进样式
和文件末尾是否加一空行
进行设置。
这些,我觉得并不属于eslint
的范畴,请使用EditorConfig进行配置。
预待发现...