xo 0.50.0 → 0.52.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +1 -1
- package/index.js +7 -2
- package/lib/options-manager.js +89 -6
- package/lib/report.js +3 -1
- package/node_modules/@typescript-eslint/eslint-plugin/README.md +2 -146
- package/node_modules/@typescript-eslint/eslint-plugin/dist/configs/all.js +1 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/configs/all.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/configs/strict.js +1 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/configs/strict.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/array-type.js +21 -8
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/array-type.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/ban-ts-comment.js +37 -31
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/ban-ts-comment.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/comma-dangle.js +10 -10
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/comma-dangle.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-generic-constructors.js +100 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-generic-constructors.js.map +1 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-indexed-object-style.js +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-indexed-object-style.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/explicit-function-return-type.js +14 -8
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/explicit-function-return-type.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/explicit-member-accessibility.js +133 -43
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/explicit-member-accessibility.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/explicit-module-boundary-types.js +12 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/explicit-module-boundary-types.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/index.js +2 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/index.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/member-ordering.js +9 -2
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/member-ordering.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-base-to-string.js +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-base-to-string.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-duplicate-enum-values.js +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-duplicate-enum-values.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-empty-interface.js +0 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-empty-interface.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-explicit-any.js +2 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-explicit-any.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-extra-parens.js +8 -2
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-extra-parens.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-extraneous-class.js +4 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-extraneous-class.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-floating-promises.js +8 -3
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-floating-promises.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-implicit-any-catch.js +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-implicit-any-catch.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-inferrable-types.js +9 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-inferrable-types.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-meaningless-void-operator.js +0 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-meaningless-void-operator.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-namespace.js +2 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-namespace.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-non-null-asserted-optional-chain.js +0 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-non-null-asserted-optional-chain.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-non-null-assertion.js +0 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-non-null-assertion.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-shadow.js +38 -8
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-shadow.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-this-alias.js +2 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-this-alias.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-type-alias.js +8 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-type-alias.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unnecessary-boolean-literal-compare.js +2 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unnecessary-boolean-literal-compare.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unnecessary-condition.js +2 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unnecessary-condition.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unnecessary-type-assertion.js +1 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unnecessary-type-assertion.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unnecessary-type-constraint.js +3 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unnecessary-type-constraint.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unsafe-argument.js +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unsafe-argument.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unused-vars.js +4 -3
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unused-vars.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-use-before-define.js +42 -12
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-use-before-define.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-useless-constructor.js +6 -3
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-useless-constructor.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-useless-empty-export.js +1 -2
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-useless-empty-export.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/non-nullable-type-assertion-style.js +0 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/non-nullable-type-assertion-style.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/object-curly-spacing.js +1 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/object-curly-spacing.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/padding-line-between-statements.js +5 -5
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/padding-line-between-statements.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/parameter-properties.js +31 -23
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/parameter-properties.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-as-const.js +5 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-as-const.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-enum-initializers.js +0 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-enum-initializers.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-nullish-coalescing.js +133 -4
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-nullish-coalescing.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-optional-chain.js +166 -86
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-optional-chain.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/promise-function-async.js +2 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/promise-function-async.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/require-array-sort-compare.js +1 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/require-array-sort-compare.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/require-await.js +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/require-await.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/restrict-plus-operands.js +2 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/restrict-plus-operands.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/restrict-template-expressions.js +20 -5
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/restrict-template-expressions.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/return-await.js +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/return-await.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/sort-type-union-intersection-members.js +3 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/sort-type-union-intersection-members.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/space-infix-ops.js +16 -30
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/space-infix-ops.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/switch-exhaustiveness-check.js +0 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/switch-exhaustiveness-check.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/typedef.js +3 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/typedef.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/unbound-method.js +1 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/unbound-method.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/unified-signatures.js +1 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/unified-signatures.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/util/index.js +3 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/util/index.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/util/isNodeEqual.js +27 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/util/isNodeEqual.js.map +1 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/util/isNullLiteral.js +9 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/util/isNullLiteral.js.map +1 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/util/isUndefinedIdentifier.js +9 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/util/isUndefinedIdentifier.js.map +1 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/README.md +3 -138
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/TEMPLATE.md +3 -30
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/adjacent-overload-signatures.md +6 -19
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/array-type.md +6 -25
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/await-thenable.md +6 -19
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/ban-ts-comment.md +30 -25
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/ban-tslint-comment.md +6 -15
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/ban-types.md +74 -99
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/brace-style.md +6 -22
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/camelcase.md +3 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/class-literal-property-style.md +9 -5
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/comma-dangle.md +10 -28
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/comma-spacing.md +6 -22
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-generic-constructors.md +73 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-indexed-object-style.md +19 -21
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-assertions.md +9 -26
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-definitions.md +15 -22
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-exports.md +9 -16
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-imports.md +9 -19
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/default-param-last.md +8 -24
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/dot-notation.md +10 -22
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/explicit-function-return-type.md +7 -33
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/explicit-member-accessibility.md +7 -30
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/explicit-module-boundary-types.md +10 -47
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/func-call-spacing.md +6 -22
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/indent.md +11 -23
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/init-declarations.md +6 -22
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/keyword-spacing.md +6 -22
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/lines-between-class-members.md +8 -24
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/member-delimiter-style.md +6 -2
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/member-ordering.md +34 -13
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/method-signature-style.md +6 -2
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/naming-convention.md +6 -2
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-array-constructor.md +6 -22
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-base-to-string.md +7 -11
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-confusing-non-null-assertion.md +6 -15
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-confusing-void-expression.md +6 -42
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-dupe-class-members.md +6 -22
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-duplicate-enum-values.md +10 -19
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-duplicate-imports.md +8 -28
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-dynamic-delete.md +6 -19
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-empty-function.md +6 -29
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-empty-interface.md +6 -6
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-explicit-any.md +6 -22
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extra-non-null-assertion.md +6 -15
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extra-parens.md +6 -22
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extra-semi.md +6 -22
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extraneous-class.md +6 -28
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-floating-promises.md +6 -19
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-for-in-array.md +6 -21
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-implicit-any-catch.md +11 -20
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-implied-eval.md +6 -18
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-inferrable-types.md +11 -31
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-invalid-this.md +6 -26
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-invalid-void-type.md +6 -18
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-loop-func.md +6 -22
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-loss-of-precision.md +6 -19
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-magic-numbers.md +6 -24
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-meaningless-void-operator.md +6 -2
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-misused-new.md +6 -19
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-misused-promises.md +6 -2
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-namespace.md +10 -17
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-non-null-asserted-nullish-coalescing.md +6 -15
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-non-null-asserted-optional-chain.md +6 -15
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-non-null-assertion.md +6 -19
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-parameter-properties.md +11 -6
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-redeclare.md +6 -19
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-redundant-type-constituents.md +6 -15
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-require-imports.md +6 -19
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-restricted-imports.md +6 -13
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-shadow.md +6 -19
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-this-alias.md +24 -42
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-throw-literal.md +25 -29
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-type-alias.md +6 -18
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-boolean-literal-compare.md +6 -26
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-condition.md +6 -16
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-qualifier.md +6 -19
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-type-arguments.md +6 -19
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-type-assertion.md +8 -8
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md +6 -15
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-argument.md +6 -16
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-assignment.md +6 -16
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-call.md +6 -16
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-member-access.md +6 -16
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-return.md +6 -16
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unused-expressions.md +6 -22
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unused-vars.md +6 -22
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-use-before-define.md +6 -23
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-useless-constructor.md +7 -23
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-useless-empty-export.md +6 -15
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-var-requires.md +6 -19
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/non-nullable-type-assertion-style.md +6 -15
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/object-curly-spacing.md +6 -22
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/padding-line-between-statements.md +10 -31
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/parameter-properties.md +6 -6
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-as-const.md +6 -15
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-enum-initializers.md +6 -15
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-for-of.md +6 -19
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-function-type.md +6 -19
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-includes.md +6 -15
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-literal-enum-member.md +6 -2
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-namespace-keyword.md +6 -19
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-nullish-coalescing.md +48 -2
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-optional-chain.md +18 -17
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-readonly-parameter-types.md +6 -15
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-readonly.md +6 -8
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-reduce-type-parameter.md +6 -15
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-regexp-exec.md +6 -15
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-return-this-type.md +6 -15
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-string-starts-ends-with.md +6 -16
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-ts-expect-error.md +6 -15
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/promise-function-async.md +6 -35
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/quotes.md +6 -22
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/require-array-sort-compare.md +6 -18
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/require-await.md +6 -20
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/restrict-plus-operands.md +6 -28
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/restrict-template-expressions.md +6 -27
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/return-await.md +6 -12
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/semi.md +6 -22
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/sort-type-union-intersection-members.md +6 -45
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/space-before-blocks.md +10 -22
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/space-before-function-paren.md +6 -22
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/space-infix-ops.md +7 -23
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/strict-boolean-expressions.md +6 -26
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/switch-exhaustiveness-check.md +6 -15
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/triple-slash-reference.md +9 -24
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/type-annotation-spacing.md +8 -18
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/typedef.md +12 -32
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/unbound-method.md +7 -27
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/unified-signatures.md +11 -21
- package/node_modules/@typescript-eslint/eslint-plugin/package.json +5 -5
- package/node_modules/@typescript-eslint/parser/README.md +1 -1
- package/node_modules/@typescript-eslint/parser/package.json +6 -5
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/ClassVisitor.d.ts +2 -0
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/ClassVisitor.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/ClassVisitor.js +12 -4
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/ClassVisitor.js.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/Referencer.d.ts +1 -0
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/Referencer.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/Referencer.js +4 -0
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/Referencer.js.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/TypeVisitor.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/TypeVisitor.js +13 -7
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/TypeVisitor.js.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/scope/ClassStaticBlockScope.d.ts +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/scope/ClassStaticBlockScope.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/package.json +5 -5
- package/node_modules/@typescript-eslint/type-utils/package.json +4 -4
- package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.d.ts +22 -20
- package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.js.map +1 -1
- package/node_modules/@typescript-eslint/types/dist/parser-options.d.ts +1 -0
- package/node_modules/@typescript-eslint/types/dist/parser-options.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/types/package.json +3 -2
- package/node_modules/@typescript-eslint/typescript-estree/dist/convert.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/convert.js +9 -2
- package/node_modules/@typescript-eslint/typescript-estree/dist/convert.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/node-utils.d.ts +3 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/node-utils.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/node-utils.js +21 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/node-utils.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/estree-to-ts-node-types.d.ts +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/estree-to-ts-node-types.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/package.json +6 -5
- package/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleCreator.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleCreator.js +2 -1
- package/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleCreator.js.map +1 -1
- package/node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.js +3 -4
- package/node_modules/@typescript-eslint/utils/dist/eslint-utils/getParserServices.js.map +1 -1
- package/node_modules/@typescript-eslint/utils/dist/ts-eslint/Rule.d.ts +4 -0
- package/node_modules/@typescript-eslint/utils/dist/ts-eslint/Rule.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/utils/dist/ts-eslint/SourceCode.d.ts +1 -1
- package/node_modules/@typescript-eslint/utils/dist/ts-eslint/SourceCode.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/utils/package.json +5 -5
- package/node_modules/@typescript-eslint/visitor-keys/dist/visitor-keys.js +1 -1
- package/node_modules/@typescript-eslint/visitor-keys/dist/visitor-keys.js.map +1 -1
- package/node_modules/@typescript-eslint/visitor-keys/package.json +4 -3
- package/node_modules/eslint-config-xo-typescript/index.js +27 -11
- package/node_modules/eslint-config-xo-typescript/package.json +5 -4
- package/package.json +10 -10
- package/node_modules/@typescript-eslint/type-utils/_ts3.4/dist/containsAllTypesByName.d.ts +0 -8
- package/node_modules/@typescript-eslint/type-utils/_ts3.4/dist/getConstrainedTypeAtLocation.d.ts +0 -6
- package/node_modules/@typescript-eslint/type-utils/_ts3.4/dist/getContextualType.d.ts +0 -8
- package/node_modules/@typescript-eslint/type-utils/_ts3.4/dist/getDeclaration.d.ts +0 -6
- package/node_modules/@typescript-eslint/type-utils/_ts3.4/dist/getSourceFileOfNode.d.ts +0 -6
- package/node_modules/@typescript-eslint/type-utils/_ts3.4/dist/getTokenAtPosition.d.ts +0 -3
- package/node_modules/@typescript-eslint/type-utils/_ts3.4/dist/getTypeArguments.d.ts +0 -3
- package/node_modules/@typescript-eslint/type-utils/_ts3.4/dist/getTypeName.d.ts +0 -8
- package/node_modules/@typescript-eslint/type-utils/_ts3.4/dist/index.d.ts +0 -15
- package/node_modules/@typescript-eslint/type-utils/_ts3.4/dist/isTypeReadonly.d.ts +0 -20
- package/node_modules/@typescript-eslint/type-utils/_ts3.4/dist/isUnsafeAssignment.d.ts +0 -17
- package/node_modules/@typescript-eslint/type-utils/_ts3.4/dist/predicates.d.ts +0 -52
- package/node_modules/@typescript-eslint/type-utils/_ts3.4/dist/propertyTypes.d.ts +0 -4
- package/node_modules/@typescript-eslint/type-utils/_ts3.4/dist/requiresQuoting.d.ts +0 -4
- package/node_modules/@typescript-eslint/type-utils/_ts3.4/dist/typeFlagUtils.d.ts +0 -11
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ast-utils/eslint-utils/PatternMatcher.d.ts +0 -48
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ast-utils/eslint-utils/ReferenceTracker.d.ts +0 -76
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ast-utils/eslint-utils/astUtilities.d.ts +0 -76
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ast-utils/eslint-utils/index.d.ts +0 -6
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ast-utils/eslint-utils/predicates.d.ts +0 -32
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ast-utils/eslint-utils/scopeAnalysis.d.ts +0 -18
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ast-utils/helpers.d.ts +0 -47
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ast-utils/index.d.ts +0 -5
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ast-utils/misc.d.ts +0 -8
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ast-utils/predicates.d.ts +0 -180
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/eslint-utils/InferTypesFromRule.d.ts +0 -11
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/eslint-utils/RuleCreator.d.ts +0 -35
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/eslint-utils/RuleTester.d.ts +0 -18
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/eslint-utils/applyDefault.d.ts +0 -10
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/eslint-utils/batchedSingleLineTests.d.ts +0 -24
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/eslint-utils/deepMerge.d.ts +0 -17
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/eslint-utils/getParserServices.d.ts +0 -8
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/eslint-utils/index.d.ts +0 -9
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/eslint-utils/nullThrows.d.ts +0 -14
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/index.d.ts +0 -8
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/json-schema.d.ts +0 -2
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint/AST.d.ts +0 -9
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint/CLIEngine.d.ts +0 -137
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint/ESLint.d.ts +0 -376
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint/Linter.d.ts +0 -326
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint/ParserOptions.d.ts +0 -2
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint/Rule.d.ts +0 -389
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint/RuleTester.d.ts +0 -154
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint/Scope.d.ts +0 -44
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint/SourceCode.d.ts +0 -342
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint/index.d.ts +0 -10
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint-scope/Definition.d.ts +0 -19
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint-scope/Options.d.ts +0 -15
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint-scope/PatternVisitor.d.ts +0 -25
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint-scope/Reference.d.ts +0 -28
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint-scope/Referencer.d.ts +0 -55
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint-scope/Scope.d.ts +0 -103
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint-scope/ScopeManager.d.ts +0 -50
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint-scope/Variable.d.ts +0 -17
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint-scope/analyze.d.ts +0 -16
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint-scope/index.d.ts +0 -11
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-estree.d.ts +0 -3
|
@@ -11,148 +11,13 @@ See [Configs](/docs/linting/configs) for how to enable recommended rules using c
|
|
|
11
11
|
|
|
12
12
|
## Supported Rules
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
import RulesTable from "@site/src/components/RulesTable";
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
| Name | Description | :white_check_mark::lock: | :wrench: | :thought_balloon: |
|
|
19
|
-
| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------ | -------- | ----------------- |
|
|
20
|
-
| [`@typescript-eslint/adjacent-overload-signatures`](./adjacent-overload-signatures.md) | Require that member overloads be consecutive | :white_check_mark: | | |
|
|
21
|
-
| [`@typescript-eslint/array-type`](./array-type.md) | Require using either `T[]` or `Array<T>` for arrays | :lock: | :wrench: | |
|
|
22
|
-
| [`@typescript-eslint/await-thenable`](./await-thenable.md) | Disallow awaiting a value that is not a Thenable | :white_check_mark: | | :thought_balloon: |
|
|
23
|
-
| [`@typescript-eslint/ban-ts-comment`](./ban-ts-comment.md) | Disallow `@ts-<directive>` comments or require descriptions after directive | :white_check_mark: | | |
|
|
24
|
-
| [`@typescript-eslint/ban-tslint-comment`](./ban-tslint-comment.md) | Disallow `// tslint:<rule-flag>` comments | :lock: | :wrench: | |
|
|
25
|
-
| [`@typescript-eslint/ban-types`](./ban-types.md) | Disallow certain types | :white_check_mark: | :wrench: | |
|
|
26
|
-
| [`@typescript-eslint/class-literal-property-style`](./class-literal-property-style.md) | Enforce that literals on classes are exposed in a consistent style | :lock: | :wrench: | |
|
|
27
|
-
| [`@typescript-eslint/consistent-indexed-object-style`](./consistent-indexed-object-style.md) | Require or disallow the `Record` type | :lock: | :wrench: | |
|
|
28
|
-
| [`@typescript-eslint/consistent-type-assertions`](./consistent-type-assertions.md) | Enforce consistent usage of type assertions | :lock: | | |
|
|
29
|
-
| [`@typescript-eslint/consistent-type-definitions`](./consistent-type-definitions.md) | Enforce type definitions to consistently use either `interface` or `type` | :lock: | :wrench: | |
|
|
30
|
-
| [`@typescript-eslint/consistent-type-exports`](./consistent-type-exports.md) | Enforce consistent usage of type exports | | :wrench: | :thought_balloon: |
|
|
31
|
-
| [`@typescript-eslint/consistent-type-imports`](./consistent-type-imports.md) | Enforce consistent usage of type imports | | :wrench: | |
|
|
32
|
-
| [`@typescript-eslint/explicit-function-return-type`](./explicit-function-return-type.md) | Require explicit return types on functions and class methods | | | |
|
|
33
|
-
| [`@typescript-eslint/explicit-member-accessibility`](./explicit-member-accessibility.md) | Require explicit accessibility modifiers on class properties and methods | | :wrench: | |
|
|
34
|
-
| [`@typescript-eslint/explicit-module-boundary-types`](./explicit-module-boundary-types.md) | Require explicit return and argument types on exported functions' and classes' public class methods | | | |
|
|
35
|
-
| [`@typescript-eslint/member-delimiter-style`](./member-delimiter-style.md) | Require a specific member delimiter style for interfaces and type literals | | :wrench: | |
|
|
36
|
-
| [`@typescript-eslint/member-ordering`](./member-ordering.md) | Require a consistent member declaration order | | | |
|
|
37
|
-
| [`@typescript-eslint/method-signature-style`](./method-signature-style.md) | Enforce using a particular method signature syntax | | :wrench: | |
|
|
38
|
-
| [`@typescript-eslint/naming-convention`](./naming-convention.md) | Enforce naming conventions for everything across a codebase | | | :thought_balloon: |
|
|
39
|
-
| [`@typescript-eslint/no-base-to-string`](./no-base-to-string.md) | Require `.toString()` to only be called on objects which provide useful information when stringified | :lock: | | :thought_balloon: |
|
|
40
|
-
| [`@typescript-eslint/no-confusing-non-null-assertion`](./no-confusing-non-null-assertion.md) | Disallow non-null assertion in locations that may be confusing | :lock: | :wrench: | |
|
|
41
|
-
| [`@typescript-eslint/no-confusing-void-expression`](./no-confusing-void-expression.md) | Require expressions of type void to appear in statement position | | :wrench: | :thought_balloon: |
|
|
42
|
-
| [`@typescript-eslint/no-duplicate-enum-values`](./no-duplicate-enum-values.md) | Disallow duplicate enum member values | :lock: | | |
|
|
43
|
-
| [`@typescript-eslint/no-dynamic-delete`](./no-dynamic-delete.md) | Disallow using the `delete` operator on computed key expressions | :lock: | :wrench: | |
|
|
44
|
-
| [`@typescript-eslint/no-empty-interface`](./no-empty-interface.md) | Disallow the declaration of empty interfaces | :white_check_mark: | :wrench: | |
|
|
45
|
-
| [`@typescript-eslint/no-explicit-any`](./no-explicit-any.md) | Disallow the `any` type | :white_check_mark: | :wrench: | |
|
|
46
|
-
| [`@typescript-eslint/no-extra-non-null-assertion`](./no-extra-non-null-assertion.md) | Disallow extra non-null assertion | :white_check_mark: | :wrench: | |
|
|
47
|
-
| [`@typescript-eslint/no-extraneous-class`](./no-extraneous-class.md) | Disallow classes used as namespaces | :lock: | | |
|
|
48
|
-
| [`@typescript-eslint/no-floating-promises`](./no-floating-promises.md) | Require Promise-like statements to be handled appropriately | :white_check_mark: | | :thought_balloon: |
|
|
49
|
-
| [`@typescript-eslint/no-for-in-array`](./no-for-in-array.md) | Disallow iterating over an array with a for-in loop | :white_check_mark: | | :thought_balloon: |
|
|
50
|
-
| [`@typescript-eslint/no-inferrable-types`](./no-inferrable-types.md) | Disallow explicit type declarations for variables or parameters initialized to a number, string, or boolean | :white_check_mark: | :wrench: | |
|
|
51
|
-
| [`@typescript-eslint/no-invalid-void-type`](./no-invalid-void-type.md) | Disallow `void` type outside of generic or return types | :lock: | | |
|
|
52
|
-
| [`@typescript-eslint/no-meaningless-void-operator`](./no-meaningless-void-operator.md) | Disallow the `void` operator except when used to discard a value | :lock: | :wrench: | :thought_balloon: |
|
|
53
|
-
| [`@typescript-eslint/no-misused-new`](./no-misused-new.md) | Enforce valid definition of `new` and `constructor` | :white_check_mark: | | |
|
|
54
|
-
| [`@typescript-eslint/no-misused-promises`](./no-misused-promises.md) | Disallow Promises in places not designed to handle them | :white_check_mark: | | :thought_balloon: |
|
|
55
|
-
| [`@typescript-eslint/no-namespace`](./no-namespace.md) | Disallow custom TypeScript modules and namespaces | :white_check_mark: | | |
|
|
56
|
-
| [`@typescript-eslint/no-non-null-asserted-nullish-coalescing`](./no-non-null-asserted-nullish-coalescing.md) | Disallow non-null assertions in the left operand of a nullish coalescing operator | :lock: | | |
|
|
57
|
-
| [`@typescript-eslint/no-non-null-asserted-optional-chain`](./no-non-null-asserted-optional-chain.md) | Disallow non-null assertions after an optional chain expression | :white_check_mark: | | |
|
|
58
|
-
| [`@typescript-eslint/no-non-null-assertion`](./no-non-null-assertion.md) | Disallow non-null assertions using the `!` postfix operator | :white_check_mark: | | |
|
|
59
|
-
| [`@typescript-eslint/no-redundant-type-constituents`](./no-redundant-type-constituents.md) | Disallow members of unions and intersections that do nothing or override type information | | | :thought_balloon: |
|
|
60
|
-
| [`@typescript-eslint/no-require-imports`](./no-require-imports.md) | Disallow invocation of `require()` | | | |
|
|
61
|
-
| [`@typescript-eslint/no-this-alias`](./no-this-alias.md) | Disallow aliasing `this` | :white_check_mark: | | |
|
|
62
|
-
| [`@typescript-eslint/no-type-alias`](./no-type-alias.md) | Disallow type aliases | | | |
|
|
63
|
-
| [`@typescript-eslint/no-unnecessary-boolean-literal-compare`](./no-unnecessary-boolean-literal-compare.md) | Disallow unnecessary equality comparisons against boolean literals | :lock: | :wrench: | :thought_balloon: |
|
|
64
|
-
| [`@typescript-eslint/no-unnecessary-condition`](./no-unnecessary-condition.md) | Disallow conditionals where the type is always truthy or always falsy | :lock: | :wrench: | :thought_balloon: |
|
|
65
|
-
| [`@typescript-eslint/no-unnecessary-qualifier`](./no-unnecessary-qualifier.md) | Disallow unnecessary namespace qualifiers | | :wrench: | :thought_balloon: |
|
|
66
|
-
| [`@typescript-eslint/no-unnecessary-type-arguments`](./no-unnecessary-type-arguments.md) | Disallow type arguments that are equal to the default | :lock: | :wrench: | :thought_balloon: |
|
|
67
|
-
| [`@typescript-eslint/no-unnecessary-type-assertion`](./no-unnecessary-type-assertion.md) | Disallow type assertions that do not change the type of an expression | :white_check_mark: | :wrench: | :thought_balloon: |
|
|
68
|
-
| [`@typescript-eslint/no-unnecessary-type-constraint`](./no-unnecessary-type-constraint.md) | Disallow unnecessary constraints on generic types | :white_check_mark: | | |
|
|
69
|
-
| [`@typescript-eslint/no-unsafe-argument`](./no-unsafe-argument.md) | Disallow calling a function with a value with type `any` | :white_check_mark: | | :thought_balloon: |
|
|
70
|
-
| [`@typescript-eslint/no-unsafe-assignment`](./no-unsafe-assignment.md) | Disallow assigning a value with type `any` to variables and properties | :white_check_mark: | | :thought_balloon: |
|
|
71
|
-
| [`@typescript-eslint/no-unsafe-call`](./no-unsafe-call.md) | Disallow calling a value with type `any` | :white_check_mark: | | :thought_balloon: |
|
|
72
|
-
| [`@typescript-eslint/no-unsafe-member-access`](./no-unsafe-member-access.md) | Disallow member access on a value with type `any` | :white_check_mark: | | :thought_balloon: |
|
|
73
|
-
| [`@typescript-eslint/no-unsafe-return`](./no-unsafe-return.md) | Disallow returning a value with type `any` from a function | :white_check_mark: | | :thought_balloon: |
|
|
74
|
-
| [`@typescript-eslint/no-useless-empty-export`](./no-useless-empty-export.md) | Disallow empty exports that don't change anything in a module file | | :wrench: | |
|
|
75
|
-
| [`@typescript-eslint/no-var-requires`](./no-var-requires.md) | Disallow `require` statements except in import statements | :white_check_mark: | | |
|
|
76
|
-
| [`@typescript-eslint/non-nullable-type-assertion-style`](./non-nullable-type-assertion-style.md) | Enforce non-null assertions over explicit type casts | :lock: | :wrench: | :thought_balloon: |
|
|
77
|
-
| [`@typescript-eslint/parameter-properties`](./parameter-properties.md) | Require or disallow parameter properties in class constructors | | | |
|
|
78
|
-
| [`@typescript-eslint/prefer-as-const`](./prefer-as-const.md) | Enforce the use of `as const` over literal type | :white_check_mark: | :wrench: | |
|
|
79
|
-
| [`@typescript-eslint/prefer-enum-initializers`](./prefer-enum-initializers.md) | Require each enum member value to be explicitly initialized | | | |
|
|
80
|
-
| [`@typescript-eslint/prefer-for-of`](./prefer-for-of.md) | Enforce the use of `for-of` loop over the standard `for` loop where possible | :lock: | | |
|
|
81
|
-
| [`@typescript-eslint/prefer-function-type`](./prefer-function-type.md) | Enforce using function types instead of interfaces with call signatures | :lock: | :wrench: | |
|
|
82
|
-
| [`@typescript-eslint/prefer-includes`](./prefer-includes.md) | Enforce `includes` method over `indexOf` method | :lock: | :wrench: | :thought_balloon: |
|
|
83
|
-
| [`@typescript-eslint/prefer-literal-enum-member`](./prefer-literal-enum-member.md) | Require all enum members to be literal values | :lock: | | |
|
|
84
|
-
| [`@typescript-eslint/prefer-namespace-keyword`](./prefer-namespace-keyword.md) | Require using `namespace` keyword over `module` keyword to declare custom TypeScript modules | :white_check_mark: | :wrench: | |
|
|
85
|
-
| [`@typescript-eslint/prefer-nullish-coalescing`](./prefer-nullish-coalescing.md) | Enforce using the nullish coalescing operator instead of logical chaining | :lock: | | :thought_balloon: |
|
|
86
|
-
| [`@typescript-eslint/prefer-optional-chain`](./prefer-optional-chain.md) | Enforce using concise optional chain expressions instead of chained logical ands | :lock: | | |
|
|
87
|
-
| [`@typescript-eslint/prefer-readonly`](./prefer-readonly.md) | Require private members to be marked as `readonly` if they're never modified outside of the constructor | | :wrench: | :thought_balloon: |
|
|
88
|
-
| [`@typescript-eslint/prefer-readonly-parameter-types`](./prefer-readonly-parameter-types.md) | Require function parameters to be typed as `readonly` to prevent accidental mutation of inputs | | | :thought_balloon: |
|
|
89
|
-
| [`@typescript-eslint/prefer-reduce-type-parameter`](./prefer-reduce-type-parameter.md) | Enforce using type parameter when calling `Array#reduce` instead of casting | :lock: | :wrench: | :thought_balloon: |
|
|
90
|
-
| [`@typescript-eslint/prefer-regexp-exec`](./prefer-regexp-exec.md) | Enforce `RegExp#exec` over `String#match` if no global flag is provided | | :wrench: | :thought_balloon: |
|
|
91
|
-
| [`@typescript-eslint/prefer-return-this-type`](./prefer-return-this-type.md) | Enforce that `this` is used when only `this` type is returned | :lock: | :wrench: | :thought_balloon: |
|
|
92
|
-
| [`@typescript-eslint/prefer-string-starts-ends-with`](./prefer-string-starts-ends-with.md) | Enforce using `String#startsWith` and `String#endsWith` over other equivalent methods of checking substrings | :lock: | :wrench: | :thought_balloon: |
|
|
93
|
-
| [`@typescript-eslint/prefer-ts-expect-error`](./prefer-ts-expect-error.md) | Enforce using `@ts-expect-error` over `@ts-ignore` | :lock: | :wrench: | |
|
|
94
|
-
| [`@typescript-eslint/promise-function-async`](./promise-function-async.md) | Require any function or method that returns a Promise to be marked async | | :wrench: | :thought_balloon: |
|
|
95
|
-
| [`@typescript-eslint/require-array-sort-compare`](./require-array-sort-compare.md) | Require `Array#sort` calls to always provide a `compareFunction` | | | :thought_balloon: |
|
|
96
|
-
| [`@typescript-eslint/restrict-plus-operands`](./restrict-plus-operands.md) | Require both operands of addition to have type `number` or `string` | :white_check_mark: | | :thought_balloon: |
|
|
97
|
-
| [`@typescript-eslint/restrict-template-expressions`](./restrict-template-expressions.md) | Enforce template literal expressions to be of `string` type | :white_check_mark: | | :thought_balloon: |
|
|
98
|
-
| [`@typescript-eslint/sort-type-union-intersection-members`](./sort-type-union-intersection-members.md) | Enforce members of a type union/intersection to be sorted alphabetically | | :wrench: | |
|
|
99
|
-
| [`@typescript-eslint/strict-boolean-expressions`](./strict-boolean-expressions.md) | Disallow certain types in boolean expressions | | :wrench: | :thought_balloon: |
|
|
100
|
-
| [`@typescript-eslint/switch-exhaustiveness-check`](./switch-exhaustiveness-check.md) | Require switch-case statements to be exhaustive with union type | | | :thought_balloon: |
|
|
101
|
-
| [`@typescript-eslint/triple-slash-reference`](./triple-slash-reference.md) | Disallow certain triple slash directives in favor of ES6-style import declarations | :white_check_mark: | | |
|
|
102
|
-
| [`@typescript-eslint/type-annotation-spacing`](./type-annotation-spacing.md) | Require consistent spacing around type annotations | | :wrench: | |
|
|
103
|
-
| [`@typescript-eslint/typedef`](./typedef.md) | Require type annotations in certain places | | | |
|
|
104
|
-
| [`@typescript-eslint/unbound-method`](./unbound-method.md) | Enforce unbound methods are called with their expected scope | :white_check_mark: | | :thought_balloon: |
|
|
105
|
-
| [`@typescript-eslint/unified-signatures`](./unified-signatures.md) | Disallow two overloads that could be unified into one with a union or an optional/rest parameter | :lock: | | |
|
|
106
|
-
|
|
107
|
-
<!-- end base rule list -->
|
|
16
|
+
<RulesTable />
|
|
108
17
|
|
|
109
18
|
## Extension Rules
|
|
110
19
|
|
|
111
20
|
In some cases, ESLint provides a rule itself, but it doesn't support TypeScript syntax; either it crashes, or it ignores the syntax, or it falsely reports against it.
|
|
112
21
|
In these cases, we create what we call an extension rule; a rule within our plugin that has the same functionality, but also supports TypeScript.
|
|
113
22
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
**Key**: :white_check_mark: = recommended, :lock: = strict, :wrench: = fixable, :thought_balloon: = requires type information
|
|
117
|
-
|
|
118
|
-
| Name | Description | :white_check_mark::lock: | :wrench: | :thought_balloon: |
|
|
119
|
-
| -------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ | ------------------------ | -------- | ----------------- |
|
|
120
|
-
| [`@typescript-eslint/brace-style`](./brace-style.md) | Enforce consistent brace style for blocks | | :wrench: | |
|
|
121
|
-
| [`@typescript-eslint/comma-dangle`](./comma-dangle.md) | Require or disallow trailing commas | | :wrench: | |
|
|
122
|
-
| [`@typescript-eslint/comma-spacing`](./comma-spacing.md) | Enforce consistent spacing before and after commas | | :wrench: | |
|
|
123
|
-
| [`@typescript-eslint/default-param-last`](./default-param-last.md) | Enforce default parameters to be last | | | |
|
|
124
|
-
| [`@typescript-eslint/dot-notation`](./dot-notation.md) | Enforce dot notation whenever possible | :lock: | :wrench: | :thought_balloon: |
|
|
125
|
-
| [`@typescript-eslint/func-call-spacing`](./func-call-spacing.md) | Require or disallow spacing between function identifiers and their invocations | | :wrench: | |
|
|
126
|
-
| [`@typescript-eslint/indent`](./indent.md) | Enforce consistent indentation | | :wrench: | |
|
|
127
|
-
| [`@typescript-eslint/init-declarations`](./init-declarations.md) | Require or disallow initialization in variable declarations | | | |
|
|
128
|
-
| [`@typescript-eslint/keyword-spacing`](./keyword-spacing.md) | Enforce consistent spacing before and after keywords | | :wrench: | |
|
|
129
|
-
| [`@typescript-eslint/lines-between-class-members`](./lines-between-class-members.md) | Require or disallow an empty line between class members | | :wrench: | |
|
|
130
|
-
| [`@typescript-eslint/no-array-constructor`](./no-array-constructor.md) | Disallow generic `Array` constructors | :white_check_mark: | :wrench: | |
|
|
131
|
-
| [`@typescript-eslint/no-dupe-class-members`](./no-dupe-class-members.md) | Disallow duplicate class members | | | |
|
|
132
|
-
| [`@typescript-eslint/no-empty-function`](./no-empty-function.md) | Disallow empty functions | :white_check_mark: | | |
|
|
133
|
-
| [`@typescript-eslint/no-extra-parens`](./no-extra-parens.md) | Disallow unnecessary parentheses | | :wrench: | |
|
|
134
|
-
| [`@typescript-eslint/no-extra-semi`](./no-extra-semi.md) | Disallow unnecessary semicolons | :white_check_mark: | :wrench: | |
|
|
135
|
-
| [`@typescript-eslint/no-implied-eval`](./no-implied-eval.md) | Disallow the use of `eval()`-like methods | :white_check_mark: | | :thought_balloon: |
|
|
136
|
-
| [`@typescript-eslint/no-invalid-this`](./no-invalid-this.md) | Disallow `this` keywords outside of classes or class-like objects | | | |
|
|
137
|
-
| [`@typescript-eslint/no-loop-func`](./no-loop-func.md) | Disallow function declarations that contain unsafe references inside loop statements | | | |
|
|
138
|
-
| [`@typescript-eslint/no-loss-of-precision`](./no-loss-of-precision.md) | Disallow literal numbers that lose precision | :white_check_mark: | | |
|
|
139
|
-
| [`@typescript-eslint/no-magic-numbers`](./no-magic-numbers.md) | Disallow magic numbers | | | |
|
|
140
|
-
| [`@typescript-eslint/no-redeclare`](./no-redeclare.md) | Disallow variable redeclaration | | | |
|
|
141
|
-
| [`@typescript-eslint/no-restricted-imports`](./no-restricted-imports.md) | Disallow specified modules when loaded by `import` | | | |
|
|
142
|
-
| [`@typescript-eslint/no-shadow`](./no-shadow.md) | Disallow variable declarations from shadowing variables declared in the outer scope | | | |
|
|
143
|
-
| [`@typescript-eslint/no-throw-literal`](./no-throw-literal.md) | Disallow throwing literals as exceptions | :lock: | | :thought_balloon: |
|
|
144
|
-
| [`@typescript-eslint/no-unused-expressions`](./no-unused-expressions.md) | Disallow unused expressions | | | |
|
|
145
|
-
| [`@typescript-eslint/no-unused-vars`](./no-unused-vars.md) | Disallow unused variables | :white_check_mark: | | |
|
|
146
|
-
| [`@typescript-eslint/no-use-before-define`](./no-use-before-define.md) | Disallow the use of variables before they are defined | | | |
|
|
147
|
-
| [`@typescript-eslint/no-useless-constructor`](./no-useless-constructor.md) | Disallow unnecessary constructors | :lock: | | |
|
|
148
|
-
| [`@typescript-eslint/object-curly-spacing`](./object-curly-spacing.md) | Enforce consistent spacing inside braces | | :wrench: | |
|
|
149
|
-
| [`@typescript-eslint/padding-line-between-statements`](./padding-line-between-statements.md) | Require or disallow padding lines between statements | | :wrench: | |
|
|
150
|
-
| [`@typescript-eslint/quotes`](./quotes.md) | Enforce the consistent use of either backticks, double, or single quotes | | :wrench: | |
|
|
151
|
-
| [`@typescript-eslint/require-await`](./require-await.md) | Disallow async functions which have no `await` expression | :white_check_mark: | | :thought_balloon: |
|
|
152
|
-
| [`@typescript-eslint/return-await`](./return-await.md) | Enforce consistent returning of awaited values | | :wrench: | :thought_balloon: |
|
|
153
|
-
| [`@typescript-eslint/semi`](./semi.md) | Require or disallow semicolons instead of ASI | | :wrench: | |
|
|
154
|
-
| [`@typescript-eslint/space-before-blocks`](./space-before-blocks.md) | Enforce consistent spacing before blocks | | :wrench: | |
|
|
155
|
-
| [`@typescript-eslint/space-before-function-paren`](./space-before-function-paren.md) | Enforce consistent spacing before function parenthesis | | :wrench: | |
|
|
156
|
-
| [`@typescript-eslint/space-infix-ops`](./space-infix-ops.md) | Require spacing around infix operators | | :wrench: | |
|
|
157
|
-
|
|
158
|
-
<!-- end extension rule list -->
|
|
23
|
+
<RulesTable extensionRules />
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
> 🛑 This file is source code, not the primary documentation location! 🛑
|
|
2
|
+
>
|
|
3
|
+
> See **https://typescript-eslint.io/rules/your-rule-name** for documentation.
|
|
4
4
|
|
|
5
5
|
## Rule Details
|
|
6
6
|
|
|
@@ -20,33 +20,6 @@ To fill out: tell us more about this rule.
|
|
|
20
20
|
// To fill out: correct code
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
## Options
|
|
24
|
-
|
|
25
|
-
This rule is not configurable.
|
|
26
|
-
|
|
27
|
-
```jsonc
|
|
28
|
-
// .eslintrc.json
|
|
29
|
-
{
|
|
30
|
-
"rules": {
|
|
31
|
-
"@typescript-eslint/your-rule-name": "error"
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
If not configurable: This rule is not configurable.
|
|
37
|
-
|
|
38
|
-
If configurable...
|
|
39
|
-
|
|
40
|
-
```ts
|
|
41
|
-
type Options = {
|
|
42
|
-
someOption?: boolean;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const defaultOptions: Options = {
|
|
46
|
-
someOption: false,
|
|
47
|
-
};
|
|
48
|
-
```
|
|
49
|
-
|
|
50
23
|
## When Not To Use It
|
|
51
24
|
|
|
52
25
|
To fill out: why wouldn't you want to use this rule?
|
package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/adjacent-overload-signatures.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
description: 'Require that member overloads be consecutive.'
|
|
3
|
+
---
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
> 🛑 This file is source code, not the primary documentation location! 🛑
|
|
6
|
+
>
|
|
7
|
+
> See **https://typescript-eslint.io/rules/adjacent-overload-signatures** for documentation.
|
|
4
8
|
|
|
5
9
|
Grouping overloaded members together can improve readability of the code.
|
|
6
10
|
|
|
@@ -84,23 +88,6 @@ export function foo(n: number): void;
|
|
|
84
88
|
export function foo(sn: string | number): void;
|
|
85
89
|
```
|
|
86
90
|
|
|
87
|
-
## Options
|
|
88
|
-
|
|
89
|
-
```jsonc
|
|
90
|
-
// .eslintrc.json
|
|
91
|
-
{
|
|
92
|
-
"rules": {
|
|
93
|
-
"@typescript-eslint/adjacent-overload-signatures": "error"
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
This rule is not configurable.
|
|
99
|
-
|
|
100
91
|
## When Not To Use It
|
|
101
92
|
|
|
102
93
|
If you don't care about the general structure of the code, then you will not need this rule.
|
|
103
|
-
|
|
104
|
-
## Related To
|
|
105
|
-
|
|
106
|
-
- TSLint: [adjacent-overload-signatures](https://palantir.github.io/tslint/rules/adjacent-overload-signatures/)
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
description: 'Require using either `T[]` or `Array<T>` for arrays.'
|
|
3
|
+
---
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
> 🛑 This file is source code, not the primary documentation location! 🛑
|
|
6
|
+
>
|
|
7
|
+
> See **https://typescript-eslint.io/rules/array-type** for documentation.
|
|
4
8
|
|
|
5
9
|
Using the same style for array definitions across your codebase makes it easier for your developers to read and understand the types.
|
|
6
10
|
|
|
@@ -10,25 +14,6 @@ This rule aims to standardize usage of array types within your codebase.
|
|
|
10
14
|
|
|
11
15
|
## Options
|
|
12
16
|
|
|
13
|
-
```ts
|
|
14
|
-
type ArrayOption = 'array' | 'generic' | 'array-simple';
|
|
15
|
-
type Options = {
|
|
16
|
-
default: ArrayOption;
|
|
17
|
-
readonly?: ArrayOption;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const defaultOptions: Options = {
|
|
21
|
-
default: 'array',
|
|
22
|
-
};
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
The rule accepts an options object with the following properties:
|
|
26
|
-
|
|
27
|
-
- `default` - sets the array type expected for mutable cases.
|
|
28
|
-
- `readonly` - sets the array type expected for readonly arrays. If this is omitted, then the value for `default` will be used.
|
|
29
|
-
|
|
30
|
-
Each property can be set to one of three strings: `'array' | 'generic' | 'array-simple'`.
|
|
31
|
-
|
|
32
17
|
The default config will enforce that all mutable and readonly arrays use the `'array'` syntax.
|
|
33
18
|
|
|
34
19
|
### `"array"`
|
|
@@ -118,7 +103,3 @@ This matrix lists all possible option combinations and their expected results fo
|
|
|
118
103
|
| `generic` | `array` | `Array<number>` | `Array<Foo & Bar>` | `readonly number[]` | `readonly (Foo & Bar)[]` |
|
|
119
104
|
| `generic` | `array-simple` | `Array<number>` | `Array<Foo & Bar>` | `readonly number[]` | `ReadonlyArray<Foo & Bar>` |
|
|
120
105
|
| `generic` | `generic` | `Array<number>` | `Array<Foo & Bar>` | `ReadonlyArray<number>` | `ReadonlyArray<Foo & Bar>` |
|
|
121
|
-
|
|
122
|
-
## Related To
|
|
123
|
-
|
|
124
|
-
- TSLint: [array-type](https://palantir.github.io/tslint/rules/array-type/)
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
description: 'Disallow awaiting a value that is not a Thenable.'
|
|
3
|
+
---
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
> 🛑 This file is source code, not the primary documentation location! 🛑
|
|
6
|
+
>
|
|
7
|
+
> See **https://typescript-eslint.io/rules/await-thenable** for documentation.
|
|
4
8
|
|
|
5
9
|
This rule disallows awaiting a value that is not a "Thenable" (an object which has `then` method, such as a Promise).
|
|
6
10
|
While it is valid JavaScript to await a non-`Promise`-like value (it will resolve immediately), this pattern is often a programmer error, such as forgetting to add parenthesis to call a function that returns a Promise.
|
|
@@ -29,24 +33,7 @@ const createValue = async () => 'value';
|
|
|
29
33
|
await createValue();
|
|
30
34
|
```
|
|
31
35
|
|
|
32
|
-
## Options
|
|
33
|
-
|
|
34
|
-
```jsonc
|
|
35
|
-
// .eslintrc.json
|
|
36
|
-
{
|
|
37
|
-
"rules": {
|
|
38
|
-
"@typescript-eslint/await-thenable": "error"
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
This rule is not configurable.
|
|
44
|
-
|
|
45
36
|
## When Not To Use It
|
|
46
37
|
|
|
47
38
|
If you want to allow code to `await` non-Promise values.
|
|
48
39
|
This is generally not preferred, but can sometimes be useful for visual consistency.
|
|
49
|
-
|
|
50
|
-
## Related To
|
|
51
|
-
|
|
52
|
-
- TSLint: ['await-promise'](https://palantir.github.io/tslint/rules/await-promise)
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
description: 'Disallow `@ts-<directive>` comments or require descriptions after directive.'
|
|
3
|
+
---
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
> 🛑 This file is source code, not the primary documentation location! 🛑
|
|
6
|
+
>
|
|
7
|
+
> See **https://typescript-eslint.io/rules/ban-ts-comment** for documentation.
|
|
4
8
|
|
|
5
9
|
TypeScript provides several directive comments that can be used to alter how it processes files.
|
|
6
10
|
Using these to suppress TypeScript Compiler Errors reduces the effectiveness of TypeScript overall.
|
|
@@ -17,27 +21,10 @@ The directive comments supported by TypeScript are:
|
|
|
17
21
|
## Rule Details
|
|
18
22
|
|
|
19
23
|
This rule lets you set which directive comments you want to allow in your codebase.
|
|
20
|
-
By default, only `@ts-check` is allowed, as it enables rather than suppresses errors.
|
|
21
|
-
|
|
22
|
-
The configuration looks like this:
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
interface Options {
|
|
26
|
-
'ts-expect-error'?: boolean | 'allow-with-description';
|
|
27
|
-
'ts-ignore'?: boolean | 'allow-with-description';
|
|
28
|
-
'ts-nocheck'?: boolean | 'allow-with-description';
|
|
29
|
-
'ts-check'?: boolean | 'allow-with-description';
|
|
30
|
-
minimumDescriptionLength?: number;
|
|
31
|
-
}
|
|
25
|
+
## Options
|
|
32
26
|
|
|
33
|
-
|
|
34
|
-
'ts-expect-error': 'allow-with-description',
|
|
35
|
-
'ts-ignore': true,
|
|
36
|
-
'ts-nocheck': true,
|
|
37
|
-
'ts-check': false,
|
|
38
|
-
minimumDescriptionLength: 3,
|
|
39
|
-
};
|
|
40
|
-
```
|
|
27
|
+
By default, only `@ts-check` is allowed, as it enables rather than suppresses errors.
|
|
41
28
|
|
|
42
29
|
### `ts-expect-error`, `ts-ignore`, `ts-nocheck`, `ts-check` directives
|
|
43
30
|
|
|
@@ -105,6 +92,28 @@ if (false) {
|
|
|
105
92
|
}
|
|
106
93
|
```
|
|
107
94
|
|
|
95
|
+
### `descriptionFormat`
|
|
96
|
+
|
|
97
|
+
For each directive type, you can specify a custom format in the form of a regular expression. Only description that matches the pattern will be allowed.
|
|
98
|
+
|
|
99
|
+
For example, with `{ 'ts-expect-error': { descriptionFormat: '^: TS\\d+ because .+$' } }`:
|
|
100
|
+
|
|
101
|
+
<!--tabs-->
|
|
102
|
+
|
|
103
|
+
#### ❌ Incorrect
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
// @ts-expect-error: the library definition is wrong
|
|
107
|
+
const a = doSomething('hello');
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
#### ✅ Correct
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
// @ts-expect-error: TS1234 because the library definition is wrong
|
|
114
|
+
const a = doSomething('hello');
|
|
115
|
+
```
|
|
116
|
+
|
|
108
117
|
### `minimumDescriptionLength`
|
|
109
118
|
|
|
110
119
|
Use `minimumDescriptionLength` to set a minimum length for descriptions when using the `allow-with-description` option for a directive.
|
|
@@ -138,7 +147,3 @@ If you want to use all of the TypeScript directives.
|
|
|
138
147
|
## Further Reading
|
|
139
148
|
|
|
140
149
|
- TypeScript [Type Checking JavaScript Files](https://www.typescriptlang.org/docs/handbook/type-checking-javascript-files.html)
|
|
141
|
-
|
|
142
|
-
## Related To
|
|
143
|
-
|
|
144
|
-
- TSLint: [ban-ts-ignore](https://palantir.github.io/tslint/rules/ban-ts-ignore/)
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
description: 'Disallow `// tslint:<rule-flag>` comments.'
|
|
3
|
+
---
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
> 🛑 This file is source code, not the primary documentation location! 🛑
|
|
6
|
+
>
|
|
7
|
+
> See **https://typescript-eslint.io/rules/ban-tslint-comment** for documentation.
|
|
4
8
|
|
|
5
9
|
Useful when migrating from TSLint to ESLint. Once TSLint has been removed, this rule helps locate TSLint annotations (e.g. `// tslint:disable`).
|
|
6
10
|
|
|
@@ -30,19 +34,6 @@ someCode(); // tslint:disable-line
|
|
|
30
34
|
someCode(); // This is a comment that just happens to mention tslint
|
|
31
35
|
```
|
|
32
36
|
|
|
33
|
-
## Options
|
|
34
|
-
|
|
35
|
-
```jsonc
|
|
36
|
-
// .eslintrc.json
|
|
37
|
-
{
|
|
38
|
-
"rules": {
|
|
39
|
-
"@typescript-eslint/ban-tslint-comment": "warn"
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
This rule is not configurable.
|
|
45
|
-
|
|
46
37
|
## When Not To Use It
|
|
47
38
|
|
|
48
39
|
If you are still using TSLint.
|