eslint-config-futu
Advanced tools
Comparing version 2.0.0 to 2.1.0-alpha.0
{ | ||
"name": "eslint-config-futu", | ||
"version": "2.0.0", | ||
"version": "2.1.0-alpha.0", | ||
"description": "", | ||
@@ -21,8 +21,7 @@ "main": "index.js", | ||
"@types/node": "^14.14.14", | ||
"@typescript-eslint/eslint-plugin": "^4.11.0", | ||
"@typescript-eslint/parser": "^4.11.0", | ||
"eslint": "^8.4.1", | ||
"@typescript-eslint/eslint-plugin": "^5.16.0", | ||
"@typescript-eslint/parser": "^5.16.0", | ||
"jest": "^27.4.5", | ||
"typescript": "^4.1.3" | ||
"typescript": "^4.6.3" | ||
} | ||
} |
@@ -74,4 +74,7 @@ # 富途ESLint规则 | ||
## 注意事项 | ||
- `arrow-parens`规则为`always`,如果项目有使用prettier,需要同样设置该选项为`always`(prettier 2.0默认为`always`)。 | ||
## 附:编辑器使用方式 | ||
@@ -116,2 +119,6 @@ | ||
### 2.1.0-alpha.0 2022-03-25 | ||
- 添加ts规则 | ||
### 2.0.0 2022-01-14 | ||
@@ -118,0 +125,0 @@ |
/** | ||
* Created by JackieYao on 2020/12/23. | ||
*/ | ||
const base = require('./base'); | ||
module.exports = { | ||
extends: [ 'plugin:@typescript-eslint/recommended' ], | ||
rules: { | ||
...base.rules, | ||
// 是否可使用require导入 | ||
@@ -13,3 +16,56 @@ '@typescript-eslint/no-var-requires': 'off', | ||
'@typescript-eslint/ban-ts-comment': ['warn'], | ||
// 数组声明 | ||
'@typescript-eslint/array-type': ['error', {'default': 'array'}], | ||
// 对象类型声明使用interface | ||
'@typescript-eslint/consistent-type-definitions': ['error', 'interface'], | ||
// 命名约定 | ||
'@typescript-eslint/naming-convention': [ | ||
'error', | ||
{ | ||
'selector': 'interface', | ||
'format': ['PascalCase'], | ||
'custom': { | ||
'regex': '^[A-Z]', | ||
'match': true | ||
} | ||
} | ||
], | ||
// 函数与类方法的返回值需要被显式的指定 | ||
'@typescript-eslint/explicit-module-boundary-types': ['error'], | ||
// 方法签名的声明方式使用property格式 | ||
'@typescript-eslint/method-signature-style': ['error', 'property'], | ||
// for循环 | ||
'@typescript-eslint/prefer-for-of': ['warn'], | ||
// 使用 import type {} 进行类型的导入 | ||
'@typescript-eslint/consistent-type-imports': ['error', {'prefer': 'type-imports'}], | ||
// 使用可选链 | ||
'@typescript-eslint/prefer-optional-chain': ['warn'], | ||
// 不允许空的interface,使用了extends除外 | ||
'@typescript-eslint/no-empty-interface': ['error', {'allowSingleExtends': true}], | ||
// 枚举成员必须初始化 | ||
'@typescript-eslint/prefer-enum-initializers': ['error'], | ||
// 枚举成员值只能是string number boolean等,不允许需要计算的方式 | ||
'@typescript-eslint/prefer-literal-enum-member': ['error', { 'allowBitwiseExpressions': true }], | ||
// 使用@ts-expect-error而不是@ts-ignore | ||
'@typescript-eslint/prefer-ts-expect-error': ['warn'], | ||
// 返回值是promise的函数必须声明async | ||
'@typescript-eslint/promise-function-async': ['warn'], | ||
// switch判断条是联合类型时,其每一个类型分支都需要被处理 | ||
'@typescript-eslint/switch-exhaustiveness-check': ['warn'], | ||
// 类型定义 函数参数、对象属性、类成员 必须声明类型 | ||
'@typescript-eslint/typedef': [ | ||
'error', | ||
{ | ||
'arrowParameter': true, | ||
'parameter': true, | ||
'propertyDeclaration': true, | ||
'memberVariableDeclaration': true | ||
} | ||
], | ||
'@typescript-eslint/no-inferrable-types': ['error', {'ignoreParameters': true}], | ||
// 关闭此规则,因为eslint8之前的版本对导入的类型定义会报错 xxx is defined but never used, | ||
// ts自己有类似的提醒,所以关闭eslint中的这个规则 | ||
'no-unused-vars': 'off', | ||
'@typescript-eslint/no-unused-vars': ['off'] | ||
} | ||
} |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
15266
5
227
175
1