eslint-config-futu
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "eslint-config-futu", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -10,4 +10,3 @@ # 富途ESLint规则 | ||
```sh | ||
npm install eslint --save-dev | ||
npm install git+http://gitlab.futunn.com/webpackage/eslint-config-futu.git#1.0.0 --save-dev | ||
npm install eslint eslint-config-futu --save-dev | ||
``` | ||
@@ -20,4 +19,13 @@ | ||
root: true, | ||
extends: 'eslint-config-futu' | ||
rules:{ | ||
extends: 'eslint-config-futu', | ||
env: { | ||
browser: true, | ||
node: true, | ||
amd: true | ||
}, | ||
parserOptions: { | ||
ecmaVersion: 7, | ||
sourceType: 'module' | ||
}, | ||
rules:{ | ||
// 如果项目有特殊需求,可在此覆盖 | ||
@@ -63,2 +71,25 @@ } | ||
1. 使用`./node_modules/.bin/eslint`,或者将这个命令写入`npm scripts`。在`npm scripts`中可以直接写`eslint`,会默认从`./node_modules/.bin`下查找`eslint`命令。 | ||
2. 全局安装`eslint-cli`这个第三方库,然后使用`eslint`命令。 | ||
2. 全局安装`eslint-cli`这个第三方库,然后使用`eslint`命令。 | ||
## 历史记录 | ||
### 1.0.1 2017-04-14 | ||
- 允许 console [no-console](http://eslint.org/docs/rules/no-console) | ||
- 增加[no-self-assign](http://eslint.org/docs/rules/no-self-assign)检查 | ||
- 增加[no-tabs](http://eslint.org/docs/rules/no-tabs)检查 | ||
- 增加[valid-jsdoc](http://eslint.org/docs/rules/valid-jsdoc)检查 | ||
- 增加[no-unused-vars](http://eslint.org/docs/rules/no-unused-vars)检查 | ||
- 增加[no-use-before-define](http://eslint.org/docs/rules/no-use-before-define)检查 | ||
- 增加[no-multi-assign](http://eslint.org/docs/rules/no-multi-assign)检查 | ||
- 增加[no-invalid-this](http://eslint.org/docs/rules/no-invalid-this)检查 | ||
- 增加[new-cap](http://eslint.org/docs/rules/new-cap)检查 | ||
- 增加[max-params](http://eslint.org/docs/rules/max-params)检查 | ||
- 增加[no-useless-return](http://eslint.org/docs/rules/no-useless-return)检查 | ||
- 增加[no-nested-ternary](http://eslint.org/docs/rules/no-nested-ternary)检查 | ||
- 增加[no-multi-spaces](http://eslint.org/docs/rules/no-multi-spaces)检查 | ||
- 增加[guard-for-in](http://eslint.org/docs/rules/guard-for-in)检查 | ||
### 1.0.0 2017-03-30 | ||
- 初始化规则 |
@@ -19,2 +19,4 @@ // eslint配置文件 - 基础配置 | ||
"indent": ["error", 4], | ||
// 拒绝 tab | ||
"no-tabs": ["error"], | ||
// 字符串单引号 | ||
@@ -36,2 +38,4 @@ "quotes": ["error", "single"], | ||
"space-infix-ops": ["error"], | ||
// 不允许给自己赋值 | ||
"no-self-assign": ["error"], | ||
// 不允许抛非Error实例 | ||
@@ -66,2 +70,7 @@ "no-throw-literal": ["warn"], | ||
}], | ||
"valid-jsdoc": ["warn", { | ||
"matchDescription": ".+", | ||
"requireParamDescription": true, | ||
"requireReturnDescription": true | ||
}], | ||
// 定义未使用的变量 | ||
@@ -71,4 +80,32 @@ "no-unused-vars": ["warn", { | ||
"args": "none" | ||
}] | ||
}], | ||
// 变量先声明再使用 | ||
"no-use-before-define": ["error", { | ||
"variables": true | ||
}], | ||
// 不允许链式赋值, 每个变量声明单独成行 | ||
"no-multi-assign": ["warn"], | ||
// this | ||
"no-invalid-this": ["warn"], | ||
// 构造函数名首字母大写 | ||
"new-cap": ["error"], | ||
// 函数最多接受5个参数 | ||
"max-params": ["warn", { | ||
"max": 5 | ||
}], | ||
// 无用的 return | ||
"no-useless-return": ["warn"], | ||
// 不允许多层3元运算,可读性差 | ||
"no-nested-ternary": ["warn"], | ||
// 不允许多空格(为了好看) | ||
"no-multi-spaces": ["warn", { | ||
"exceptions": { | ||
"VariableDeclarator": true | ||
} | ||
}], | ||
// console | ||
"no-console": 0, | ||
// for in 遍历需过滤掉原型上的属性 | ||
"guard-for-in": ['warn'] | ||
} | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7315
108
93