eslint-plugin-ts-type-forge 0.8.3 → 0.8.4
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
CHANGED
|
@@ -44,7 +44,7 @@ export default [
|
|
|
44
44
|
rules: {
|
|
45
45
|
'ts-type-forge/prefer-canonical-length-constrained-tuple': [
|
|
46
46
|
'error',
|
|
47
|
-
{ importStyle: '
|
|
47
|
+
{ importStyle: 'global' },
|
|
48
48
|
],
|
|
49
49
|
} satisfies Partial<EslintTsTypeForgeRules>,
|
|
50
50
|
},
|
|
@@ -64,7 +64,12 @@ export default [
|
|
|
64
64
|
{
|
|
65
65
|
plugins: { 'ts-type-forge': eslintPluginTsTypeForge },
|
|
66
66
|
rules: {
|
|
67
|
-
'ts-type-forge/
|
|
67
|
+
'ts-type-forge/no-side-effect-import': 'error',
|
|
68
|
+
// A rule with options is typed to be given them.
|
|
69
|
+
'ts-type-forge/prefer-canonical-length-constrained-tuple': [
|
|
70
|
+
'error',
|
|
71
|
+
{},
|
|
72
|
+
],
|
|
68
73
|
} satisfies Partial<EslintTsTypeForgeRules>,
|
|
69
74
|
},
|
|
70
75
|
];
|
|
@@ -251,14 +256,10 @@ Either way, if the file already imports the target type from `ts-type-forge`
|
|
|
251
256
|
(possibly under an alias), the fix reuses that binding.
|
|
252
257
|
|
|
253
258
|
```ts
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
{ importStyle: 'named', maxLength: 6 },
|
|
259
|
-
],
|
|
260
|
-
},
|
|
261
|
-
}
|
|
259
|
+
'ts-type-forge/prefer-canonical-length-constrained-tuple': [
|
|
260
|
+
'error',
|
|
261
|
+
{ importStyle: 'named', maxLength: 6 },
|
|
262
|
+
],
|
|
262
263
|
```
|
|
263
264
|
|
|
264
265
|
## License
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rewrite-rule-utils.d.mts","sourceRoot":"","sources":["../../src/rules/rewrite-rule-utils.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAExE,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAKvE,kFAAkF;AAClF,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;IACjC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,sEAAsE;IACtE,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAU,SAAS,MAAM,WACjD,QAAQ,CAAC,WAAW,CAAC,UAAU,EAAE,SAAS,OAAO,EAAE,CAAC,YACnD,SAAS,WAAW,EAAE,aACrB,UAAU,eACR,WAAW,KACvB,
|
|
1
|
+
{"version":3,"file":"rewrite-rule-utils.d.mts","sourceRoot":"","sources":["../../src/rules/rewrite-rule-utils.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAExE,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAKvE,kFAAkF;AAClF,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;IACjC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,sEAAsE;IACtE,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAU,SAAS,MAAM,WACjD,QAAQ,CAAC,WAAW,CAAC,UAAU,EAAE,SAAS,OAAO,EAAE,CAAC,YACnD,SAAS,WAAW,EAAE,aACrB,UAAU,eACR,WAAW,KACvB,IAqCF,CAAC"}
|
|
@@ -19,9 +19,9 @@ export const reportTypeRewrites = (context, rewrites, messageId, importStyle) =>
|
|
|
19
19
|
|
|
20
20
|
return target === undefined ? [] : [{ rewrite, target }];
|
|
21
21
|
});
|
|
22
|
-
const importNames =
|
|
22
|
+
const importNames = Arr.uniq(resolved
|
|
23
23
|
.filter(({ target }) => target.needsImport)
|
|
24
|
-
.map(({ rewrite }) => rewrite.canonicalName))
|
|
24
|
+
.map(({ rewrite }) => rewrite.canonicalName));
|
|
25
25
|
for (const [index, { rewrite, target }] of resolved.entries()) {
|
|
26
26
|
const replacement = `${target.localName}<${rewrite.typeArgs}>`;
|
|
27
27
|
context.report({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rewrite-rule-utils.mjs","sourceRoot":"","sources":["../../src/rules/rewrite-rule-utils.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,eAAe,EAAoB,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAYxD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,OAA6D,EAC7D,QAAgC,EAChC,SAAqB,EACrB,WAAwB,EAClB,EAAE;IACR,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IAEtC,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC;IAE/B,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC5C,MAAM,MAAM,GAAG,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;QAE5E,2EAA2E;QAC3E,0CAA0C;QAC1C,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,
|
|
1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AAQ,GAAG,CAAC;QAE/D,OAAO,CAAC,MAAM,CAAC;YACb,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,SAAS;YACT,IAAI,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE;YACjE,GAAG,EAAE,CAAC,KAAK,EAAE,EAAE,CACb,GAAG,CAAC,QAAQ,CACV,KAAK,KAAK,CAAC;gBACT,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAC3B,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CACzC;gBACH,CAAC,CAAC,EAAE,EACN,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,CAC7C;SACJ,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-ts-type-forge",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "ESLint rules that steer type declarations toward ts-type-forge idioms.",
|
|
6
6
|
"keywords": [
|
|
@@ -35,21 +35,21 @@
|
|
|
35
35
|
"LICENSE"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@typescript-eslint/utils": "~8.
|
|
39
|
-
"ts-data-forge": "~14.7.
|
|
38
|
+
"@typescript-eslint/utils": "~8.70.0",
|
|
39
|
+
"ts-data-forge": "~14.7.1",
|
|
40
40
|
"ts-type-forge": "9.2.2"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@typescript-eslint/parser": "8.
|
|
44
|
-
"@typescript-eslint/rule-tester": "8.
|
|
43
|
+
"@typescript-eslint/parser": "8.70.0",
|
|
44
|
+
"@typescript-eslint/rule-tester": "8.70.0",
|
|
45
45
|
"dedent": "1.7.2",
|
|
46
|
-
"eslint-config-typed": "5.11.
|
|
47
|
-
"eslint-plugin-ts-data-forge": "0.
|
|
48
|
-
"eslint-plugin-ts-fortress": "1.2.
|
|
46
|
+
"eslint-config-typed": "5.11.9",
|
|
47
|
+
"eslint-plugin-ts-data-forge": "0.8.1",
|
|
48
|
+
"eslint-plugin-ts-fortress": "1.2.3",
|
|
49
49
|
"prettier": "3.9.6",
|
|
50
50
|
"prettier-plugin-organize-imports": "4.3.0",
|
|
51
51
|
"prettier-plugin-packagejson": "3.0.2",
|
|
52
|
-
"ts-repo-utils": "10.6.
|
|
52
|
+
"ts-repo-utils": "10.6.2"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"eslint": ">=9.0.0",
|
|
@@ -65,18 +65,19 @@
|
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ./scripts/cmd/build.mts",
|
|
68
|
-
"build:min": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ./scripts/cmd/build.mts --skip-check",
|
|
69
68
|
"check:ext": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ./scripts/cmd/check-ext.mts",
|
|
69
|
+
"doc": "pnpm run doc:embed",
|
|
70
|
+
"doc:embed": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ./scripts/cmd/embed-examples.mts",
|
|
70
71
|
"fmt": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ../../libs/ts-repo-utils/src/cmd/format-uncommitted.mts --cwd .",
|
|
71
72
|
"fmt:diff": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ../../libs/ts-repo-utils/src/cmd/format-diff-from.mts origin/main --cwd .",
|
|
72
73
|
"fmt:full": "pnpm run z:prettier .",
|
|
73
74
|
"gen:rule-types": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ./scripts/cmd/gen-rule-types.mts",
|
|
75
|
+
"gen:src": "pnpm run gen:rule-types",
|
|
74
76
|
"lint": "eslint .",
|
|
75
77
|
"lint:fix": "eslint . --fix",
|
|
76
78
|
"test": "pnpm run z:vitest run",
|
|
77
79
|
"test:cov": "pnpm run z:vitest run --coverage",
|
|
78
80
|
"testw": "pnpm run z:vitest",
|
|
79
|
-
"tsc": "node ../../node_modules/typescript-native/bin/tsc --noEmit",
|
|
80
81
|
"tscw": "node ../../node_modules/typescript-native/bin/tsc --noEmit --watch -p ./tsconfig.json",
|
|
81
82
|
"type-check": "node ../../node_modules/typescript-native/bin/tsc --noEmit",
|
|
82
83
|
"z:prettier": "prettier --config ../../.prettierrc --ignore-path ../../.prettierignore --ignore-path ../../.gitignore --ignore-unknown --no-error-on-unmatched-pattern --write",
|
|
@@ -40,12 +40,10 @@ export const reportTypeRewrites = <MessageIds extends string>(
|
|
|
40
40
|
return target === undefined ? [] : [{ rewrite, target }];
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
-
const importNames =
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
.map(({ rewrite }) => rewrite.canonicalName),
|
|
48
|
-
),
|
|
43
|
+
const importNames = Arr.uniq(
|
|
44
|
+
resolved
|
|
45
|
+
.filter(({ target }) => target.needsImport)
|
|
46
|
+
.map(({ rewrite }) => rewrite.canonicalName),
|
|
49
47
|
);
|
|
50
48
|
|
|
51
49
|
for (const [index, { rewrite, target }] of resolved.entries()) {
|