eslint-config-typed 3.5.2 → 3.7.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/README.md +2 -2
- package/dist/configs/browser.mjs +1 -0
- package/dist/configs/browser.mjs.map +1 -1
- package/dist/configs/cypress.mjs +1 -0
- package/dist/configs/cypress.mjs.map +1 -1
- package/dist/configs/jest.mjs +1 -0
- package/dist/configs/jest.mjs.map +1 -1
- package/dist/configs/nodejs.mjs +1 -0
- package/dist/configs/nodejs.mjs.map +1 -1
- package/dist/configs/playwright.mjs +1 -0
- package/dist/configs/playwright.mjs.map +1 -1
- package/dist/configs/plugins.d.mts +1 -1
- package/dist/configs/plugins.d.mts.map +1 -1
- package/dist/configs/plugins.mjs +3 -2
- package/dist/configs/plugins.mjs.map +1 -1
- package/dist/configs/react-base.mjs +1 -0
- package/dist/configs/react-base.mjs.map +1 -1
- package/dist/configs/testing-library.mjs +1 -0
- package/dist/configs/testing-library.mjs.map +1 -1
- package/dist/configs/typescript.d.mts.map +1 -1
- package/dist/configs/typescript.mjs +2 -0
- package/dist/configs/typescript.mjs.map +1 -1
- package/dist/configs/vitest.mjs +1 -0
- package/dist/configs/vitest.mjs.map +1 -1
- package/dist/entry-point.d.mts +1 -1
- package/dist/entry-point.d.mts.map +1 -1
- package/dist/entry-point.mjs +2 -1
- package/dist/entry-point.mjs.map +1 -1
- package/dist/index.mjs +2 -1
- package/dist/index.mjs.map +1 -1
- package/dist/plugins/index.d.mts +1 -1
- package/dist/plugins/index.d.mts.map +1 -1
- package/dist/plugins/index.mjs +1 -1
- package/dist/plugins/react-coding-style/rules/component-name.d.mts.map +1 -1
- package/dist/plugins/react-coding-style/rules/component-name.mjs.map +1 -1
- package/dist/plugins/react-coding-style/rules/import-style.d.mts.map +1 -1
- package/dist/plugins/react-coding-style/rules/import-style.mjs.map +1 -1
- package/dist/plugins/react-coding-style/rules/react-memo-props-argument-name.d.mts.map +1 -1
- package/dist/plugins/react-coding-style/rules/react-memo-props-argument-name.mjs.map +1 -1
- package/dist/plugins/react-coding-style/rules/react-memo-type-parameter.d.mts.map +1 -1
- package/dist/plugins/react-coding-style/rules/react-memo-type-parameter.mjs.map +1 -1
- package/dist/plugins/react-coding-style/rules/shared.d.mts.map +1 -1
- package/dist/plugins/react-coding-style/rules/shared.mjs.map +1 -1
- package/dist/plugins/strict-dependencies/rules/resolve-import-path.d.mts.map +1 -1
- package/dist/plugins/strict-dependencies/rules/resolve-import-path.mjs.map +1 -1
- package/dist/plugins/strict-dependencies/rules/strict-dependencies.d.mts.map +1 -1
- package/dist/plugins/strict-dependencies/rules/strict-dependencies.mjs.map +1 -1
- package/dist/plugins/total-functions/rules/no-hidden-type-assertions.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/no-hidden-type-assertions.mjs.map +1 -1
- package/dist/plugins/total-functions/rules/no-nested-fp-ts-effects.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/no-nested-fp-ts-effects.mjs.map +1 -1
- package/dist/plugins/total-functions/rules/no-partial-division.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/no-partial-division.mjs.map +1 -1
- package/dist/plugins/total-functions/rules/no-partial-url-constructor.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/no-partial-url-constructor.mjs.map +1 -1
- package/dist/plugins/total-functions/rules/no-premature-fp-ts-effects.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/no-premature-fp-ts-effects.mjs.map +1 -1
- package/dist/plugins/total-functions/rules/no-unsafe-mutable-readonly-assignment.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/no-unsafe-mutable-readonly-assignment.mjs.map +1 -1
- package/dist/plugins/total-functions/rules/no-unsafe-readonly-mutable-assignment.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/no-unsafe-readonly-mutable-assignment.mjs.map +1 -1
- package/dist/plugins/total-functions/rules/require-strict-mode.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/require-strict-mode.mjs.map +1 -1
- package/dist/plugins/total-functions/rules/unsafe-assignment-rule.d.mts.map +1 -1
- package/dist/plugins/total-functions/rules/unsafe-assignment-rule.mjs.map +1 -1
- package/dist/plugins/tree-shakable/rules/import-star.mjs.map +1 -1
- package/dist/plugins/ts-restrictions/index.d.mts +2 -0
- package/dist/plugins/ts-restrictions/index.d.mts.map +1 -0
- package/dist/plugins/ts-restrictions/index.mjs +2 -0
- package/dist/plugins/ts-restrictions/plugin.d.mts +3 -0
- package/dist/plugins/ts-restrictions/plugin.d.mts.map +1 -0
- package/dist/plugins/ts-restrictions/plugin.mjs +8 -0
- package/dist/plugins/ts-restrictions/plugin.mjs.map +1 -0
- package/dist/plugins/ts-restrictions/rules/index.d.mts.map +1 -0
- package/dist/plugins/ts-restrictions/rules/index.mjs +2 -0
- package/dist/plugins/ts-restrictions/rules/no-restricted-cast-name.d.mts +17 -0
- package/dist/plugins/ts-restrictions/rules/no-restricted-cast-name.d.mts.map +1 -0
- package/dist/plugins/ts-restrictions/rules/no-restricted-cast-name.mjs +171 -0
- package/dist/plugins/ts-restrictions/rules/no-restricted-cast-name.mjs.map +1 -0
- package/dist/plugins/{custom/rules/no-restricted-syntax2.d.mts → ts-restrictions/rules/no-restricted-syntax.d.mts} +1 -1
- package/dist/plugins/ts-restrictions/rules/no-restricted-syntax.d.mts.map +1 -0
- package/dist/plugins/{custom/rules/no-restricted-syntax2.mjs → ts-restrictions/rules/no-restricted-syntax.mjs} +1 -1
- package/dist/plugins/ts-restrictions/rules/no-restricted-syntax.mjs.map +1 -0
- package/dist/plugins/ts-restrictions/rules/rules.d.mts +14 -0
- package/dist/plugins/ts-restrictions/rules/rules.d.mts.map +1 -0
- package/dist/plugins/ts-restrictions/rules/rules.mjs +10 -0
- package/dist/plugins/ts-restrictions/rules/rules.mjs.map +1 -0
- package/dist/rules/eslint-import-rules.mjs +1 -1
- package/dist/rules/eslint-import-rules.mjs.map +1 -1
- package/dist/rules/eslint-stylistic-rules.d.mts +17 -1
- package/dist/rules/eslint-stylistic-rules.d.mts.map +1 -1
- package/dist/rules/eslint-stylistic-rules.mjs +27 -1
- package/dist/rules/eslint-stylistic-rules.mjs.map +1 -1
- package/dist/rules/eslint-ts-restrictions-rules.d.mts +5 -0
- package/dist/rules/eslint-ts-restrictions-rules.d.mts.map +1 -0
- package/dist/rules/eslint-ts-restrictions-rules.mjs +7 -0
- package/dist/rules/eslint-ts-restrictions-rules.mjs.map +1 -0
- package/dist/rules/index.d.mts +1 -0
- package/dist/rules/index.d.mts.map +1 -1
- package/dist/rules/index.mjs +1 -0
- package/dist/rules/index.mjs.map +1 -1
- package/dist/types/define-known-rules.d.mts +2 -2
- package/dist/types/define-known-rules.d.mts.map +1 -1
- package/dist/types/flat-config.d.mts.map +1 -1
- package/dist/types/rules/eslint-ts-restrictions-rules.d.mts +150 -0
- package/dist/types/rules/eslint-ts-restrictions-rules.d.mts.map +1 -0
- package/dist/types/rules/eslint-ts-restrictions-rules.mjs +2 -0
- package/dist/types/rules/eslint-ts-restrictions-rules.mjs.map +1 -0
- package/dist/types/rules/index.d.mts +1 -1
- package/dist/types/rules/index.d.mts.map +1 -1
- package/package.json +1 -1
- package/src/configs/plugins.mts +4 -3
- package/src/configs/typescript.mts +2 -0
- package/src/entry-point.mts +1 -1
- package/src/plugins/index.mts +1 -1
- package/src/plugins/react-coding-style/rules/component-name.mts +1 -0
- package/src/plugins/react-coding-style/rules/import-style.mts +1 -0
- package/src/plugins/react-coding-style/rules/react-memo-props-argument-name.mts +1 -0
- package/src/plugins/react-coding-style/rules/react-memo-type-parameter.mts +4 -0
- package/src/plugins/react-coding-style/rules/shared.mts +1 -0
- package/src/plugins/strict-dependencies/rules/resolve-import-path.mts +2 -0
- package/src/plugins/strict-dependencies/rules/resolve-import-path.test.mts +6 -0
- package/src/plugins/strict-dependencies/rules/strict-dependencies.mts +4 -0
- package/src/plugins/strict-dependencies/rules/strict-dependencies.test.mts +2 -0
- package/src/plugins/total-functions/rules/no-enums.test.mts +4 -3
- package/src/plugins/total-functions/rules/no-hidden-type-assertions.mts +3 -0
- package/src/plugins/total-functions/rules/no-hidden-type-assertions.test.mts +32 -31
- package/src/plugins/total-functions/rules/no-nested-fp-ts-effects.mts +1 -0
- package/src/plugins/total-functions/rules/no-nested-fp-ts-effects.test.mts +28 -27
- package/src/plugins/total-functions/rules/no-partial-array-reduce.test.mts +25 -24
- package/src/plugins/total-functions/rules/no-partial-division.mts +3 -0
- package/src/plugins/total-functions/rules/no-partial-division.test.mts +22 -21
- package/src/plugins/total-functions/rules/no-partial-string-normalize.test.mts +16 -15
- package/src/plugins/total-functions/rules/no-partial-url-constructor.mts +4 -0
- package/src/plugins/total-functions/rules/no-partial-url-constructor.test.mts +10 -9
- package/src/plugins/total-functions/rules/no-premature-fp-ts-effects.mts +1 -0
- package/src/plugins/total-functions/rules/no-premature-fp-ts-effects.test.mts +14 -13
- package/src/plugins/total-functions/rules/no-unsafe-mutable-readonly-assignment.mts +1 -0
- package/src/plugins/total-functions/rules/no-unsafe-mutable-readonly-assignment.test.mts +483 -482
- package/src/plugins/total-functions/rules/no-unsafe-readonly-mutable-assignment.mts +1 -0
- package/src/plugins/total-functions/rules/no-unsafe-readonly-mutable-assignment.test.mts +334 -333
- package/src/plugins/total-functions/rules/no-unsafe-type-assertion.test.mts +7 -6
- package/src/plugins/total-functions/rules/require-strict-mode.mts +1 -0
- package/src/plugins/total-functions/rules/unsafe-assignment-rule.mts +4 -0
- package/src/plugins/tree-shakable/rules/import-star.mts +8 -0
- package/src/plugins/tree-shakable/rules/import-star.test.mts +63 -62
- package/src/plugins/ts-restrictions/index.mts +1 -0
- package/src/plugins/ts-restrictions/plugin.mts +6 -0
- package/src/plugins/ts-restrictions/rules/no-restricted-cast-name.mts +234 -0
- package/src/plugins/ts-restrictions/rules/no-restricted-cast-name.test.mts +310 -0
- package/src/plugins/ts-restrictions/rules/rules.mts +8 -0
- package/src/rules/eslint-import-rules.mts +2 -2
- package/src/rules/eslint-stylistic-rules.mts +36 -2
- package/src/rules/eslint-ts-restrictions-rules.mts +6 -0
- package/src/rules/index.mts +1 -0
- package/src/types/define-known-rules.mts +3 -3
- package/src/types/flat-config.mts +0 -1
- package/src/types/rules/eslint-ts-restrictions-rules.mts +174 -0
- package/src/types/rules/index.mts +1 -1
- package/dist/plugins/custom/custom.d.mts +0 -3
- package/dist/plugins/custom/custom.d.mts.map +0 -1
- package/dist/plugins/custom/custom.mjs +0 -8
- package/dist/plugins/custom/custom.mjs.map +0 -1
- package/dist/plugins/custom/index.d.mts +0 -2
- package/dist/plugins/custom/index.d.mts.map +0 -1
- package/dist/plugins/custom/index.mjs +0 -2
- package/dist/plugins/custom/rules/index.d.mts.map +0 -1
- package/dist/plugins/custom/rules/index.mjs +0 -2
- package/dist/plugins/custom/rules/no-restricted-syntax2.d.mts.map +0 -1
- package/dist/plugins/custom/rules/no-restricted-syntax2.mjs.map +0 -1
- package/dist/plugins/custom/rules/rules.d.mts +0 -4
- package/dist/plugins/custom/rules/rules.d.mts.map +0 -1
- package/dist/plugins/custom/rules/rules.mjs +0 -8
- package/dist/plugins/custom/rules/rules.mjs.map +0 -1
- package/dist/types/rules/eslint-custom-rules.d.mts +0 -62
- package/dist/types/rules/eslint-custom-rules.d.mts.map +0 -1
- package/dist/types/rules/eslint-custom-rules.mjs +0 -2
- package/dist/types/rules/eslint-custom-rules.mjs.map +0 -1
- package/src/plugins/custom/custom.mts +0 -6
- package/src/plugins/custom/index.mts +0 -1
- package/src/plugins/custom/rules/rules.mts +0 -6
- package/src/types/rules/eslint-custom-rules.mts +0 -76
- /package/dist/plugins/{custom → ts-restrictions}/index.mjs.map +0 -0
- /package/dist/plugins/{custom → ts-restrictions}/rules/index.d.mts +0 -0
- /package/dist/plugins/{custom → ts-restrictions}/rules/index.mjs.map +0 -0
- /package/src/plugins/{custom → ts-restrictions}/rules/index.mts +0 -0
- /package/src/plugins/{custom/rules/no-restricted-syntax2.mts → ts-restrictions/rules/no-restricted-syntax.mts} +0 -0
package/dist/rules/index.mjs
CHANGED
|
@@ -21,6 +21,7 @@ export { eslintStylisticRules } from './eslint-stylistic-rules.mjs';
|
|
|
21
21
|
export { eslintTestingLibraryRules } from './eslint-testing-library-rules.mjs';
|
|
22
22
|
export { eslintTotalFunctionsRules } from './eslint-total-functions-rules.mjs';
|
|
23
23
|
export { eslintTreeShakableRules } from './eslint-tree-shakable-rules.mjs';
|
|
24
|
+
export { eslintCustomRules } from './eslint-ts-restrictions-rules.mjs';
|
|
24
25
|
export { eslintUnicornRules } from './eslint-unicorn-rules.mjs';
|
|
25
26
|
export { eslintVitestCodingStyleRules } from './eslint-vitest-coding-style-rules.mjs';
|
|
26
27
|
export { eslintVitestRules } from './eslint-vitest-rules.mjs';
|
package/dist/rules/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type EslintArrayFuncRules, type
|
|
2
|
-
type KnownRules = DeepReadonly<
|
|
1
|
+
import { type EslintArrayFuncRules, type EslintCypressRules, type EslintFunctionalRules, type EslintImportsRules, type EslintJestRules, type EslintJsxA11yRules, type EslintPlaywrightRules, type EslintPluginRules, type EslintPluginSortDestructureKeysRules, type EslintPreferArrowFunctionRules, type EslintPromiseRules, type EslintReactCodingStyleRules, type EslintReactHooksRules, type EslintReactPerfRules, type EslintReactRefreshRules, type EslintReactRules, type EslintRules, type EslintSecurityRules, type EslintStrictDependenciesRules, type EslintStylisticRules, type EslintTestingLibraryRules, type EslintTotalFunctionsRules, type EslintTreeShakableRules, type EslintTsRestrictionsRules, type EslintUnicornRules, type EslintVitestRules, type TypeScriptEslintRules } from './rules/index.mjs';
|
|
2
|
+
type KnownRules = DeepReadonly<EslintTsRestrictionsRules & EslintArrayFuncRules & EslintCypressRules & EslintFunctionalRules & EslintImportsRules & EslintJestRules & EslintJsxA11yRules & EslintPlaywrightRules & EslintPluginRules & EslintPluginSortDestructureKeysRules & EslintPreferArrowFunctionRules & EslintPromiseRules & EslintReactHooksRules & EslintReactPerfRules & EslintReactRefreshRules & EslintReactRules & EslintRules & EslintStylisticRules & EslintSecurityRules & EslintStrictDependenciesRules & EslintTestingLibraryRules & EslintTotalFunctionsRules & EslintTreeShakableRules & EslintUnicornRules & EslintVitestRules & EslintReactCodingStyleRules & TypeScriptEslintRules>;
|
|
3
3
|
export declare const defineKnownRules: (rules: Partial<KnownRules>) => Partial<KnownRules>;
|
|
4
4
|
export {};
|
|
5
5
|
//# sourceMappingURL=define-known-rules.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-known-rules.d.mts","sourceRoot":"","sources":["../../src/types/define-known-rules.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,
|
|
1
|
+
{"version":3,"file":"define-known-rules.d.mts","sourceRoot":"","sources":["../../src/types/define-known-rules.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,oCAAoC,EACzC,KAAK,8BAA8B,EACnC,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAChC,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,6BAA6B,EAClC,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC3B,MAAM,mBAAmB,CAAC;AAE3B,KAAK,UAAU,GAAG,YAAY,CAC5B,yBAAyB,GACvB,oBAAoB,GACpB,kBAAkB,GAClB,qBAAqB,GACrB,kBAAkB,GAClB,eAAe,GACf,kBAAkB,GAClB,qBAAqB,GACrB,iBAAiB,GACjB,oCAAoC,GACpC,8BAA8B,GAC9B,kBAAkB,GAClB,qBAAqB,GACrB,oBAAoB,GACpB,uBAAuB,GACvB,gBAAgB,GAChB,WAAW,GACX,oBAAoB,GACpB,mBAAmB,GACnB,6BAA6B,GAC7B,yBAAyB,GACzB,yBAAyB,GACzB,uBAAuB,GACvB,kBAAkB,GAClB,iBAAiB,GACjB,2BAA2B,GAC3B,qBAAqB,CACxB,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAC3B,OAAO,OAAO,CAAC,UAAU,CAAC,KACzB,OAAO,CAAC,UAAU,CAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flat-config.d.mts","sourceRoot":"","sources":["../../src/types/flat-config.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"flat-config.d.mts","sourceRoot":"","sources":["../../src/types/flat-config.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,KAAK,UAAU,IAAI,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAEpF,MAAM,MAAM,UAAU,GAAG,YAAY,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;AAE1D,MAAM,MAAM,YAAY,GAAG,YAAY,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;AAE5D,MAAM,MAAM,IAAI,GAAG,YAAY,CAAC,cAAc,CAAC,CAAC;AAGhD,MAAM,MAAM,KAAK,GAAG,cAAc,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { type Linter } from 'eslint';
|
|
2
|
+
type SpreadOptionsIfIsArray<T extends readonly [Linter.StringSeverity, unknown]> = T[1] extends readonly unknown[] ? readonly [Linter.StringSeverity, ...T[1]] : T;
|
|
3
|
+
/**
|
|
4
|
+
* Disallow type assertions with specified type names
|
|
5
|
+
*
|
|
6
|
+
* ```md
|
|
7
|
+
* | key | value |
|
|
8
|
+
* | :--------- | :------ |
|
|
9
|
+
* | type | problem |
|
|
10
|
+
* | deprecated | false |
|
|
11
|
+
* | fixable | code |
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
declare namespace NoRestrictedCastName {
|
|
15
|
+
/**
|
|
16
|
+
* ### schema
|
|
17
|
+
*
|
|
18
|
+
* ```json
|
|
19
|
+
* {
|
|
20
|
+
* "type": "array",
|
|
21
|
+
* "items": {
|
|
22
|
+
* "oneOf": [
|
|
23
|
+
* {
|
|
24
|
+
* "type": "string"
|
|
25
|
+
* },
|
|
26
|
+
* {
|
|
27
|
+
* "type": "object",
|
|
28
|
+
* "properties": {
|
|
29
|
+
* "name": {
|
|
30
|
+
* "type": "string"
|
|
31
|
+
* },
|
|
32
|
+
* "fixWith": {
|
|
33
|
+
* "type": "object",
|
|
34
|
+
* "oneOf": [
|
|
35
|
+
* {
|
|
36
|
+
* "type": "object",
|
|
37
|
+
* "properties": {
|
|
38
|
+
* "kind": {
|
|
39
|
+
* "type": "string",
|
|
40
|
+
* "enum": ["type"]
|
|
41
|
+
* },
|
|
42
|
+
* "name": {
|
|
43
|
+
* "type": "string"
|
|
44
|
+
* }
|
|
45
|
+
* },
|
|
46
|
+
* "required": ["kind", "name"],
|
|
47
|
+
* "additionalProperties": false
|
|
48
|
+
* },
|
|
49
|
+
* {
|
|
50
|
+
* "type": "object",
|
|
51
|
+
* "properties": {
|
|
52
|
+
* "kind": {
|
|
53
|
+
* "type": "string",
|
|
54
|
+
* "enum": ["function"]
|
|
55
|
+
* },
|
|
56
|
+
* "name": {
|
|
57
|
+
* "type": "string"
|
|
58
|
+
* }
|
|
59
|
+
* },
|
|
60
|
+
* "required": ["kind", "name"],
|
|
61
|
+
* "additionalProperties": false
|
|
62
|
+
* }
|
|
63
|
+
* ]
|
|
64
|
+
* }
|
|
65
|
+
* },
|
|
66
|
+
* "required": ["name"],
|
|
67
|
+
* "additionalProperties": false
|
|
68
|
+
* }
|
|
69
|
+
* ]
|
|
70
|
+
* },
|
|
71
|
+
* "uniqueItems": true,
|
|
72
|
+
* "minItems": 0
|
|
73
|
+
* }
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
/** @minItems 0 */
|
|
77
|
+
type Options = readonly (string | {
|
|
78
|
+
readonly name: string;
|
|
79
|
+
readonly fixWith?: {
|
|
80
|
+
readonly kind: 'function';
|
|
81
|
+
readonly name: string;
|
|
82
|
+
} | {
|
|
83
|
+
readonly kind: 'type';
|
|
84
|
+
readonly name: string;
|
|
85
|
+
};
|
|
86
|
+
})[];
|
|
87
|
+
type RuleEntry = Linter.Severity | SpreadOptionsIfIsArray<readonly [Linter.StringSeverity, Options]> | 'off';
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Disallow specified syntax
|
|
91
|
+
*
|
|
92
|
+
* @link https://eslint.org/docs/latest/rules/no-restricted-syntax
|
|
93
|
+
*
|
|
94
|
+
* ```md
|
|
95
|
+
* | key | value |
|
|
96
|
+
* | :---------- | :--------- |
|
|
97
|
+
* | type | suggestion |
|
|
98
|
+
* | deprecated | false |
|
|
99
|
+
* | recommended | false |
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
declare namespace NoRestrictedSyntax {
|
|
103
|
+
/**
|
|
104
|
+
* ### schema
|
|
105
|
+
*
|
|
106
|
+
* ```json
|
|
107
|
+
* {
|
|
108
|
+
* "type": "array",
|
|
109
|
+
* "items": {
|
|
110
|
+
* "oneOf": [
|
|
111
|
+
* {
|
|
112
|
+
* "type": "string"
|
|
113
|
+
* },
|
|
114
|
+
* {
|
|
115
|
+
* "type": "object",
|
|
116
|
+
* "properties": {
|
|
117
|
+
* "selector": {
|
|
118
|
+
* "type": "string"
|
|
119
|
+
* },
|
|
120
|
+
* "message": {
|
|
121
|
+
* "type": "string"
|
|
122
|
+
* }
|
|
123
|
+
* },
|
|
124
|
+
* "required": ["selector"],
|
|
125
|
+
* "additionalProperties": false
|
|
126
|
+
* }
|
|
127
|
+
* ]
|
|
128
|
+
* },
|
|
129
|
+
* "uniqueItems": true,
|
|
130
|
+
* "minItems": 0
|
|
131
|
+
* }
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
/** @minItems 0 */
|
|
135
|
+
type Options = readonly (string | {
|
|
136
|
+
readonly selector: string;
|
|
137
|
+
readonly message?: string;
|
|
138
|
+
})[];
|
|
139
|
+
type RuleEntry = Linter.Severity | SpreadOptionsIfIsArray<readonly [Linter.StringSeverity, Options]> | 'off';
|
|
140
|
+
}
|
|
141
|
+
export type EslintTsRestrictionsRules = {
|
|
142
|
+
readonly 'ts-restrictions/no-restricted-cast-name': NoRestrictedCastName.RuleEntry;
|
|
143
|
+
readonly 'ts-restrictions/no-restricted-syntax': NoRestrictedSyntax.RuleEntry;
|
|
144
|
+
};
|
|
145
|
+
export type EslintTsRestrictionsRulesOption = {
|
|
146
|
+
readonly 'ts-restrictions/no-restricted-cast-name': NoRestrictedCastName.Options;
|
|
147
|
+
readonly 'ts-restrictions/no-restricted-syntax': NoRestrictedSyntax.Options;
|
|
148
|
+
};
|
|
149
|
+
export {};
|
|
150
|
+
//# sourceMappingURL=eslint-ts-restrictions-rules.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eslint-ts-restrictions-rules.d.mts","sourceRoot":"","sources":["../../../src/types/rules/eslint-ts-restrictions-rules.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,KAAK,sBAAsB,CACzB,CAAC,SAAS,SAAS,CAAC,MAAM,CAAC,cAAc,EAAE,OAAO,CAAC,IACjD,CAAC,CAAC,CAAC,CAAC,SAAS,SAAS,OAAO,EAAE,GAC/B,SAAS,CAAC,MAAM,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GACzC,CAAC,CAAC;AAEN;;;;;;;;;;GAUG;AACH,kBAAU,oBAAoB,CAAC;IAC7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4DG;IACH,kBAAkB;IAClB,KAAY,OAAO,GAAG,SAAS,CAC3B,MAAM,GACN;QACE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,OAAO,CAAC,EACb;YACE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;YAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;SACvB,GACD;YACE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;YACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;SACvB,CAAC;KACP,CACJ,EAAE,CAAC;IAEJ,KAAY,SAAS,GACjB,MAAM,CAAC,QAAQ,GACf,sBAAsB,CAAC,SAAS,CAAC,MAAM,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC,GACjE,KAAK,CAAC;CACX;AAED;;;;;;;;;;;;GAYG;AACH,kBAAU,kBAAkB,CAAC;IAC3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,kBAAkB;IAClB,KAAY,OAAO,GAAG,SAAS,CAC3B,MAAM,GACN;QACE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;KAC3B,CACJ,EAAE,CAAC;IAEJ,KAAY,SAAS,GACjB,MAAM,CAAC,QAAQ,GACf,sBAAsB,CAAC,SAAS,CAAC,MAAM,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC,GACjE,KAAK,CAAC;CACX;AAED,MAAM,MAAM,yBAAyB,GAAG;IACtC,QAAQ,CAAC,yCAAyC,EAAE,oBAAoB,CAAC,SAAS,CAAC;IACnF,QAAQ,CAAC,sCAAsC,EAAE,kBAAkB,CAAC,SAAS,CAAC;CAC/E,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,QAAQ,CAAC,yCAAyC,EAAE,oBAAoB,CAAC,OAAO,CAAC;IACjF,QAAQ,CAAC,sCAAsC,EAAE,kBAAkB,CAAC,OAAO,CAAC;CAC7E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eslint-ts-restrictions-rules.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export * from './eslint-array-func-rules.mjs';
|
|
2
|
-
export * from './eslint-custom-rules.mjs';
|
|
3
2
|
export * from './eslint-cypress-rules.mjs';
|
|
4
3
|
export * from './eslint-functional-rules.mjs';
|
|
5
4
|
export * from './eslint-import-rules.mjs';
|
|
@@ -22,6 +21,7 @@ export * from './eslint-stylistic-rules.mjs';
|
|
|
22
21
|
export * from './eslint-testing-library-rules.mjs';
|
|
23
22
|
export * from './eslint-total-functions-rules.mjs';
|
|
24
23
|
export * from './eslint-tree-shakable-rules.mjs';
|
|
24
|
+
export * from './eslint-ts-restrictions-rules.mjs';
|
|
25
25
|
export * from './eslint-unicorn-rules.mjs';
|
|
26
26
|
export * from './eslint-vitest-coding-style-rules.mjs';
|
|
27
27
|
export * from './eslint-vitest-rules.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/types/rules/index.mts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/types/rules/index.mts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iDAAiD,CAAC;AAChE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uCAAuC,CAAC;AACtD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wCAAwC,CAAC;AACvD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wCAAwC,CAAC;AACvD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC"}
|
package/package.json
CHANGED
package/src/configs/plugins.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @stylistic/padding-line-between-statements */
|
|
1
2
|
/* eslint-disable import-x/no-rename-default */
|
|
2
3
|
|
|
3
4
|
import stylistic from '@stylistic/eslint-plugin';
|
|
@@ -50,11 +51,11 @@ import eslintPluginEslintPlugin from 'eslint-plugin-eslint-plugin';
|
|
|
50
51
|
// import eslintPluginTotalFunctions from 'eslint-plugin-total-functions';
|
|
51
52
|
// import eslintPluginTreeShakable from 'eslint-plugin-tree-shakable';
|
|
52
53
|
import {
|
|
53
|
-
eslintPluginCustom,
|
|
54
54
|
eslintPluginReactCodingStyle,
|
|
55
55
|
eslintPluginStrictDependencies,
|
|
56
56
|
eslintPluginTotalFunctions,
|
|
57
57
|
eslintPluginTreeShakable,
|
|
58
|
+
eslintPluginTsRestrictions,
|
|
58
59
|
eslintPluginVitestCodingStyle,
|
|
59
60
|
} from '../plugins/index.mjs';
|
|
60
61
|
|
|
@@ -85,7 +86,7 @@ export const plugins: Record<
|
|
|
85
86
|
| 'tree-shakable'
|
|
86
87
|
| 'total-functions'
|
|
87
88
|
| 'strict-dependencies'
|
|
88
|
-
| '
|
|
89
|
+
| 'ts-restrictions'
|
|
89
90
|
| 'react-coding-style'
|
|
90
91
|
| 'vitest-coding-style',
|
|
91
92
|
Omit<ESLintPlugin, 'configs'>
|
|
@@ -121,7 +122,7 @@ export const plugins: Record<
|
|
|
121
122
|
'tree-shakable': eslintPluginTreeShakable,
|
|
122
123
|
'total-functions': eslintPluginTotalFunctions,
|
|
123
124
|
'strict-dependencies': eslintPluginStrictDependencies,
|
|
124
|
-
|
|
125
|
+
'ts-restrictions': eslintPluginTsRestrictions,
|
|
125
126
|
'react-coding-style': eslintPluginReactCodingStyle,
|
|
126
127
|
'vitest-coding-style': eslintPluginVitestCodingStyle,
|
|
127
128
|
} as const satisfies FlatConfig['plugins'];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
eslintArrayFuncRules,
|
|
3
|
+
eslintCustomRules,
|
|
3
4
|
eslintFunctionalRules,
|
|
4
5
|
eslintImportsRules,
|
|
5
6
|
eslintPluginSortDestructureKeysRules,
|
|
@@ -50,6 +51,7 @@ export const eslintConfigForTypeScript = ({
|
|
|
50
51
|
...typescriptEslintRules,
|
|
51
52
|
...eslintTreeShakableRules,
|
|
52
53
|
...eslintPluginSortDestructureKeysRules,
|
|
54
|
+
...eslintCustomRules,
|
|
53
55
|
|
|
54
56
|
'strict-dependencies/strict-dependencies': ['error', []],
|
|
55
57
|
|
package/src/entry-point.mts
CHANGED
package/src/plugins/index.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './custom/index.mjs';
|
|
2
1
|
export * from './react-coding-style/index.mjs';
|
|
3
2
|
export * from './strict-dependencies/index.mjs';
|
|
4
3
|
export * from './total-functions/index.mjs';
|
|
5
4
|
export * from './tree-shakable/index.mjs';
|
|
5
|
+
export * from './ts-restrictions/index.mjs';
|
|
6
6
|
export * from './vitest-coding-style/index.mjs';
|
|
@@ -48,6 +48,7 @@ export const reactMemoTypeParameterRule: TSESLint.RuleModule<MessageIds> = {
|
|
|
48
48
|
node: castDeepMutable(node.callee),
|
|
49
49
|
messageId: 'requirePropsTypeParameter',
|
|
50
50
|
});
|
|
51
|
+
|
|
51
52
|
return;
|
|
52
53
|
}
|
|
53
54
|
|
|
@@ -56,6 +57,7 @@ export const reactMemoTypeParameterRule: TSESLint.RuleModule<MessageIds> = {
|
|
|
56
57
|
node: castDeepMutable(typeArguments),
|
|
57
58
|
messageId: 'omitTypeParameterWhenPropsEmpty',
|
|
58
59
|
});
|
|
60
|
+
|
|
59
61
|
return;
|
|
60
62
|
}
|
|
61
63
|
|
|
@@ -64,6 +66,7 @@ export const reactMemoTypeParameterRule: TSESLint.RuleModule<MessageIds> = {
|
|
|
64
66
|
node: castDeepMutable(typeArguments),
|
|
65
67
|
messageId: 'requirePropsTypeParameter',
|
|
66
68
|
});
|
|
69
|
+
|
|
67
70
|
return;
|
|
68
71
|
}
|
|
69
72
|
|
|
@@ -71,6 +74,7 @@ export const reactMemoTypeParameterRule: TSESLint.RuleModule<MessageIds> = {
|
|
|
71
74
|
|
|
72
75
|
if (!isPropsTypeReference(firstParameter)) {
|
|
73
76
|
const reportTarget = firstParameter ?? node.callee;
|
|
77
|
+
|
|
74
78
|
context.report({
|
|
75
79
|
node: castDeepMutable(reportTarget),
|
|
76
80
|
messageId: 'requirePropsTypeParameter',
|
|
@@ -21,6 +21,7 @@ export const getReactMemoArrowFunction = (
|
|
|
21
21
|
node: DeepReadonly<TSESTree.CallExpression>,
|
|
22
22
|
): DeepReadonly<TSESTree.ArrowFunctionExpression> | undefined => {
|
|
23
23
|
const [firstArgument] = node.arguments;
|
|
24
|
+
|
|
24
25
|
if (firstArgument === undefined) {
|
|
25
26
|
return undefined;
|
|
26
27
|
}
|
|
@@ -27,6 +27,7 @@ export const resolveImportPath = (
|
|
|
27
27
|
const matchedKey: string | undefined = Object.keys(pathIndexMap).find(
|
|
28
28
|
(k) => k === key,
|
|
29
29
|
);
|
|
30
|
+
|
|
30
31
|
// MEMO: pathIndexMapの指定がない場合 or 指定されているindexにアクセスしても値が得られない場合は[0]固定
|
|
31
32
|
const pathIndex =
|
|
32
33
|
matchedKey !== undefined ? pathIndexMap[matchedKey] : 0;
|
|
@@ -71,6 +72,7 @@ const readTsConfig = (tsconfigPath: string): ts.CompilerOptions | undefined => {
|
|
|
71
72
|
const basePath = ts.sys.directoryExists(tsconfigPath)
|
|
72
73
|
? tsconfigPath
|
|
73
74
|
: path.dirname(tsconfigPath);
|
|
75
|
+
|
|
74
76
|
const found = ts.findConfigFile(
|
|
75
77
|
basePath,
|
|
76
78
|
(filePath) => ts.sys.fileExists(filePath),
|
|
@@ -19,9 +19,11 @@ vi.mock(import('typescript'), async () => {
|
|
|
19
19
|
const actual = await vi.importActual<TypeScriptModule>('typescript');
|
|
20
20
|
// eslint-disable-next-line functional/immutable-data
|
|
21
21
|
actualFunctions.findConfigFile = actual.findConfigFile;
|
|
22
|
+
|
|
22
23
|
// eslint-disable-next-line functional/immutable-data
|
|
23
24
|
actualFunctions.getParsedCommandLineOfConfigFile =
|
|
24
25
|
actual.getParsedCommandLineOfConfigFile;
|
|
26
|
+
|
|
25
27
|
return {
|
|
26
28
|
...actual,
|
|
27
29
|
findConfigFile: vi.fn(actual.findConfigFile),
|
|
@@ -100,6 +102,7 @@ const restoreActual = (): void => {
|
|
|
100
102
|
actualFunctions.getParsedCommandLineOfConfigFile !== undefined
|
|
101
103
|
) {
|
|
102
104
|
mockFindConfigFile.mockImplementation(actualFunctions.findConfigFile);
|
|
105
|
+
|
|
103
106
|
mockGetParsedCommandLine.mockImplementation(
|
|
104
107
|
actualFunctions.getParsedCommandLineOfConfigFile,
|
|
105
108
|
);
|
|
@@ -115,6 +118,7 @@ const useFixture = (fixtureName: FixtureName | undefined): void => {
|
|
|
115
118
|
|
|
116
119
|
const compilerOptions = compilerOptionsByFixture[fixtureName];
|
|
117
120
|
mockFindConfigFile.mockImplementation(() => 'tsconfig.json');
|
|
121
|
+
|
|
118
122
|
mockGetParsedCommandLine.mockImplementation(() => ({
|
|
119
123
|
options: { ...compilerOptions },
|
|
120
124
|
fileNames: [],
|
|
@@ -213,6 +217,7 @@ describe(resolveImportPath, () => {
|
|
|
213
217
|
expect(resolveImportPath('components/aaa/bbb', undefined, {})).toBe(
|
|
214
218
|
'components/aaa/bbb',
|
|
215
219
|
);
|
|
220
|
+
|
|
216
221
|
expect(resolveImportPath(importPath, undefined, {})).toBe(expected);
|
|
217
222
|
|
|
218
223
|
useFixture(undefined);
|
|
@@ -227,6 +232,7 @@ describe(resolveImportPath, () => {
|
|
|
227
232
|
expect(resolveImportPath('components/aaa/bbb', undefined, {})).toBe(
|
|
228
233
|
'components/aaa/bbb',
|
|
229
234
|
);
|
|
235
|
+
|
|
230
236
|
expect(resolveImportPath('@/components/aaa/bbb', undefined, {})).toBe(
|
|
231
237
|
expected,
|
|
232
238
|
);
|
|
@@ -105,9 +105,11 @@ export const strictDependenciesRule: TSESLint.RuleModule<
|
|
|
105
105
|
return {
|
|
106
106
|
ImportDeclaration: (node: DeepReadonly<TSESTree.ImportDeclaration>) => {
|
|
107
107
|
const fileFullPath = context.filename;
|
|
108
|
+
|
|
108
109
|
const relativeFilePath = path.normalize(
|
|
109
110
|
path.relative(process.cwd(), fileFullPath),
|
|
110
111
|
);
|
|
112
|
+
|
|
111
113
|
const importPath = resolveImportPath(
|
|
112
114
|
node.source.value,
|
|
113
115
|
resolveRelativeImport === true ? relativeFilePath : undefined,
|
|
@@ -157,6 +159,7 @@ export const strictDependenciesRule: TSESLint.RuleModule<
|
|
|
157
159
|
dependency.targetMembers,
|
|
158
160
|
importedModules,
|
|
159
161
|
);
|
|
162
|
+
|
|
160
163
|
if (commonImportedList.length > 0) {
|
|
161
164
|
context.report({
|
|
162
165
|
node: castDeepMutable(node),
|
|
@@ -167,6 +170,7 @@ export const strictDependenciesRule: TSESLint.RuleModule<
|
|
|
167
170
|
},
|
|
168
171
|
});
|
|
169
172
|
}
|
|
173
|
+
|
|
170
174
|
continue;
|
|
171
175
|
}
|
|
172
176
|
|
|
@@ -91,6 +91,7 @@ describe('strictDependencies Rule', () => {
|
|
|
91
91
|
|
|
92
92
|
expect(messages).toHaveLength(1);
|
|
93
93
|
expect(messages[0]?.messageId).toBe('forbidden-import');
|
|
94
|
+
|
|
94
95
|
expect(messages[0]?.message).toBe(
|
|
95
96
|
`import '${normalize('src/components/ui/Text')}' is not allowed from ${normalize('src/components/test/aaa.ts')}.`,
|
|
96
97
|
);
|
|
@@ -105,6 +106,7 @@ describe('strictDependencies Rule', () => {
|
|
|
105
106
|
|
|
106
107
|
expect(messages).toHaveLength(1);
|
|
107
108
|
expect(messages[0]?.messageId).toBe('forbidden-import-specifier');
|
|
109
|
+
|
|
108
110
|
expect(messages[0]?.message).toBe(
|
|
109
111
|
`import specifier 'Text' is not allowed from ${normalize('src/components/button.tsx')}.`,
|
|
110
112
|
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import parser from '@typescript-eslint/parser';
|
|
2
2
|
import { RuleTester } from '@typescript-eslint/rule-tester';
|
|
3
3
|
import { AST_NODE_TYPES } from '@typescript-eslint/utils';
|
|
4
|
+
import dedent from 'dedent';
|
|
4
5
|
import { noEnums } from './no-enums.mjs';
|
|
5
6
|
|
|
6
7
|
const ruleTester = new RuleTester({
|
|
@@ -18,7 +19,7 @@ ruleTester.run<'errorStringGeneric', readonly []>('no-enums', noEnums, {
|
|
|
18
19
|
invalid: [
|
|
19
20
|
{
|
|
20
21
|
filename: 'file.ts',
|
|
21
|
-
code: `
|
|
22
|
+
code: dedent`
|
|
22
23
|
enum ZeroOrOne {
|
|
23
24
|
Zero = 0,
|
|
24
25
|
One = 1,
|
|
@@ -33,7 +34,7 @@ ruleTester.run<'errorStringGeneric', readonly []>('no-enums', noEnums, {
|
|
|
33
34
|
},
|
|
34
35
|
{
|
|
35
36
|
filename: 'file.ts',
|
|
36
|
-
code: `
|
|
37
|
+
code: dedent`
|
|
37
38
|
enum ZeroOrOne {
|
|
38
39
|
Zero,
|
|
39
40
|
One,
|
|
@@ -48,7 +49,7 @@ ruleTester.run<'errorStringGeneric', readonly []>('no-enums', noEnums, {
|
|
|
48
49
|
},
|
|
49
50
|
{
|
|
50
51
|
filename: 'file.ts',
|
|
51
|
-
code: `
|
|
52
|
+
code: dedent`
|
|
52
53
|
enum AOrB {
|
|
53
54
|
A = "A",
|
|
54
55
|
B = "B",
|
|
@@ -107,6 +107,7 @@ export const noHiddenTypeAssertions = createRule({
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
const typeParameters = callSignature.declaration.typeParameters;
|
|
110
|
+
|
|
110
111
|
const parameters = parametersToTypeNodes(
|
|
111
112
|
callSignature.declaration.parameters,
|
|
112
113
|
0,
|
|
@@ -144,6 +145,7 @@ export const noHiddenTypeAssertions = createRule({
|
|
|
144
145
|
const allCorrespondingTypeArgumentsAreUnknownType =
|
|
145
146
|
typeParamsUsedInReturnType.every(({ index, typeParameter }) => {
|
|
146
147
|
const typeArgument = (tsExpressionNode.typeArguments ?? [])[index];
|
|
148
|
+
|
|
147
149
|
const typeArgumentType =
|
|
148
150
|
typeArgument !== undefined
|
|
149
151
|
? checker.getTypeAtLocation(typeArgument)
|
|
@@ -200,6 +202,7 @@ const hasTypeNode = (
|
|
|
200
202
|
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
201
203
|
const typeAttr = (typeElement as Partial<Readonly<{ type: TypeNode }>>)
|
|
202
204
|
.type;
|
|
205
|
+
|
|
203
206
|
return typeAttr !== undefined && isTypeNode(typeAttr);
|
|
204
207
|
} catch {
|
|
205
208
|
return false;
|