xo 0.52.4 → 0.53.0
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 -0
- package/node_modules/@types/semver/LICENSE +21 -0
- package/node_modules/@types/semver/README.md +16 -0
- package/node_modules/@types/semver/classes/comparator.d.ts +17 -0
- package/node_modules/@types/semver/classes/range.d.ts +21 -0
- package/node_modules/@types/semver/classes/semver.d.ts +62 -0
- package/node_modules/@types/semver/functions/clean.d.ts +8 -0
- package/node_modules/@types/semver/functions/cmp.d.ts +16 -0
- package/node_modules/@types/semver/functions/coerce.d.ts +12 -0
- package/node_modules/@types/semver/functions/compare-build.d.ts +21 -0
- package/node_modules/@types/semver/functions/compare-loose.d.ts +5 -0
- package/node_modules/@types/semver/functions/compare.d.ts +20 -0
- package/node_modules/@types/semver/functions/diff.d.ts +9 -0
- package/node_modules/@types/semver/functions/eq.d.ts +9 -0
- package/node_modules/@types/semver/functions/gt.d.ts +9 -0
- package/node_modules/@types/semver/functions/gte.d.ts +9 -0
- package/node_modules/@types/semver/functions/inc.d.ts +15 -0
- package/node_modules/@types/semver/functions/lt.d.ts +9 -0
- package/node_modules/@types/semver/functions/lte.d.ts +8 -0
- package/node_modules/@types/semver/functions/major.d.ts +9 -0
- package/node_modules/@types/semver/functions/minor.d.ts +9 -0
- package/node_modules/@types/semver/functions/neq.d.ts +9 -0
- package/node_modules/@types/semver/functions/parse.d.ts +12 -0
- package/node_modules/@types/semver/functions/patch.d.ts +9 -0
- package/node_modules/@types/semver/functions/prerelease.d.ts +12 -0
- package/node_modules/@types/semver/functions/rcompare.d.ts +15 -0
- package/node_modules/@types/semver/functions/rsort.d.ts +9 -0
- package/node_modules/@types/semver/functions/satisfies.d.ts +14 -0
- package/node_modules/@types/semver/functions/sort.d.ts +9 -0
- package/node_modules/@types/semver/functions/valid.d.ts +11 -0
- package/node_modules/@types/semver/index.d.ts +136 -0
- package/node_modules/@types/semver/internals/identifiers.d.ts +13 -0
- package/node_modules/@types/semver/package.json +50 -0
- package/node_modules/@types/semver/preload.d.ts +2 -0
- package/node_modules/@types/semver/ranges/gtr.d.ts +14 -0
- package/node_modules/@types/semver/ranges/intersects.d.ts +13 -0
- package/node_modules/@types/semver/ranges/ltr.d.ts +14 -0
- package/node_modules/@types/semver/ranges/max-satisfying.d.ts +14 -0
- package/node_modules/@types/semver/ranges/min-satisfying.d.ts +14 -0
- package/node_modules/@types/semver/ranges/min-version.d.ts +10 -0
- package/node_modules/@types/semver/ranges/outside.d.ts +15 -0
- package/node_modules/@types/semver/ranges/simplify.d.ts +14 -0
- package/node_modules/@types/semver/ranges/subset.d.ts +9 -0
- package/node_modules/@types/semver/ranges/to-comparators.d.ts +9 -0
- package/node_modules/@types/semver/ranges/valid.d.ts +12 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/configs/all.js +2 -1
- 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/adjacent-overload-signatures.js +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/adjacent-overload-signatures.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/array-type.js +1 -1
- 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 +1 -1
- 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-spacing.js +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/comma-spacing.js.map +1 -1
- 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/consistent-type-imports.js +99 -24
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/consistent-type-imports.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/index.js +4 -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-delimiter-style.js +2 -2
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/member-delimiter-style.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/member-ordering.js +29 -10
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/member-ordering.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/enums.js +4 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/enums.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/schema.js +19 -2
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention-utils/schema.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention.js +29 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/naming-convention.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-extra-non-null-assertion.js +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-extra-non-null-assertion.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-extra-parens.js +14 -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-invalid-void-type.js +11 -5
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-invalid-void-type.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-misused-promises.js +51 -11
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-misused-promises.js.map +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-namespace.js +2 -2
- 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-shadow.js +1 -2
- 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-unnecessary-condition.js +4 -3
- 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-unsafe-declaration-merging.js +78 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unsafe-declaration-merging.js.map +1 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-nullish-coalescing.js +0 -3
- 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 +167 -68
- 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 -1
- 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/restrict-plus-operands.js +1 -1
- 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/sort-type-constituents.js +245 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/sort-type-constituents.js.map +1 -0
- 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/docs/rules/TEMPLATE.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/adjacent-overload-signatures.md +5 -5
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/array-type.md +4 -6
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/await-thenable.md +5 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/ban-ts-comment.md +3 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/ban-tslint-comment.md +2 -2
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/ban-types.md +2 -2
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/brace-style.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/class-literal-property-style.md +4 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/comma-dangle.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/comma-spacing.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-generic-constructors.md +3 -3
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-indexed-object-style.md +1 -3
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-assertions.md +12 -5
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-definitions.md +4 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-exports.md +7 -13
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/consistent-type-imports.md +47 -6
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/default-param-last.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/dot-notation.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/explicit-function-return-type.md +7 -6
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/explicit-member-accessibility.md +10 -6
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/explicit-module-boundary-types.md +3 -3
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/func-call-spacing.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/indent.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/init-declarations.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/keyword-spacing.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/lines-between-class-members.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/member-delimiter-style.md +7 -60
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/member-ordering.md +19 -6
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/method-signature-style.md +6 -6
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/naming-convention.md +29 -30
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-array-constructor.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-base-to-string.md +12 -11
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-confusing-non-null-assertion.md +4 -2
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-confusing-void-expression.md +4 -5
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-dupe-class-members.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-duplicate-enum-values.md +5 -2
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-dynamic-delete.md +4 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-empty-function.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-empty-interface.md +5 -5
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-explicit-any.md +13 -8
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extra-non-null-assertion.md +4 -3
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extra-parens.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extra-semi.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-extraneous-class.md +4 -6
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-floating-promises.md +2 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-for-in-array.md +26 -18
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-implicit-any-catch.md +1 -3
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-implied-eval.md +1 -3
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-inferrable-types.md +12 -43
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-invalid-this.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-invalid-void-type.md +6 -13
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-loop-func.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-loss-of-precision.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-magic-numbers.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-meaningless-void-operator.md +8 -21
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-misused-new.md +13 -6
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-misused-promises.md +53 -91
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-namespace.md +6 -7
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-non-null-asserted-nullish-coalescing.md +3 -13
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-non-null-asserted-optional-chain.md +4 -27
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-non-null-assertion.md +14 -13
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-parameter-properties.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-redeclare.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-redundant-type-constituents.md +1 -6
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-require-imports.md +12 -15
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-restricted-imports.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-shadow.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-this-alias.md +9 -15
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-throw-literal.md +1 -3
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-type-alias.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-boolean-literal-compare.md +15 -14
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-condition.md +3 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-qualifier.md +12 -46
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-type-arguments.md +22 -8
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-type-assertion.md +4 -6
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unnecessary-type-constraint.md +6 -20
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-argument.md +10 -7
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-assignment.md +9 -6
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-call.md +6 -5
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-declaration-merging.md +54 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-member-access.md +5 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-return.md +9 -6
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unused-expressions.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unused-vars.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-use-before-define.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-useless-constructor.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-useless-empty-export.md +4 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-var-requires.md +6 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/non-nullable-type-assertion-style.md +7 -3
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/object-curly-spacing.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/padding-line-between-statements.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/parameter-properties.md +3 -6
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-as-const.md +7 -3
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-enum-initializers.md +5 -23
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-for-of.md +15 -16
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-function-type.md +22 -22
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-includes.md +28 -30
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-literal-enum-member.md +12 -13
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-namespace-keyword.md +27 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-nullish-coalescing.md +6 -54
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-optional-chain.md +21 -49
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-readonly-parameter-types.md +1 -3
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-readonly.md +3 -5
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-reduce-type-parameter.md +6 -8
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-regexp-exec.md +6 -11
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-return-this-type.md +10 -25
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-string-starts-ends-with.md +10 -6
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-ts-expect-error.md +5 -11
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/promise-function-async.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/quotes.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/require-array-sort-compare.md +5 -14
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/require-await.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/restrict-plus-operands.md +18 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/restrict-template-expressions.md +9 -2
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/return-await.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/semi.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/sort-type-constituents.md +101 -0
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/sort-type-union-intersection-members.md +8 -16
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/space-before-blocks.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/space-before-function-paren.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/strict-boolean-expressions.md +0 -2
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/switch-exhaustiveness-check.md +15 -24
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/triple-slash-reference.md +4 -2
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/type-annotation-spacing.md +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/typedef.md +5 -7
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/unbound-method.md +7 -4
- package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/unified-signatures.md +5 -3
- package/node_modules/@typescript-eslint/eslint-plugin/package.json +7 -5
- package/node_modules/@typescript-eslint/parser/README.md +2 -0
- package/node_modules/@typescript-eslint/parser/package.json +5 -5
- package/node_modules/@typescript-eslint/scope-manager/package.json +5 -5
- package/node_modules/@typescript-eslint/type-utils/dist/isTypeReadonly.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/type-utils/dist/isTypeReadonly.js +3 -0
- package/node_modules/@typescript-eslint/type-utils/dist/isTypeReadonly.js.map +1 -1
- package/node_modules/@typescript-eslint/type-utils/package.json +5 -5
- package/node_modules/@typescript-eslint/types/_ts3.4/dist/generated/ast-spec.d.ts +3 -3
- package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.d.ts +3 -3
- package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/types/package.json +2 -2
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/ast-converter.d.ts +2 -2
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createDefaultProgram.d.ts +3 -6
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createIsolatedProgram.d.ts +2 -2
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createProjectProgram.d.ts +4 -6
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createSourceFile.d.ts +2 -2
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/createWatchProgram.d.ts +4 -7
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/shared.d.ts +5 -4
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/useProvidedPrograms.d.ts +2 -2
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/parseSettings/createParseSettings.d.ts +4 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/parseSettings/index.d.ts +102 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/parseSettings/inferSingleRun.d.ts +15 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/parseSettings/warnAboutTSVersion.d.ts +3 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/parser-options.d.ts +0 -26
- package/node_modules/@typescript-eslint/typescript-estree/dist/ast-converter.d.ts +2 -2
- package/node_modules/@typescript-eslint/typescript-estree/dist/ast-converter.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/ast-converter.js +8 -8
- package/node_modules/@typescript-eslint/typescript-estree/dist/ast-converter.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createDefaultProgram.d.ts +3 -6
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createDefaultProgram.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createDefaultProgram.js +13 -15
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createDefaultProgram.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createIsolatedProgram.d.ts +2 -2
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createIsolatedProgram.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createIsolatedProgram.js +7 -7
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createIsolatedProgram.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createProjectProgram.d.ts +4 -6
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createProjectProgram.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createProjectProgram.js +51 -38
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createProjectProgram.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createSourceFile.d.ts +2 -2
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createSourceFile.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createSourceFile.js +4 -4
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createSourceFile.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createWatchProgram.d.ts +4 -7
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createWatchProgram.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createWatchProgram.js +21 -22
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createWatchProgram.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/shared.d.ts +5 -4
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/shared.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/shared.js +7 -7
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/shared.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/useProvidedPrograms.d.ts +2 -2
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/useProvidedPrograms.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/useProvidedPrograms.js +4 -4
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/useProvidedPrograms.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/createParseSettings.d.ts +4 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/createParseSettings.d.ts.map +1 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/createParseSettings.js +145 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/createParseSettings.js.map +1 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/index.d.ts +102 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/index.d.ts.map +1 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/index.js +3 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/index.js.map +1 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/inferSingleRun.d.ts +15 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/inferSingleRun.d.ts.map +1 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/inferSingleRun.js +53 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/inferSingleRun.js.map +1 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/warnAboutTSVersion.d.ts +3 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/warnAboutTSVersion.d.ts.map +1 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/warnAboutTSVersion.js +68 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/warnAboutTSVersion.js.map +1 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parser-options.d.ts +0 -26
- package/node_modules/@typescript-eslint/typescript-estree/dist/parser-options.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/parser.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/parser.js +32 -388
- package/node_modules/@typescript-eslint/typescript-estree/dist/parser.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/package.json +5 -5
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/eslint-utils/batchedSingleLineTests.d.ts +1 -1
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/eslint-utils/index.d.ts +1 -1
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/eslint-utils/rule-tester/RuleTester.d.ts +48 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/eslint-utils/rule-tester/dependencyConstraints.d.ts +17 -0
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/ts-eslint/RuleTester.d.ts +21 -17
- package/node_modules/@typescript-eslint/utils/dist/eslint-utils/batchedSingleLineTests.d.ts +1 -1
- package/node_modules/@typescript-eslint/utils/dist/eslint-utils/batchedSingleLineTests.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/utils/dist/eslint-utils/batchedSingleLineTests.js.map +1 -1
- package/node_modules/@typescript-eslint/utils/dist/eslint-utils/index.d.ts +1 -1
- package/node_modules/@typescript-eslint/utils/dist/eslint-utils/index.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/utils/dist/eslint-utils/index.js +1 -1
- package/node_modules/@typescript-eslint/utils/dist/eslint-utils/index.js.map +1 -1
- package/node_modules/@typescript-eslint/utils/dist/eslint-utils/rule-tester/RuleTester.d.ts +49 -0
- package/node_modules/@typescript-eslint/utils/dist/eslint-utils/rule-tester/RuleTester.d.ts.map +1 -0
- package/node_modules/@typescript-eslint/utils/dist/eslint-utils/rule-tester/RuleTester.js +238 -0
- package/node_modules/@typescript-eslint/utils/dist/eslint-utils/rule-tester/RuleTester.js.map +1 -0
- package/node_modules/@typescript-eslint/utils/dist/eslint-utils/rule-tester/dependencyConstraints.d.ts +17 -0
- package/node_modules/@typescript-eslint/utils/dist/eslint-utils/rule-tester/dependencyConstraints.d.ts.map +1 -0
- package/node_modules/@typescript-eslint/utils/dist/eslint-utils/rule-tester/dependencyConstraints.js +52 -0
- package/node_modules/@typescript-eslint/utils/dist/eslint-utils/rule-tester/dependencyConstraints.js.map +1 -0
- package/node_modules/@typescript-eslint/utils/dist/ts-eslint/RuleTester.d.ts +16 -9
- package/node_modules/@typescript-eslint/utils/dist/ts-eslint/RuleTester.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/utils/dist/ts-eslint/RuleTester.js.map +1 -1
- package/node_modules/@typescript-eslint/utils/package.json +9 -6
- package/node_modules/@typescript-eslint/visitor-keys/package.json +3 -3
- package/node_modules/eslint-config-xo-typescript/index.js +7 -1
- package/node_modules/eslint-config-xo-typescript/package.json +5 -5
- package/node_modules/natural-compare-lite/README.md +126 -0
- package/node_modules/natural-compare-lite/index.js +57 -0
- package/node_modules/natural-compare-lite/package.json +42 -0
- package/node_modules/semver/classes/range.js +3 -0
- package/node_modules/semver/index.js +81 -41
- package/node_modules/{lru-cache → semver/node_modules/lru-cache}/LICENSE +0 -0
- package/node_modules/{lru-cache → semver/node_modules/lru-cache}/README.md +0 -0
- package/node_modules/{lru-cache → semver/node_modules/lru-cache}/index.js +0 -0
- package/node_modules/{lru-cache → semver/node_modules/lru-cache}/package.json +0 -0
- package/node_modules/semver/package.json +21 -10
- package/package.json +24 -24
- package/readme.md +1 -1
- package/node_modules/@typescript-eslint/utils/_ts3.4/dist/eslint-utils/RuleTester.d.ts +0 -18
- package/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleTester.d.ts +0 -18
- package/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleTester.d.ts.map +0 -1
- package/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleTester.js +0 -133
- package/node_modules/@typescript-eslint/utils/dist/eslint-utils/RuleTester.js.map +0 -1
package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/no-unsafe-declaration-merging.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'Disallow unsafe declaration merging.'
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
> 🛑 This file is source code, not the primary documentation location! 🛑
|
|
6
|
+
>
|
|
7
|
+
> See **https://typescript-eslint.io/rules/no-unsafe-declaration-merging** for documentation.
|
|
8
|
+
|
|
9
|
+
TypeScript's "declaration merging" supports merging separate declarations with the same name.
|
|
10
|
+
|
|
11
|
+
Declaration merging between classes and interfaces is unsafe.
|
|
12
|
+
The TypeScript compiler doesn't check whether properties are initialized, which can cause lead to TypeScript not detecting code that will cause runtime errors.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
interface Foo {
|
|
16
|
+
nums: number[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
class Foo {}
|
|
20
|
+
|
|
21
|
+
const foo = new Foo();
|
|
22
|
+
|
|
23
|
+
foo.nums.push(1); // Runtime Error: Cannot read properties of undefined.
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Examples
|
|
27
|
+
|
|
28
|
+
<!--tabs-->
|
|
29
|
+
|
|
30
|
+
### ❌ Incorrect
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
interface Foo {}
|
|
34
|
+
|
|
35
|
+
class Foo {}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### ✅ Correct
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
interface Foo {}
|
|
42
|
+
class Bar implements Foo {}
|
|
43
|
+
|
|
44
|
+
namespace Baz {}
|
|
45
|
+
namespace Baz {}
|
|
46
|
+
enum Baz {}
|
|
47
|
+
|
|
48
|
+
namespace Qux {}
|
|
49
|
+
function Qux() {}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Further Reading
|
|
53
|
+
|
|
54
|
+
- [Declaration Merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html)
|
|
@@ -6,14 +6,15 @@ description: 'Disallow member access on a value with type `any`.'
|
|
|
6
6
|
>
|
|
7
7
|
> See **https://typescript-eslint.io/rules/no-unsafe-member-access** for documentation.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
The `any` type in TypeScript is a dangerous "escape hatch" from the type system.
|
|
10
|
+
Using `any` disables many type checking rules and is generally best used only as a last resort or when prototyping code.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Despite your best intentions, the `any` type can sometimes leak into your codebase.
|
|
13
|
+
Accessing a member of an `any`-typed value creates a potential type safety hole and source of bugs in your codebase.
|
|
13
14
|
|
|
14
15
|
This rule disallows member access on any variable that is typed as `any`.
|
|
15
16
|
|
|
16
|
-
Examples
|
|
17
|
+
## Examples
|
|
17
18
|
|
|
18
19
|
<!--tabs-->
|
|
19
20
|
|
|
@@ -6,15 +6,18 @@ description: 'Disallow returning a value with type `any` from a function.'
|
|
|
6
6
|
>
|
|
7
7
|
> See **https://typescript-eslint.io/rules/no-unsafe-return** for documentation.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
The `any` type in TypeScript is a dangerous "escape hatch" from the type system.
|
|
10
|
+
Using `any` disables many type checking rules and is generally best used only as a last resort or when prototyping code.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Despite your best intentions, the `any` type can sometimes leak into your codebase.
|
|
13
|
+
Returning an an `any`-typed value from a function creates a potential type safety hole and source of bugs in your codebase.
|
|
13
14
|
|
|
14
15
|
This rule disallows returning `any` or `any[]` from a function.
|
|
15
|
-
This rule also compares the return type to the function's declared/inferred return type to ensure you don't return an unsafe `any` in a generic position to a receiver that's expecting a specific type. For example, it will error if you return `Set<any>` from a function declared as returning `Set<string>`.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
This rule also compares generic type argument types to ensure you don't return an unsafe `any` in a generic position to a function that's expecting a specific type.
|
|
18
|
+
For example, it will error if you return `Set<any>` from a function declared as returning `Set<string>`.
|
|
19
|
+
|
|
20
|
+
## Examples
|
|
18
21
|
|
|
19
22
|
<!--tabs-->
|
|
20
23
|
|
|
@@ -83,7 +86,7 @@ const assignability2: TAssign = () => new Set(['foo']);
|
|
|
83
86
|
|
|
84
87
|
There are cases where the rule allows to return `any` to `unknown`.
|
|
85
88
|
|
|
86
|
-
Examples of `any` to `unknown` return that are allowed
|
|
89
|
+
Examples of `any` to `unknown` return that are allowed:
|
|
87
90
|
|
|
88
91
|
```ts
|
|
89
92
|
function foo1(): unknown {
|
|
@@ -6,7 +6,7 @@ description: 'Disallow unused expressions.'
|
|
|
6
6
|
>
|
|
7
7
|
> See **https://typescript-eslint.io/rules/no-unused-expressions** for documentation.
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Examples
|
|
10
10
|
|
|
11
11
|
This rule extends the base [`eslint/no-unused-expressions`](https://eslint.org/docs/rules/no-unused-expressions) rule.
|
|
12
12
|
It adds support for optional call expressions `x?.()`, and directive in module declarations.
|
|
@@ -6,7 +6,7 @@ description: 'Disallow unused variables.'
|
|
|
6
6
|
>
|
|
7
7
|
> See **https://typescript-eslint.io/rules/no-unused-vars** for documentation.
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Examples
|
|
10
10
|
|
|
11
11
|
This rule extends the base [`eslint/no-unused-vars`](https://eslint.org/docs/rules/no-unused-vars) rule.
|
|
12
12
|
It adds support for TypeScript features, such as types.
|
|
@@ -6,7 +6,7 @@ description: 'Disallow the use of variables before they are defined.'
|
|
|
6
6
|
>
|
|
7
7
|
> See **https://typescript-eslint.io/rules/no-use-before-define** for documentation.
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Examples
|
|
10
10
|
|
|
11
11
|
This rule extends the base [`eslint/no-use-before-define`](https://eslint.org/docs/rules/no-use-before-define) rule.
|
|
12
12
|
It adds support for `type`, `interface` and `enum` declarations.
|
|
@@ -6,7 +6,7 @@ description: 'Disallow unnecessary constructors.'
|
|
|
6
6
|
>
|
|
7
7
|
> See **https://typescript-eslint.io/rules/no-useless-constructor** for documentation.
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Examples
|
|
10
10
|
|
|
11
11
|
This rule extends the base [`eslint/no-useless-constructor`](https://eslint.org/docs/rules/no-useless-constructor) rule.
|
|
12
12
|
It adds support for:
|
|
@@ -6,17 +6,17 @@ description: "Disallow empty exports that don't change anything in a module file
|
|
|
6
6
|
>
|
|
7
7
|
> See **https://typescript-eslint.io/rules/no-useless-empty-export** for documentation.
|
|
8
8
|
|
|
9
|
-
## Rule Details
|
|
10
|
-
|
|
11
9
|
An empty `export {}` statement is sometimes useful in TypeScript code to turn a file that would otherwise be a script file into a module file.
|
|
12
|
-
Per the TypeScript Handbook
|
|
10
|
+
Per the [TypeScript Handbook Modules page](https://www.typescriptlang.org/docs/handbook/modules.html):
|
|
13
11
|
|
|
14
12
|
> In TypeScript, just as in ECMAScript 2015, any file containing a top-level import or export is considered a module.
|
|
15
13
|
> Conversely, a file without any top-level import or export declarations is treated as a script whose contents are available in the global scope (and therefore to modules as well).
|
|
16
14
|
|
|
17
15
|
However, an `export {}` statement does nothing if there are any other top-level import or export statements in a file.
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
This rule reports an `export {}` that doesn't do anything in a file already using ES modules.
|
|
18
|
+
|
|
19
|
+
## Examples
|
|
20
20
|
|
|
21
21
|
<!--tabs-->
|
|
22
22
|
|
|
@@ -8,9 +8,7 @@ description: 'Disallow `require` statements except in import statements.'
|
|
|
8
8
|
|
|
9
9
|
In other words, the use of forms such as `var foo = require("foo")` are banned. Instead use ES6 style imports or `import foo = require("foo")` imports.
|
|
10
10
|
|
|
11
|
-
##
|
|
12
|
-
|
|
13
|
-
Examples of code for this rule:
|
|
11
|
+
## Examples
|
|
14
12
|
|
|
15
13
|
<!--tabs-->
|
|
16
14
|
|
|
@@ -32,4 +30,8 @@ import foo from 'foo';
|
|
|
32
30
|
|
|
33
31
|
## When Not To Use It
|
|
34
32
|
|
|
35
|
-
If you don't care about
|
|
33
|
+
If you don't care about using newer module syntax, then you will not need this rule.
|
|
34
|
+
|
|
35
|
+
## Related To
|
|
36
|
+
|
|
37
|
+
- [`no-require-imports`](./no-require-imports.md)
|
|
@@ -6,11 +6,15 @@ description: 'Enforce non-null assertions over explicit type casts.'
|
|
|
6
6
|
>
|
|
7
7
|
> See **https://typescript-eslint.io/rules/non-nullable-type-assertion-style** for documentation.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
There are two common ways to assert to TypeScript that a value is its type without `null` or `undefined`:
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
- `!`: Non-null assertion
|
|
12
|
+
- `as`: Traditional type assertion with a coincidentally equivalent type
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
`!` non-null assertions are generally preferred for requiring less code and being harder to fall out of sync as types change.
|
|
15
|
+
This rule reports when an `as` cast is doing the same job as a `!` would, and suggests fixing the code to be an `!`.
|
|
16
|
+
|
|
17
|
+
## Examples
|
|
14
18
|
|
|
15
19
|
<!--tabs-->
|
|
16
20
|
|
|
@@ -6,7 +6,7 @@ description: 'Enforce consistent spacing inside braces.'
|
|
|
6
6
|
>
|
|
7
7
|
> See **https://typescript-eslint.io/rules/object-curly-spacing** for documentation.
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Examples
|
|
10
10
|
|
|
11
11
|
This rule extends the base [`eslint/object-curly-spacing`](https://eslint.org/docs/rules/object-curly-spacing) rule.
|
|
12
12
|
It adds support for TypeScript's object types.
|
package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/padding-line-between-statements.md
CHANGED
|
@@ -6,7 +6,7 @@ description: 'Require or disallow padding lines between statements.'
|
|
|
6
6
|
>
|
|
7
7
|
> See **https://typescript-eslint.io/rules/padding-line-between-statements** for documentation.
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Examples
|
|
10
10
|
|
|
11
11
|
This rule extends the base [`eslint/padding-line-between-statements`](https://eslint.org/docs/rules/padding-line-between-statements) rule.
|
|
12
12
|
It adds support for TypeScript constructs such as `interface` and `type`.
|
|
@@ -6,13 +6,10 @@ description: 'Require or disallow parameter properties in class constructors.'
|
|
|
6
6
|
>
|
|
7
7
|
> See **https://typescript-eslint.io/rules/parameter-properties** for documentation.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
of declaring and initializing class members.
|
|
9
|
+
TypeScript includes a "parameter properties" shorthand for declaring a class constructor parameter and class property in one location.
|
|
10
|
+
Parameter properties can be confusing to those new to TypeScript as they are less explicit than other ways of declaring and initializing class members.
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
This rule disallows the use of parameter properties in constructors, forcing the user to explicitly
|
|
15
|
-
declare all properties in the class.
|
|
12
|
+
This rule can be configured to always disallow the use of parameter properties or enforce their usage when possible.
|
|
16
13
|
|
|
17
14
|
## Options
|
|
18
15
|
|
|
@@ -6,11 +6,15 @@ description: 'Enforce the use of `as const` over literal type.'
|
|
|
6
6
|
>
|
|
7
7
|
> See **https://typescript-eslint.io/rules/prefer-as-const** for documentation.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
There are two common ways to tell TypeScript that a literal value should be interpreted as its literal type (e.g. `2`) rather than general primitive type (e.g. `number`);
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
- `as const`: telling TypeScript to infer the literal type automatically
|
|
12
|
+
- `as` with the literal type: explicitly telling the literal type to TypeScript
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
`as const` is generally preferred, as it doesn't require re-typing the literal value.
|
|
15
|
+
This rule reports when an `as` with an explicit literal type can be replaced with an `as const`.
|
|
16
|
+
|
|
17
|
+
## Examples
|
|
14
18
|
|
|
15
19
|
<!--tabs-->
|
|
16
20
|
|
package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-enum-initializers.md
CHANGED
|
@@ -6,32 +6,14 @@ description: 'Require each enum member value to be explicitly initialized.'
|
|
|
6
6
|
>
|
|
7
7
|
> See **https://typescript-eslint.io/rules/prefer-enum-initializers** for documentation.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
TypeScript `enum`s are a practical way to organize semantically related constant values.
|
|
10
|
+
Members of `enum`s that don't have explicit values are by default given sequentially increasing numbers.
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
In projects where the value of `enum` members are important, allowing implicit values for enums can cause bugs if `enum`s are modified over time.
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
This rule recommends having each `enum` member value explicitly initialized.
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
```ts
|
|
18
|
-
enum Status {
|
|
19
|
-
Open, // infer 0
|
|
20
|
-
Closed, // infer 1
|
|
21
|
-
}
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
If a new member is added to the top of `Status`, both `Open` and `Closed` would have its values altered:
|
|
25
|
-
|
|
26
|
-
```ts
|
|
27
|
-
enum Status {
|
|
28
|
-
Pending, // infer 0
|
|
29
|
-
Open, // infer 1
|
|
30
|
-
Closed, // infer 2
|
|
31
|
-
}
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
Examples of code for this rule:
|
|
16
|
+
## Examples
|
|
35
17
|
|
|
36
18
|
<!--tabs-->
|
|
37
19
|
|
|
@@ -6,39 +6,38 @@ description: 'Enforce the use of `for-of` loop over the standard `for` loop wher
|
|
|
6
6
|
>
|
|
7
7
|
> See **https://typescript-eslint.io/rules/prefer-for-of** for documentation.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
Many developers default to writing `for (let i = 0; i < ...` loops to iterate over arrays.
|
|
10
|
+
However, in many of those arrays, the loop iterator variable (e.g. `i`) is only used to access the respective element of the array.
|
|
11
|
+
In those cases, a `for-of` loop is easier to read and write.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
This rule recommends a for-of loop when the loop index is only used to read from an array that is being iterated.
|
|
14
14
|
|
|
15
|
-
Examples
|
|
15
|
+
## Examples
|
|
16
16
|
|
|
17
17
|
<!--tabs-->
|
|
18
18
|
|
|
19
19
|
### ❌ Incorrect
|
|
20
20
|
|
|
21
21
|
```js
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
declare const array: string[];
|
|
23
|
+
|
|
24
|
+
for (let i = 0; i < array.length; i++) {
|
|
25
|
+
console.log(array[i]);
|
|
24
26
|
}
|
|
25
27
|
```
|
|
26
28
|
|
|
27
29
|
### ✅ Correct
|
|
28
30
|
|
|
29
31
|
```js
|
|
30
|
-
|
|
31
|
-
console.log(x);
|
|
32
|
-
}
|
|
32
|
+
declare const array: string[];
|
|
33
33
|
|
|
34
|
-
for (
|
|
35
|
-
|
|
36
|
-
arr[i] = 0;
|
|
34
|
+
for (const x of array) {
|
|
35
|
+
console.log(x);
|
|
37
36
|
}
|
|
38
37
|
|
|
39
|
-
for (let i = 0; i <
|
|
40
|
-
// i is used
|
|
41
|
-
console.log(i,
|
|
38
|
+
for (let i = 0; i < array.length; i++) {
|
|
39
|
+
// i is used, so for-of could not be used.
|
|
40
|
+
console.log(i, array[i]);
|
|
42
41
|
}
|
|
43
42
|
```
|
|
44
43
|
|
|
@@ -6,36 +6,35 @@ description: 'Enforce using function types instead of interfaces with call signa
|
|
|
6
6
|
>
|
|
7
7
|
> See **https://typescript-eslint.io/rules/prefer-function-type** for documentation.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
TypeScript allows for two common ways to declare a type for a function:
|
|
10
|
+
|
|
11
|
+
- Function type: `() => string`
|
|
12
|
+
- Object type with a signature: `{ (): string }`
|
|
13
|
+
|
|
14
|
+
The function type form is generally preferred when possible for being more succinct.
|
|
10
15
|
|
|
11
16
|
This rule suggests using a function type instead of an interface or object type literal with a single call signature.
|
|
12
17
|
|
|
13
|
-
Examples
|
|
18
|
+
## Examples
|
|
14
19
|
|
|
15
20
|
<!--tabs-->
|
|
16
21
|
|
|
17
22
|
### ❌ Incorrect
|
|
18
23
|
|
|
19
24
|
```ts
|
|
20
|
-
interface
|
|
25
|
+
interface Example {
|
|
21
26
|
(): string;
|
|
22
27
|
}
|
|
23
28
|
```
|
|
24
29
|
|
|
25
30
|
```ts
|
|
26
|
-
function foo(
|
|
27
|
-
return
|
|
28
|
-
}
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
```ts
|
|
32
|
-
interface Foo extends Function {
|
|
33
|
-
(): void;
|
|
31
|
+
function foo(example: { (): number }): number {
|
|
32
|
+
return example();
|
|
34
33
|
}
|
|
35
34
|
```
|
|
36
35
|
|
|
37
36
|
```ts
|
|
38
|
-
interface
|
|
37
|
+
interface ReturnsSelf {
|
|
39
38
|
// returns the function itself, not the `this` argument.
|
|
40
39
|
(arg: string): this;
|
|
41
40
|
}
|
|
@@ -44,12 +43,20 @@ interface MixinMethod {
|
|
|
44
43
|
### ✅ Correct
|
|
45
44
|
|
|
46
45
|
```ts
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
type Example = () => string;
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
function foo(example: () => number): number {
|
|
51
|
+
return bar();
|
|
50
52
|
}
|
|
51
53
|
```
|
|
52
54
|
|
|
55
|
+
```ts
|
|
56
|
+
// returns the function itself, not the `this` argument.
|
|
57
|
+
type ReturnsSelf = (arg: string) => ReturnsSelf;
|
|
58
|
+
```
|
|
59
|
+
|
|
53
60
|
```ts
|
|
54
61
|
function foo(bar: { (): string; baz: number }): string {
|
|
55
62
|
return bar();
|
|
@@ -65,13 +72,6 @@ interface Bar extends Foo {
|
|
|
65
72
|
}
|
|
66
73
|
```
|
|
67
74
|
|
|
68
|
-
```ts
|
|
69
|
-
// returns the `this` argument of function, retaining it's type.
|
|
70
|
-
type MixinMethod = <TSelf>(this: TSelf, arg: string) => TSelf;
|
|
71
|
-
// a function that returns itself is much clearer in this form.
|
|
72
|
-
type ReturnsSelf = (arg: string) => ReturnsSelf;
|
|
73
|
-
```
|
|
74
|
-
|
|
75
75
|
```ts
|
|
76
76
|
// multiple call signatures (overloads) is allowed:
|
|
77
77
|
interface Overloaded {
|
|
@@ -6,34 +6,28 @@ description: 'Enforce `includes` method over `indexOf` method.'
|
|
|
6
6
|
>
|
|
7
7
|
> See **https://typescript-eslint.io/rules/prefer-includes** for documentation.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
ES2015 has added `String#includes` and ES2016 has added `Array#includes`.
|
|
13
|
-
It makes code more understandable if we use those `includes` methods for the purpose.
|
|
14
|
-
|
|
15
|
-
## Rule Details
|
|
16
|
-
|
|
17
|
-
This rule is aimed at suggesting `includes` method if `indexOf` method was used to check whether an object contains an arbitrary value or not.
|
|
18
|
-
|
|
19
|
-
If the receiver object of the `indexOf` method call has `includes` method and the two methods have the same parameters, this rule does suggestion.
|
|
20
|
-
There are such types: `String`, `Array`, `ReadonlyArray`, and typed arrays.
|
|
9
|
+
Prior to ES2015, `Array#indexOf` and `String#indexOf` comparisons against `-1` were the standard ways to check whether a value exists in an array or string, respectively.
|
|
10
|
+
Alternatives that are easier to read and write now exist: ES2015 added `String#includes` and ES2016 added `Array#includes`.
|
|
21
11
|
|
|
12
|
+
This rule reports when an `.indexOf` call can be replaced with an `.includes`.
|
|
22
13
|
Additionally, this rule reports the tests of simple regular expressions in favor of `String#includes`.
|
|
23
14
|
|
|
24
|
-
|
|
15
|
+
> This rule will report on any receiver object of an `indexOf` method call that has an `includes` method where the two methods have the same parameters.
|
|
16
|
+
> Matching types include: `String`, `Array`, `ReadonlyArray`, and typed arrays.
|
|
17
|
+
|
|
18
|
+
## Examples
|
|
25
19
|
|
|
26
20
|
<!--tabs-->
|
|
27
21
|
|
|
28
22
|
### ❌ Incorrect
|
|
29
23
|
|
|
30
24
|
```ts
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
25
|
+
const str: string;
|
|
26
|
+
const array: any[];
|
|
27
|
+
const readonlyArray: ReadonlyArray<any>;
|
|
28
|
+
const typedArray: UInt8Array;
|
|
29
|
+
const maybe: string;
|
|
30
|
+
const userDefined: {
|
|
37
31
|
indexOf(x: any): number;
|
|
38
32
|
includes(x: any): boolean;
|
|
39
33
|
};
|
|
@@ -45,32 +39,36 @@ typedArray.indexOf(value) > -1;
|
|
|
45
39
|
maybe?.indexOf('') !== -1;
|
|
46
40
|
userDefined.indexOf(value) >= 0;
|
|
47
41
|
|
|
48
|
-
|
|
49
|
-
/foo/.test(str);
|
|
42
|
+
/example/.test(str);
|
|
50
43
|
```
|
|
51
44
|
|
|
52
45
|
### ✅ Correct
|
|
53
46
|
|
|
54
47
|
```ts
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
48
|
+
const str: string;
|
|
49
|
+
const array: any[];
|
|
50
|
+
const readonlyArray: ReadonlyArray<any>;
|
|
51
|
+
const typedArray: UInt8Array;
|
|
52
|
+
const maybe: string;
|
|
53
|
+
const userDefined: {
|
|
59
54
|
indexOf(x: any): number;
|
|
60
55
|
includes(x: any): boolean;
|
|
61
56
|
};
|
|
62
|
-
let mismatchExample: {
|
|
63
|
-
indexOf(x: any, fromIndex?: number): number;
|
|
64
|
-
includes(x: any): boolean;
|
|
65
|
-
};
|
|
66
57
|
|
|
67
58
|
str.includes(value);
|
|
68
59
|
array.includes(value);
|
|
69
60
|
readonlyArray.includes(value);
|
|
70
61
|
typedArray.includes(value);
|
|
62
|
+
maybe?.includes('');
|
|
71
63
|
userDefined.includes(value);
|
|
72
64
|
|
|
73
|
-
|
|
65
|
+
str.includes('example');
|
|
66
|
+
|
|
67
|
+
// The two methods have different parameters.
|
|
68
|
+
declare const mismatchExample: {
|
|
69
|
+
indexOf(x: unknown, fromIndex?: number): number;
|
|
70
|
+
includes(x: unknown): boolean;
|
|
71
|
+
};
|
|
74
72
|
mismatchExample.indexOf(value) >= 0;
|
|
75
73
|
```
|
|
76
74
|
|
package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-literal-enum-member.md
CHANGED
|
@@ -6,7 +6,9 @@ description: 'Require all enum members to be literal values.'
|
|
|
6
6
|
>
|
|
7
7
|
> See **https://typescript-eslint.io/rules/prefer-literal-enum-member** for documentation.
|
|
8
8
|
|
|
9
|
-
TypeScript allows the value of an enum member to be many different kinds of valid JavaScript expressions.
|
|
9
|
+
TypeScript allows the value of an enum member to be many different kinds of valid JavaScript expressions.
|
|
10
|
+
However, because enums create their own scope whereby each enum member becomes a variable in that scope, developers are often surprised at the resultant values.
|
|
11
|
+
For example:
|
|
10
12
|
|
|
11
13
|
```ts
|
|
12
14
|
const imOutside = 2;
|
|
@@ -21,17 +23,12 @@ enum Foo {
|
|
|
21
23
|
}
|
|
22
24
|
```
|
|
23
25
|
|
|
24
|
-
The answer is that `Foo.c` will be `1` at runtime
|
|
26
|
+
> The answer is that `Foo.c` will be `1` at runtime [[TypeScript playground](https://www.typescriptlang.org/play/#src=const%20imOutside%20%3D%202%3B%0D%0Aconst%20b%20%3D%202%3B%0D%0Aenum%20Foo%20%7B%0D%0A%20%20%20%20outer%20%3D%20imOutside%2C%0D%0A%20%20%20%20a%20%3D%201%2C%0D%0A%20%20%20%20b%20%3D%20a%2C%0D%0A%20%20%20%20c%20%3D%20b%2C%0D%0A%20%20%20%20%2F%2F%20does%20c%20%3D%3D%20Foo.b%20%3D%3D%20Foo.c%20%3D%3D%201%3F%0D%0A%20%20%20%20%2F%2F%20or%20does%20c%20%3D%3D%20b%20%3D%3D%202%3F%0D%0A%7D)].
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
Therefore, it's often better to prevent unexpected results in code by requiring the use of literal values as enum members.
|
|
29
|
+
This rule reports when an enum member is given a value that is not a literal.
|
|
27
30
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
## Options
|
|
31
|
-
|
|
32
|
-
- `allowBitwiseExpressions` set to `true` will allow you to use bitwise expressions in enum initializer (Default: `false`).
|
|
33
|
-
|
|
34
|
-
Examples of code for this rule:
|
|
31
|
+
## Examples
|
|
35
32
|
|
|
36
33
|
<!--tabs-->
|
|
37
34
|
|
|
@@ -62,13 +59,15 @@ enum Valid {
|
|
|
62
59
|
|
|
63
60
|
<!--/tabs-->
|
|
64
61
|
|
|
65
|
-
|
|
62
|
+
## Options
|
|
63
|
+
|
|
64
|
+
- `allowBitwiseExpressions` set to `true` will allow you to use bitwise expressions in enum initializer (Default: `false`).
|
|
66
65
|
|
|
67
66
|
Examples of code for the `{ "allowBitwiseExpressions": true }` option:
|
|
68
67
|
|
|
69
68
|
<!--tabs-->
|
|
70
69
|
|
|
71
|
-
|
|
70
|
+
### ❌ Incorrect
|
|
72
71
|
|
|
73
72
|
```ts
|
|
74
73
|
const x = 1;
|
|
@@ -83,7 +82,7 @@ enum Foo {
|
|
|
83
82
|
}
|
|
84
83
|
```
|
|
85
84
|
|
|
86
|
-
|
|
85
|
+
### ✅ Correct
|
|
87
86
|
|
|
88
87
|
```ts
|
|
89
88
|
enum Foo {
|
package/node_modules/@typescript-eslint/eslint-plugin/docs/rules/prefer-namespace-keyword.md
CHANGED
|
@@ -6,12 +6,35 @@ description: 'Require using `namespace` keyword over `module` keyword to declare
|
|
|
6
6
|
>
|
|
7
7
|
> See **https://typescript-eslint.io/rules/prefer-namespace-keyword** for documentation.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
with TypeScript `v1.5` the keyword `namespace` is now the preferred way to declare custom TypeScript modules.
|
|
9
|
+
TypeScript historically allowed a form of code organization called "custom modules" (`module Example {}`), later renamed to "namespaces" (`namespace Example`).
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
Namespaces are an outdated way to organize TypeScript code.
|
|
12
|
+
ES2015 module syntax is now preferred (`import`/`export`).
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
For projects still using custom modules / namespaces, it's preferred to refer to them as namespaces.
|
|
15
|
+
This rule reports when the `module` keyword is used instead of `namespace`.
|
|
16
|
+
|
|
17
|
+
> This rule does not report on the use of TypeScript module declarations to describe external APIs (`declare module 'foo' {}`).
|
|
18
|
+
|
|
19
|
+
## Examples
|
|
20
|
+
|
|
21
|
+
<!--tabs-->
|
|
22
|
+
|
|
23
|
+
### ❌ Incorrect
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
module Example {}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### ✅ Correct
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
namespace Example {}
|
|
33
|
+
|
|
34
|
+
declare module 'foo' {}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
<!--/tabs-->
|
|
15
38
|
|
|
16
39
|
## When Not To Use It
|
|
17
40
|
|