Updated TypeScript rules

Signed-off-by: Valentin Popov <info@valentineus.link>
This commit is contained in:
Valentin Popov 2020-06-17 21:30:15 +04:00
parent 65cf95c441
commit 802224efd3
5 changed files with 69 additions and 34 deletions

View File

@ -385,29 +385,30 @@
- [ ] "array-type" - [ ] "array-type"
- [X] "await-thenable" - [X] "await-thenable"
- [ ] "ban-ts-comment" - [ ] "ban-ts-comment"
- [ ] "ban-ts-ignore" - [ ] "ban-tslint-comment"
- [ ] "ban-types" - [ ] "ban-types"
- [ ] "brace-style" - [ ] "brace-style"
- [ ] "camelcase"
- [X] "class-literal-property-style" - [X] "class-literal-property-style"
- [ ] "class-name-casing"
- [X] "comma-spacing" - [X] "comma-spacing"
- [ ] "consistent-type-assertions" - [ ] "consistent-type-assertions"
- [ ] "consistent-type-definitions" - [ ] "consistent-type-definitions"
- [ ] "default-param-last" - [ ] "default-param-last"
- [ ] "dot-notation"
- [X] "explicit-function-return-type" - [X] "explicit-function-return-type"
- [X] "explicit-member-accessibility" - [X] "explicit-member-accessibility"
- [ ] "explicit-module-boundary-types" - [ ] "explicit-module-boundary-types"
- [ ] "func-call-spacing" - [ ] "func-call-spacing"
- [ ] "generic-type-naming"
- [X] "indent" - [X] "indent"
- [X] "interface-name-prefix" - [ ] "init-declarations"
- [ ] "keyword-spacing"
- [ ] "lines-between-class-members"
- [ ] "member-delimiter-style" - [ ] "member-delimiter-style"
- [ ] "member-naming"
- [ ] "member-ordering" - [ ] "member-ordering"
- [X] "method-signature-style"
- [ ] "naming-convention" - [ ] "naming-convention"
- [ ] "no-array-constructor" - [ ] "no-array-constructor"
- [X] "no-base-to-string" - [X] "no-base-to-string"
- [ ] "no-confusing-non-null-assertion"
- [ ] "no-dupe-class-members" - [ ] "no-dupe-class-members"
- [ ] "no-dynamic-delete" - [ ] "no-dynamic-delete"
- [ ] "no-empty-function" - [ ] "no-empty-function"
@ -421,6 +422,8 @@
- [ ] "no-for-in-array" - [ ] "no-for-in-array"
- [X] "no-implied-eval" - [X] "no-implied-eval"
- [X] "no-inferrable-types" - [X] "no-inferrable-types"
- [ ] "no-invalid-this"
- [ ] "no-invalid-void-type"
- [X] "no-magic-numbers" - [X] "no-magic-numbers"
- [ ] "no-misused-new" - [ ] "no-misused-new"
- [X] "no-misused-promises" - [X] "no-misused-promises"
@ -437,6 +440,7 @@
- [ ] "no-unnecessary-qualifier" - [ ] "no-unnecessary-qualifier"
- [ ] "no-unnecessary-type-arguments" - [ ] "no-unnecessary-type-arguments"
- [X] "no-unnecessary-type-assertion" - [X] "no-unnecessary-type-assertion"
- [ ] "no-unsafe-assignment"
- [X] "no-unsafe-call" - [X] "no-unsafe-call"
- [X] "no-unsafe-member-access" - [X] "no-unsafe-member-access"
- [X] "no-unsafe-return" - [X] "no-unsafe-return"
@ -456,8 +460,10 @@
- [ ] "prefer-optional-chain" - [ ] "prefer-optional-chain"
- [ ] "prefer-readonly" - [ ] "prefer-readonly"
- [X] "prefer-readonly-parameter-types" - [X] "prefer-readonly-parameter-types"
- [ ] "prefer-reduce-type-parameter"
- [ ] "prefer-regexp-exec" - [ ] "prefer-regexp-exec"
- [ ] "prefer-string-starts-ends-with" - [ ] "prefer-string-starts-ends-with"
- [ ] "prefer-ts-expect-error"
- [ ] "promise-function-async" - [ ] "promise-function-async"
- [X] "quotes" - [X] "quotes"
- [ ] "require-array-sort-compare" - [ ] "require-array-sort-compare"

46
package-lock.json generated
View File

@ -103,25 +103,26 @@
"dev": true "dev": true
}, },
"@typescript-eslint/eslint-plugin": { "@typescript-eslint/eslint-plugin": {
"version": "2.34.0", "version": "3.3.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.34.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.3.0.tgz",
"integrity": "sha512-4zY3Z88rEE99+CNvTbXSyovv2z9PNOVffTWD2W8QF5s2prBQtwN2zadqERcrHpcR7O/+KMI3fcTAmUUhK/iQcQ==", "integrity": "sha512-Ybx/wU75Tazz6nU2d7nN6ll0B98odoiYLXwcuwS5WSttGzK46t0n7TPRQ4ozwcTv82UY6TQoIvI+sJfTzqK9dQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@typescript-eslint/experimental-utils": "2.34.0", "@typescript-eslint/experimental-utils": "3.3.0",
"functional-red-black-tree": "^1.0.1", "functional-red-black-tree": "^1.0.1",
"regexpp": "^3.0.0", "regexpp": "^3.0.0",
"semver": "^7.3.2",
"tsutils": "^3.17.1" "tsutils": "^3.17.1"
} }
}, },
"@typescript-eslint/experimental-utils": { "@typescript-eslint/experimental-utils": {
"version": "2.34.0", "version": "3.3.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.34.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.3.0.tgz",
"integrity": "sha512-eS6FTkq+wuMJ+sgtuNTtcqavWXqsflWcfBnlYhg/nS4aZ1leewkXGbvBhaapn1q6qf4M71bsR1tez5JTRMuqwA==", "integrity": "sha512-d4pGIAbu/tYsrPrdHCQ5xfadJGvlkUxbeBB56nO/VGmEDi/sKmfa5fGty5t5veL1OyJBrUmSiRn1R1qfVDydrg==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/json-schema": "^7.0.3", "@types/json-schema": "^7.0.3",
"@typescript-eslint/typescript-estree": "2.34.0", "@typescript-eslint/typescript-estree": "3.3.0",
"eslint-scope": "^5.0.0", "eslint-scope": "^5.0.0",
"eslint-utils": "^2.0.0" "eslint-utils": "^2.0.0"
} }
@ -136,6 +137,18 @@
"@typescript-eslint/experimental-utils": "2.34.0", "@typescript-eslint/experimental-utils": "2.34.0",
"@typescript-eslint/typescript-estree": "2.34.0", "@typescript-eslint/typescript-estree": "2.34.0",
"eslint-visitor-keys": "^1.1.0" "eslint-visitor-keys": "^1.1.0"
},
"dependencies": {
"@typescript-eslint/experimental-utils": {
"version": "2.34.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.34.0.tgz",
"integrity": "sha512-eS6FTkq+wuMJ+sgtuNTtcqavWXqsflWcfBnlYhg/nS4aZ1leewkXGbvBhaapn1q6qf4M71bsR1tez5JTRMuqwA==",
"dev": true,
"requires": {
"@types/json-schema": "^7.0.3",
"@typescript-eslint/typescript-estree": "2.34.0",
"eslint-scope": "^5.0.0",
"eslint-utils": "^2.0.0"
} }
}, },
"@typescript-eslint/typescript-estree": { "@typescript-eslint/typescript-estree": {
@ -152,6 +165,23 @@
"semver": "^7.3.2", "semver": "^7.3.2",
"tsutils": "^3.17.1" "tsutils": "^3.17.1"
} }
}
}
},
"@typescript-eslint/typescript-estree": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.3.0.tgz",
"integrity": "sha512-3SqxylENltEvJsjjMSDCUx/edZNSC7wAqifUU1Ywp//0OWEZwMZJfecJud9XxJ/40rAKEbJMKBOQzeOjrLJFzQ==",
"dev": true,
"requires": {
"debug": "^4.1.1",
"eslint-visitor-keys": "^1.1.0",
"glob": "^7.1.6",
"is-glob": "^4.0.1",
"lodash": "^4.17.15",
"semver": "^7.3.2",
"tsutils": "^3.17.1"
}
}, },
"acorn": { "acorn": {
"version": "7.3.1", "version": "7.3.1",

View File

@ -14,8 +14,8 @@
"@rollup/plugin-json": "^4.1.0", "@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-typescript": "^4.1.2", "@rollup/plugin-typescript": "^4.1.2",
"@types/node": "^14.0.13", "@types/node": "^14.0.13",
"@typescript-eslint/eslint-plugin": "^2.26.0", "@typescript-eslint/eslint-plugin": "^3.3.0",
"@typescript-eslint/parser": "^2.26.0", "@typescript-eslint/parser": "^2.34.0",
"eslint": "^6.8.0", "eslint": "^6.8.0",
"eslint-plugin-eslint-comments": "^3.1.2", "eslint-plugin-eslint-comments": "^3.1.2",
"eslint-plugin-import": "^2.20.2", "eslint-plugin-import": "^2.20.2",
@ -29,8 +29,8 @@
"typescript": "^3.9.5" "typescript": "^3.9.5"
}, },
"peerDependencies": { "peerDependencies": {
"@typescript-eslint/eslint-plugin": "^2.26.0", "@typescript-eslint/eslint-plugin": "^3.3.0",
"@typescript-eslint/parser": "^2.26.0", "@typescript-eslint/parser": "^2.34.0",
"eslint": "^6.8.0", "eslint": "^6.8.0",
"eslint-plugin-eslint-comments": "^3.1.2", "eslint-plugin-eslint-comments": "^3.1.2",
"eslint-plugin-import": "^2.20.2", "eslint-plugin-import": "^2.20.2",

View File

@ -16,6 +16,7 @@
"@typescript-eslint/explicit-function-return-type": [ "@typescript-eslint/explicit-function-return-type": [
"error", "error",
{ {
"allowConciseArrowFunctionExpressionsStartingWithVoid": false,
"allowExpressions": false, "allowExpressions": false,
"allowHigherOrderFunctions": false, "allowHigherOrderFunctions": false,
"allowTypedFunctionExpressions": false "allowTypedFunctionExpressions": false
@ -61,12 +62,9 @@
"outerIIFEBody": 1 "outerIIFEBody": 1
} }
], ],
"@typescript-eslint/interface-name-prefix": [ "@typescript-eslint/method-signature-style": [
"error", "error",
{ "property"
"allowUnderscorePrefix": false,
"prefixWithI": "always"
}
], ],
"@typescript-eslint/no-base-to-string": [ "@typescript-eslint/no-base-to-string": [
"error" "error"
@ -125,9 +123,7 @@
"@typescript-eslint/no-unnecessary-condition": [ "@typescript-eslint/no-unnecessary-condition": [
"error", "error",
{ {
"allowConstantLoopConditions": false, "allowConstantLoopConditions": false
"checkArrayPredicates": true,
"ignoreRhs": true
} }
], ],
"@typescript-eslint/no-unnecessary-type-assertion": [ "@typescript-eslint/no-unnecessary-type-assertion": [
@ -213,9 +209,13 @@
"@typescript-eslint/strict-boolean-expressions": [ "@typescript-eslint/strict-boolean-expressions": [
"error", "error",
{ {
"allowNullable": false, "allowAny": false,
"allowSafe": false, "allowNullableBoolean": false,
"ignoreRhs": false "allowNullableNumber": false,
"allowNullableObject": false,
"allowNullableString": false,
"allowNumber": false,
"allowString": false
} }
], ],
"@typescript-eslint/type-annotation-spacing": [ "@typescript-eslint/type-annotation-spacing": [

View File

@ -3,7 +3,6 @@ import rDefault from "./rules/typescript/default.json";
module.exports = { module.exports = {
"extends": [ "extends": [
"./javascript", "./javascript",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended", "plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking", "plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:import/typescript", "plugin:import/typescript",