eslint-rule-forge 0.4.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -21
- package/dist/bindings.d.mts +12 -7
- package/dist/bindings.d.mts.map +1 -1
- package/dist/bindings.mjs +32 -2
- package/dist/bindings.mjs.map +1 -1
- package/dist/imports.d.mts +36 -17
- package/dist/imports.d.mts.map +1 -1
- package/dist/imports.mjs +92 -13
- package/dist/imports.mjs.map +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -1
- package/dist/negation.d.mts +8 -9
- package/dist/negation.d.mts.map +1 -1
- package/dist/negation.mjs +18 -18
- package/dist/negation.mjs.map +1 -1
- package/dist/rules/prefer-is-non-null-object.mjs +51 -51
- package/dist/rules/prefer-is-non-null-object.mjs.map +1 -1
- package/dist/rules/prefer-safe-parse.d.mts +10 -7
- package/dist/rules/prefer-safe-parse.d.mts.map +1 -1
- package/dist/rules/prefer-safe-parse.mjs +41 -26
- package/dist/rules/prefer-safe-parse.mjs.map +1 -1
- package/dist/statements.d.mts +12 -0
- package/dist/statements.d.mts.map +1 -0
- package/dist/statements.mjs +39 -0
- package/dist/statements.mjs.map +1 -0
- package/dist/type-wrappers.d.mts +3 -3
- package/package.json +6 -6
- package/src/bindings.mts +47 -8
- package/src/imports.mts +181 -37
- package/src/index.mts +1 -0
- package/src/negation.mts +36 -37
- package/src/rules/prefer-is-non-null-object.mts +70 -70
- package/src/rules/prefer-is-record-and-has-key.mts +5 -5
- package/src/rules/prefer-safe-parse.mts +72 -50
- package/src/statements.mts +57 -0
- package/src/type-wrappers.mts +3 -3
package/README.md
CHANGED
|
@@ -121,20 +121,28 @@ The range and the text of a node leave out the parentheses written around it.
|
|
|
121
121
|
| `getRangeWithParens` | the node's range including them |
|
|
122
122
|
| `getArgumentText` | the node's text for an argument list, `(a, b)` kept as one argument |
|
|
123
123
|
|
|
124
|
+
## Statements
|
|
125
|
+
|
|
126
|
+
| Helper | What it gives |
|
|
127
|
+
| :---------- | :------------------------------------------------------------------------------------------- |
|
|
128
|
+
| `siblingOf` | the statement after (`1`) or before (`-1`) a node in its statement list, through an `export` |
|
|
129
|
+
|
|
124
130
|
## Imports and bindings
|
|
125
131
|
|
|
126
|
-
| Helper | What it gives
|
|
127
|
-
| :---------------------- |
|
|
128
|
-
| `getImportDeclarations` | every `import … from '<module>'` in the file, not only the first
|
|
129
|
-
| `getNamedImports` | the export names those declarations import
|
|
130
|
-
| `getImportedLocalName` | the local name an export is imported as (`'y'` for `import { x as y }`)
|
|
131
|
-
| `importedNameOf` | the export name an import specifier imports (`'x'` for `import { x as y }`)
|
|
132
|
-
| `buildCalleeResolver` | which export a callee calls, through aliases, namespace imports and type wrappers
|
|
133
|
-
| `bindValueImports` | the local names to write for exports, and the edits binding them as values (in the existing import)
|
|
134
|
-
| `buildNamedImportFix` | a fix inserting a new `import { … } from '<module>';` after the directive prologue
|
|
135
|
-
| `
|
|
136
|
-
| `
|
|
137
|
-
| `
|
|
132
|
+
| Helper | What it gives |
|
|
133
|
+
| :---------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
134
|
+
| `getImportDeclarations` | every `import … from '<module>'` in the file, not only the first |
|
|
135
|
+
| `getNamedImports` | the export names those declarations import |
|
|
136
|
+
| `getImportedLocalName` | the local name an export is imported as (`'y'` for `import { x as y }`) |
|
|
137
|
+
| `importedNameOf` | the export name an import specifier imports (`'x'` for `import { x as y }`) |
|
|
138
|
+
| `buildCalleeResolver` | which export a callee calls, through aliases, namespace imports and type wrappers |
|
|
139
|
+
| `bindValueImports` | the local names to write for exports, and the edits binding them as values (in the existing import) |
|
|
140
|
+
| `buildNamedImportFix` | a fix inserting a new `import { … } from '<module>';` after the directive prologue |
|
|
141
|
+
| `addTypeImports` | the edits importing types: into an `import type { … }`, else as `type X` into another import |
|
|
142
|
+
| `addToImportBraces` | a fix adding specifiers to a declaration's braces, empty ones included, or `undefined` without any |
|
|
143
|
+
| `hasForeignBinding` | whether a name, at a node, is bound to something other than the module's import (a fix must give up); a nested type-only binding does not count |
|
|
144
|
+
| `isLocallyBound` | whether a name, at a node, is declared in the file rather than a global or a standard-library type |
|
|
145
|
+
| `hasCommentWithin` | whether a comment inside a node lies in ranges a fix would delete (the fix must give up) |
|
|
138
146
|
|
|
139
147
|
```ts
|
|
140
148
|
import type { TSESLint } from '@typescript-eslint/utils';
|
|
@@ -212,18 +220,18 @@ export const preferIsNullish: TSESLint.RuleModule<'preferIsNullish'> = {
|
|
|
212
220
|
## Rule factories
|
|
213
221
|
|
|
214
222
|
Rules that several plugins carry, differing only in the module whose functions
|
|
215
|
-
the fix writes. Each factory takes the module name (and the namespace the
|
|
223
|
+
the fix or suggestion writes. Each factory takes the module name (and the namespace the
|
|
216
224
|
function is reached through, where there is one) and returns a complete rule,
|
|
217
225
|
so that a fix to the rule reaches every plugin that builds it.
|
|
218
226
|
|
|
219
|
-
| Factory | The rule it builds
|
|
220
|
-
| :------------------------------ |
|
|
221
|
-
| `createPreferIsNonNullObject` | `typeof u === 'object' && u !== null` → `isNonNullObject(u)`
|
|
222
|
-
| `createPreferIsRecordAndHasKey` | `Object.hasOwn(obj, key)` and `key in obj` → `isRecord(obj) && hasKey(obj, key)`, or `hasKey` on a record
|
|
223
|
-
| `createPreferArrayIsArray` | `Array.isArray` → `<namespace>.isArray`
|
|
224
|
-
| `createPreferSafeParseInt` | `parseInt(x)`, `parseInt(x, 10)` → `Result.unwrapOkOr(<namespace>.<method>(x), Number.NaN)
|
|
225
|
-
| `createPreferSafeParseFloat` | `parseFloat(x)`, `Number.parseFloat(x)`, `Number(x)` → the same, for a `string` `x
|
|
226
|
-
| `createNoSideEffectImport` | removes `import '<module>';`, with the reason the caller gives
|
|
227
|
+
| Factory | The rule it builds |
|
|
228
|
+
| :------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
229
|
+
| `createPreferIsNonNullObject` | `typeof u === 'object' && u !== null` → `isNonNullObject(u)` |
|
|
230
|
+
| `createPreferIsRecordAndHasKey` | `Object.hasOwn(obj, key)` and `key in obj` → `isRecord(obj) && hasKey(obj, key)`, or `hasKey` on a record |
|
|
231
|
+
| `createPreferArrayIsArray` | `Array.isArray` → `<namespace>.isArray` |
|
|
232
|
+
| `createPreferSafeParseInt` | `parseInt(x)`, `parseInt(x, 10)` → `Result.unwrapOkOr(<namespace>.<method>(x), Number.NaN)`, as a suggestion only, since some strings parse differently |
|
|
233
|
+
| `createPreferSafeParseFloat` | `parseFloat(x)`, `Number.parseFloat(x)`, `Number(x)` → the same, for a `string` `x`, also a suggestion only |
|
|
234
|
+
| `createNoSideEffectImport` | removes `import '<module>';`, with the reason the caller gives |
|
|
227
235
|
|
|
228
236
|
## License
|
|
229
237
|
|
package/dist/bindings.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TSESLint, type TSESTree } from '@typescript-eslint/utils';
|
|
2
2
|
/**
|
|
3
|
-
* Whether `name`, read at `node`, resolves to something this file writes down
|
|
4
|
-
*
|
|
3
|
+
* Whether `name`, read at `node`, resolves to something this file writes down —
|
|
4
|
+
* a declaration, a parameter, an import — rather than to a global or a
|
|
5
5
|
* standard-library type of the same name.
|
|
6
6
|
*
|
|
7
7
|
* The scope manager makes an implicit variable for every reference it cannot
|
|
@@ -12,12 +12,17 @@ export declare const isLocallyBound: (sourceCode: TSESLint.SourceCode, node: TSE
|
|
|
12
12
|
/**
|
|
13
13
|
* Whether `name`, read at `node`, resolves to a binding that is not an import
|
|
14
14
|
* from `moduleName` — a declaration, a parameter, or an import from another
|
|
15
|
-
* module. A fix that makes code at `node` refer to `moduleName`'s export
|
|
16
|
-
*
|
|
17
|
-
* instead.
|
|
15
|
+
* module. A fix that makes code at `node` refer to `moduleName`'s export `name`
|
|
16
|
+
* has to give up then, because the name would refer to that binding instead.
|
|
18
17
|
*
|
|
19
18
|
* The innermost binding decides: an import from `moduleName` at the top of the
|
|
20
|
-
* file does not help a name a function shadows around `node`.
|
|
19
|
+
* file does not help a name a function shadows around `node`. A binding with no
|
|
20
|
+
* value meaning inside the file — a type parameter, a local type alias or
|
|
21
|
+
* interface — is passed over, since a type does not shadow a value or the head
|
|
22
|
+
* of a qualified name. At the top of the file it still counts: the import a fix
|
|
23
|
+
* adds there conflicts with it when the export has a type meaning too. A fix
|
|
24
|
+
* that writes the name alone in a type position, where such a binding does
|
|
25
|
+
* capture it, has to check for one itself.
|
|
21
26
|
*/
|
|
22
27
|
export declare const hasForeignBinding: (sourceCode: TSESLint.SourceCode, node: TSESTree.Node, name: string, moduleName: string) => boolean;
|
|
23
28
|
//# sourceMappingURL=bindings.d.mts.map
|
package/dist/bindings.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bindings.d.mts","sourceRoot":"","sources":["../src/bindings.mts"],"names":[],"mappings":"AAAA,OAAO,EAGL,
|
|
1
|
+
{"version":3,"file":"bindings.d.mts","sourceRoot":"","sources":["../src/bindings.mts"],"names":[],"mappings":"AAAA,OAAO,EAGL,QAAQ,EACR,KAAK,QAAQ,EACd,MAAM,0BAA0B,CAAC;AAIlC;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,eACb,QAAQ,CAAC,UAAU,QACzB,QAAQ,CAAC,IAAI,QACb,MAAM,KACX,OAIF,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB,eAChB,QAAQ,CAAC,UAAU,QACzB,QAAQ,CAAC,IAAI,QACb,MAAM,cACA,MAAM,KACjB,OAIF,CAAC"}
|
package/dist/bindings.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AST_NODE_TYPES, ASTUtils, } from '@typescript-eslint/utils';
|
|
1
|
+
import { AST_NODE_TYPES, ASTUtils, TSESLint, } from '@typescript-eslint/utils';
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
@@ -23,14 +23,44 @@ export const isLocallyBound = (sourceCode, node, name) => {
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
26
31
|
export const hasForeignBinding = (sourceCode, node, name, moduleName) => {
|
|
27
|
-
const variable =
|
|
32
|
+
const variable = findShadowingVariable(sourceCode.getScope(node), name);
|
|
28
33
|
return variable?.defs.some((def) => !isImportFrom(def, moduleName)) ?? false;
|
|
29
34
|
};
|
|
30
35
|
|
|
31
36
|
|
|
32
37
|
|
|
33
38
|
|
|
39
|
+
|
|
40
|
+
const isTypeOnly = (variable) => variable.defs.length > 0 &&
|
|
41
|
+
variable.defs.every((def) => def.type === TSESLint.Scope.DefinitionType.Type);
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
const isTopLevel = (scope) => scope.block.type === AST_NODE_TYPES.Program;
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
const findShadowingVariable = (scope, name) => {
|
|
53
|
+
const variable = scope.set.get(name);
|
|
54
|
+
return variable !== undefined && (!isTypeOnly(variable) || isTopLevel(scope))
|
|
55
|
+
? variable
|
|
56
|
+
: scope.upper === null
|
|
57
|
+
? undefined
|
|
58
|
+
: findShadowingVariable(scope.upper, name);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
34
64
|
const isImportFrom = (def, moduleName) => (def.node.type === AST_NODE_TYPES.ImportSpecifier ||
|
|
35
65
|
def.node.type === AST_NODE_TYPES.ImportDefaultSpecifier ||
|
|
36
66
|
def.node.type === AST_NODE_TYPES.ImportNamespaceSpecifier) &&
|
package/dist/bindings.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bindings.mjs","sourceRoot":"","sources":["../src/bindings.mts"],"names":[],"mapp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AA2B,EAAW,EAAE,CAC1D,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,cAAc,CAAC,OAAO,CAAC;AAE9C;;;;GAIG;AACH,MAAM,qBAAqB,GAAG,CAC5B,KAA2B,EAC3B,IAAY,EACyB,EAAE;IACvC,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAErC,OAAO,QAAQ,KAAK,SAAS,IAAI,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;QAC3E,CAAC,CAAC,QAAQ;QACV,CAAC,CAAC,KAAK,CAAC,KAAK,KAAK,IAAI;YACpB,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,qBAAqB,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACjD,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,YAAY,GAAG,CACnB,GAA8B,EAC9B,UAAkB,EACT,EAAE,CACX,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC,eAAe;IAC/C,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC,sBAAsB;IACvD,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC,wBAAwB,CAAC;IAC5D,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,cAAc,CAAC,iBAAiB;IACzD,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,KAAK,UAAU,CAAC"}
|
package/dist/imports.d.mts
CHANGED
|
@@ -22,8 +22,8 @@ export type ResolvedCallee = Readonly<{
|
|
|
22
22
|
/** The exported name, whatever the callee calls it locally. */
|
|
23
23
|
canonicalName: string;
|
|
24
24
|
/**
|
|
25
|
-
* The identifier to rewrite to change what is called: the callee itself for
|
|
26
|
-
*
|
|
25
|
+
* The identifier to rewrite to change what is called: the callee itself for a
|
|
26
|
+
* named import, the property for a namespace import.
|
|
27
27
|
*/
|
|
28
28
|
propertyNode: TSESTree.Identifier;
|
|
29
29
|
/** Whether the call goes through a namespace import (`m.f(...)`). */
|
|
@@ -46,12 +46,11 @@ export declare const buildCalleeResolver: (declarations: DeepReadonly<TSESTree.I
|
|
|
46
46
|
* as given, so `type T` imports a type.
|
|
47
47
|
*
|
|
48
48
|
* Use it only when the file does not import from `moduleName` by name;
|
|
49
|
-
* {@link bindValueImports} adds to an existing declaration instead, which
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* dropped.
|
|
49
|
+
* {@link bindValueImports} adds to an existing declaration instead, which keeps
|
|
50
|
+
* `import-x/no-duplicates` satisfied, and falls back to this. An import sorter
|
|
51
|
+
* orders the declaration afterwards. Put every name one report needs into a
|
|
52
|
+
* single call: ESLint merges the fixes of one report into one edit, and two
|
|
53
|
+
* fixes inserting at the same place conflict, so that one of them is dropped.
|
|
55
54
|
*/
|
|
56
55
|
export declare const buildNamedImportFix: (fixer: TSESLint.RuleFixer, program: TSESTree.Program, moduleName: string, specifiers: readonly string[]) => readonly TSESLint.RuleFix[];
|
|
57
56
|
/**
|
|
@@ -62,10 +61,12 @@ export declare const buildNamedImportFix: (fixer: TSESLint.RuleFixer, program: T
|
|
|
62
61
|
* - Imported as a value: that local name, and no edit.
|
|
63
62
|
* - Imported by `import { type x }`: the edit drops `type`, keeping a comment
|
|
64
63
|
* after it.
|
|
65
|
-
* - Not imported: the edit adds it to the first
|
|
66
|
-
* that has a value specifier, or else
|
|
67
|
-
* not `import type
|
|
68
|
-
* `import
|
|
64
|
+
* - Not imported: the edit adds it to the braces of the first import from the
|
|
65
|
+
* module that has a value specifier, or else of the first other one with
|
|
66
|
+
* braces that is not `import type`, empty braces included (`import {}`,
|
|
67
|
+
* `import D, {}`).
|
|
68
|
+
* Adding it there rather than in a new declaration keeps
|
|
69
|
+
* `import-x/no-duplicates` satisfied. Failing that, it goes into new braces
|
|
69
70
|
* after a lone default import (`import D, { x }`), and when the module has
|
|
70
71
|
* neither, a new declaration goes after the directive prologue
|
|
71
72
|
* ({@link buildNamedImportFix}).
|
|
@@ -75,14 +76,32 @@ export declare const buildNamedImportFix: (fixer: TSESLint.RuleFixer, program: T
|
|
|
75
76
|
*
|
|
76
77
|
* ESLint's default parser leaves `importKind` out, which counts as a value
|
|
77
78
|
* import. Every name a fix writes is bound by that fix's own edits rather than
|
|
78
|
-
* left to another report's: an editor applies one fix at a time, and a fix
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
79
|
+
* left to another report's: an editor applies one fix at a time, and a fix that
|
|
80
|
+
* loses a conflict with another in the same pass is dropped. Fixes that all add
|
|
81
|
+
* a name overlap, so `--fix` applies one per pass, and the rest in the next, by
|
|
82
|
+
* when the file imports it. Whether something other than an import binds the
|
|
83
|
+
* name where it is written is the caller's to check
|
|
83
84
|
* ({@link hasForeignBinding}).
|
|
84
85
|
*/
|
|
85
86
|
export declare const bindValueImports: (sourceCode: TSESLint.SourceCode, moduleName: string, exportNames: readonly string[]) => ValueImportBinding | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* The edits that import `moduleName`'s types `names` the file does not import
|
|
89
|
+
* yet: added to an existing `import type { … }` from the module (`, X`), else
|
|
90
|
+
* as `type X` to another import from it, chosen as {@link bindValueImports}
|
|
91
|
+
* chooses one, and only failing those as a new
|
|
92
|
+
* `import { type X } from '<module>'` after the directive prologue. Adding to
|
|
93
|
+
* an existing declaration keeps `import-x/no-duplicates` satisfied. Whether the
|
|
94
|
+
* file binds a name to something else is the caller's to check.
|
|
95
|
+
*/
|
|
96
|
+
export declare const addTypeImports: (fixer: TSESLint.RuleFixer, sourceCode: TSESLint.SourceCode, moduleName: string, names: readonly string[]) => readonly TSESLint.RuleFix[];
|
|
97
|
+
/**
|
|
98
|
+
* Adds `specifiers` to the `{ … }` of `declaration`: after its last named
|
|
99
|
+
* specifier, or inside empty braces (`import d, {} from …`). `undefined` when
|
|
100
|
+
* the declaration has no braces (a default or namespace import alone) or there
|
|
101
|
+
* is nothing to add. The braces of import attributes (`with { … }`) are not
|
|
102
|
+
* taken for them.
|
|
103
|
+
*/
|
|
104
|
+
export declare const addToImportBraces: (fixer: TSESLint.RuleFixer, sourceCode: TSESLint.SourceCode, declaration: TSESTree.ImportDeclaration, specifiers: readonly string[]) => TSESLint.RuleFix | undefined;
|
|
86
105
|
/** The exported name `specifier` imports: `x` for `import { x as y }`. */
|
|
87
106
|
export declare const importedNameOf: (specifier: DeepReadonly<TSESTree.ImportSpecifier>) => string;
|
|
88
107
|
/** What {@link bindValueImports} gives. */
|
package/dist/imports.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imports.d.mts","sourceRoot":"","sources":["../src/imports.mts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,QAAQ,EACd,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAKlD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,YACvB,QAAQ,CAAC,OAAO,cACb,MAAM,KACjB,SAAS,QAAQ,CAAC,iBAAiB,EAKnC,CAAC;AAEJ;;;GAGG;AACH,eAAO,MAAM,eAAe,iBACZ,YAAY,CAAC,QAAQ,CAAC,iBAAiB,EAAE,CAAC,KACvD,SAAS,MAAM,EAOf,CAAC;AAEJ;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,iBACjB,YAAY,CAAC,QAAQ,CAAC,iBAAiB,EAAE,CAAC,gBAC1C,MAAM,KACnB,MAAM,GAAG,SAOK,CAAC;AAElB,uEAAuE;AACvE,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC;IACpC,+DAA+D;IAC/D,aAAa,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,YAAY,EAAE,QAAQ,CAAC,UAAU,CAAC;IAElC,qEAAqE;IACrE,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C;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mBAAmB,UACvB,QAAQ,CAAC,SAAS,WAChB,QAAQ,CAAC,OAAO,cACb,MAAM,cACN,SAAS,MAAM,EAAE,KAC5B,SAAS,QAAQ,CAAC,OAAO,EAgC3B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,gBAAgB,eACf,QAAQ,CAAC,UAAU,cACnB,MAAM,eACL,SAAS,MAAM,EAAE,KAC7B,kBAAkB,GAAG,SAyCvB,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,UAClB,QAAQ,CAAC,SAAS,cACb,QAAQ,CAAC,UAAU,cACnB,MAAM,SACX,SAAS,MAAM,EAAE,KACvB,SAAS,QAAQ,CAAC,OAAO,EAqB3B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,UACrB,QAAQ,CAAC,SAAS,cACb,QAAQ,CAAC,UAAU,eAClB,QAAQ,CAAC,iBAAiB,cAC3B,SAAS,MAAM,EAAE,KAC5B,QAAQ,CAAC,OAAO,GAAG,SAwBrB,CAAC;AAEF,0EAA0E;AAC1E,eAAO,MAAM,cAAc,cACd,YAAY,CAAC,QAAQ,CAAC,eAAe,CAAC,KAChD,MAG2B,CAAC;AAoD/B,2CAA2C;AAC3C,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IACxC,sEAAsE;IACtE,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IAE9B,yDAAyD;IACzD,KAAK,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,SAAS,KAAK,SAAS,QAAQ,CAAC,OAAO,EAAE,CAAC;CACnE,CAAC,CAAC"}
|
package/dist/imports.mjs
CHANGED
|
@@ -81,7 +81,6 @@ export const buildCalleeResolver = (declarations) => {
|
|
|
81
81
|
|
|
82
82
|
|
|
83
83
|
|
|
84
|
-
|
|
85
84
|
export const buildNamedImportFix = (fixer, program, moduleName, specifiers) => {
|
|
86
85
|
if (specifiers.length === 0) {
|
|
87
86
|
return [];
|
|
@@ -127,6 +126,8 @@ export const buildNamedImportFix = (fixer, program, moduleName, specifiers) => {
|
|
|
127
126
|
|
|
128
127
|
|
|
129
128
|
|
|
129
|
+
|
|
130
|
+
|
|
130
131
|
|
|
131
132
|
|
|
132
133
|
|
|
@@ -143,34 +144,112 @@ export const bindValueImports = (sourceCode, moduleName, exportNames) => {
|
|
|
143
144
|
}
|
|
144
145
|
const defined = bindings.filter((b) => b !== undefined);
|
|
145
146
|
const toAdd = defined.flatMap((b) => (b.isAdded ? [b.localName] : []));
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
const defaultHost = declarations.find((declaration) => declaration.importKind !== 'type' &&
|
|
150
|
-
declaration.specifiers.length === 1 &&
|
|
151
|
-
declaration.specifiers[0]?.type === AST_NODE_TYPES.ImportDefaultSpecifier)?.specifiers[0];
|
|
147
|
+
const hosts = hostsFor(declarations);
|
|
152
148
|
return {
|
|
153
149
|
localNames: defined.map((b) => b.localName),
|
|
154
150
|
edits: (fixer) => [
|
|
155
151
|
...defined.flatMap((b) => b.edits(fixer)),
|
|
156
152
|
...(toAdd.length === 0
|
|
157
153
|
? []
|
|
158
|
-
:
|
|
159
|
-
? [fixer.insertTextAfter(host, `, ${toAdd.join(', ')}`)]
|
|
160
|
-
: defaultHost !== undefined
|
|
161
|
-
? [fixer.insertTextAfter(defaultHost, `, { ${toAdd.join(', ')} }`)]
|
|
162
|
-
: buildNamedImportFix(fixer, program, moduleName, toAdd)),
|
|
154
|
+
: addToFirstHost(fixer, sourceCode, moduleName, hosts, toAdd)),
|
|
163
155
|
],
|
|
164
156
|
};
|
|
165
157
|
};
|
|
166
158
|
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
export const addTypeImports = (fixer, sourceCode, moduleName, names) => {
|
|
168
|
+
if (names.length === 0) {
|
|
169
|
+
return [];
|
|
170
|
+
}
|
|
171
|
+
const declarations = getImportDeclarations(sourceCode.ast, moduleName);
|
|
172
|
+
const typeOnlyFix = firstFix(declarations.filter(isTypeOnlyDeclaration), (declaration) => addToImportBraces(fixer, sourceCode, declaration, names));
|
|
173
|
+
return typeOnlyFix !== undefined
|
|
174
|
+
? [typeOnlyFix]
|
|
175
|
+
: addToFirstHost(fixer, sourceCode, moduleName, hostsFor(declarations), names.map((name) => `type ${name}`));
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
export const addToImportBraces = (fixer, sourceCode, declaration, specifiers) => {
|
|
185
|
+
if (specifiers.length === 0) {
|
|
186
|
+
return undefined;
|
|
187
|
+
}
|
|
188
|
+
const lastNamed = declaration.specifiers
|
|
189
|
+
.filter((specifier) => specifier.type === AST_NODE_TYPES.ImportSpecifier)
|
|
190
|
+
.at(-1);
|
|
191
|
+
if (lastNamed !== undefined) {
|
|
192
|
+
return fixer.insertTextAfter(lastNamed, `, ${specifiers.join(', ')}`);
|
|
193
|
+
}
|
|
194
|
+
const openingBrace = sourceCode.getFirstToken(declaration, {
|
|
195
|
+
filter: (token) => token.value === '{' && token.range[1] <= declaration.source.range[0],
|
|
196
|
+
});
|
|
197
|
+
return openingBrace === null
|
|
198
|
+
? undefined
|
|
199
|
+
: fixer.insertTextAfter(openingBrace, ` ${specifiers.join(', ')} `);
|
|
200
|
+
};
|
|
201
|
+
|
|
167
202
|
export const importedNameOf = (specifier) => specifier.imported.type === AST_NODE_TYPES.Identifier
|
|
168
203
|
? specifier.imported.name
|
|
169
204
|
: specifier.imported.value;
|
|
170
205
|
|
|
206
|
+
const firstFix = (declarations, toFix) => {
|
|
207
|
+
for (const declaration of declarations) {
|
|
208
|
+
const fix = toFix(declaration);
|
|
209
|
+
if (fix !== undefined) {
|
|
210
|
+
return fix;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return undefined;
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
const addToFirstHost = (fixer, sourceCode, moduleName, hosts, specifiers) => {
|
|
222
|
+
const intoBraces = firstFix(hosts, (declaration) => addToImportBraces(fixer, sourceCode, declaration, specifiers));
|
|
223
|
+
if (intoBraces !== undefined) {
|
|
224
|
+
return [intoBraces];
|
|
225
|
+
}
|
|
226
|
+
const defaultHost = hosts.find((declaration) => declaration.specifiers.length === 1 &&
|
|
227
|
+
declaration.specifiers[0]?.type === AST_NODE_TYPES.ImportDefaultSpecifier)?.specifiers[0];
|
|
228
|
+
return defaultHost !== undefined
|
|
229
|
+
? [fixer.insertTextAfter(defaultHost, `, { ${specifiers.join(', ')} }`)]
|
|
230
|
+
: buildNamedImportFix(fixer, sourceCode.ast, moduleName, specifiers);
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
const isTypeOnlyDeclaration = (declaration) => declaration.importKind === 'type';
|
|
234
|
+
|
|
235
|
+
const isNotTypeOnly = ({ declaration }) => !isTypeOnlyDeclaration(declaration);
|
|
236
|
+
|
|
171
237
|
const isValueImport = ({ declaration, specifier }) => isNotTypeOnly({ declaration, specifier }) && specifier.importKind !== 'type';
|
|
172
238
|
|
|
173
|
-
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
const hostsFor = (declarations) => {
|
|
245
|
+
const notTypeOnly = declarations.filter((declaration) => !isTypeOnlyDeclaration(declaration));
|
|
246
|
+
const hasValueSpecifier = (declaration) => declaration.specifiers.some((specifier) => specifier.type === AST_NODE_TYPES.ImportSpecifier &&
|
|
247
|
+
isValueImport({ declaration, specifier }));
|
|
248
|
+
return [
|
|
249
|
+
...notTypeOnly.filter(hasValueSpecifier),
|
|
250
|
+
...notTypeOnly.filter((declaration) => !hasValueSpecifier(declaration)),
|
|
251
|
+
];
|
|
252
|
+
};
|
|
174
253
|
const bindingOf = (sourceCode, allImports, named, exportName) => {
|
|
175
254
|
const matching = named.filter(({ specifier }) => importedNameOf(specifier) === exportName);
|
|
176
255
|
const value = matching.find(isValueImport);
|
package/dist/imports.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imports.mjs","sourceRoot":"","sources":["../src/imports.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,GAGf,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEtE,uEAAuE;AAEvE;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,OAAyB,EACzB,UAAkB,EACqB,EAAE,CACzC,OAAO,CAAC,IAAI,CAAC,MAAM,CACjB,CAAC,IAAI,EAAsC,EAAE,CAC3C,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC,iBAAiB;IAC9C,IAAI,CAAC,MAAM,CAAC,KAAK,KAAK,UAAU,CACnC,CAAC;AAEJ;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,YAAwD,EACrC,EAAE,CACrB,YAAY,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE,CACnC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE,CAC3C,SAAS,CAAC,IAAI,KAAK,cAAc,CAAC,eAAe;IAC/C,CAAC,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IAC7B,CAAC,CAAC,EAAE,CACP,CACF,CAAC;AAEJ;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,YAAwD,EACxD,YAAoB,EACA,EAAE,CACtB,YAAY;KACT,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC;KAChD,IAAI,CACH,CAA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AAC,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;AAChE,CAAC,CAAC"}
|
package/dist/index.d.mts
CHANGED
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.mts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.mts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC"}
|
package/dist/index.mjs
CHANGED
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.mts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.mts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC"}
|
package/dist/negation.d.mts
CHANGED
|
@@ -59,10 +59,9 @@ export type NegationContext = Readonly<{
|
|
|
59
59
|
checker: ts.TypeChecker;
|
|
60
60
|
getLayerTypes: GetLayerTypes;
|
|
61
61
|
/**
|
|
62
|
-
* Whether `node`'s value is a boolean, so that the negation of `!node` may
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* node.
|
|
62
|
+
* Whether `node`'s value is a boolean, so that the negation of `!node` may be
|
|
63
|
+
* `node` itself. Where only the truthiness of the negation is read — the test
|
|
64
|
+
* of an `if` — any value will do, and this may answer `true` for every node.
|
|
66
65
|
*/
|
|
67
66
|
isBoolean: (node: DeepReadonly<TSESTree.Expression>) => boolean;
|
|
68
67
|
}>;
|
|
@@ -80,12 +79,12 @@ export type NegationContext = Readonly<{
|
|
|
80
79
|
* | anything else | `!a`, `!(a)` | always |
|
|
81
80
|
*
|
|
82
81
|
* `undefined` when the first two rows' condition does not hold: then the only
|
|
83
|
-
* exact negation is `!!a` or `!(a < b)`, and a caller decides whether to
|
|
84
|
-
*
|
|
85
|
-
*
|
|
82
|
+
* exact negation is `!!a` or `!(a < b)`, and a caller decides whether to write
|
|
83
|
+
* it (with {@link prefixedNegationOf}) or to give up. Inside `&&` and `||`, a
|
|
84
|
+
* side with no short negation is written with `!`.
|
|
86
85
|
*
|
|
87
|
-
* The node is taken as written: a comparison under a type wrapper is not
|
|
88
|
-
*
|
|
86
|
+
* The node is taken as written: a comparison under a type wrapper is not looked
|
|
87
|
+
* into, since inverting it would drop the wrapper.
|
|
89
88
|
*/
|
|
90
89
|
export declare const negationOf: (node: DeepReadonly<TSESTree.Expression>, context: NegationContext, operandOf: '&&' | '||' | undefined) => string | undefined;
|
|
91
90
|
/**
|
package/dist/negation.d.mts.map
CHANGED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export const prefixedNegationOf = (node, sourceCode) => {
|
|
|
110
110
|
|
|
111
111
|
|
|
112
112
|
export const needsParenthesesAsOperandOf = (node, operator) => isLooserThan(precedenceOf(node), operator);
|
|
113
|
+
const isLooserThan = (precedence, operator) => precedence === 'looser' || (operator === '&&' && precedence === '||');
|
|
114
|
+
const asOperand = (negation, operator) => operator !== undefined && isLooserThan(negation.precedence, operator)
|
|
115
|
+
? `(${negation.text})`
|
|
116
|
+
: negation.text;
|
|
117
|
+
const precedenceOf = (node) => {
|
|
118
|
+
if (node.type === AST_NODE_TYPES.LogicalExpression) {
|
|
119
|
+
|
|
120
|
+
return node.operator === '??' ? 'looser' : node.operator;
|
|
121
|
+
}
|
|
122
|
+
return LOOSER_THAN_LOGICAL.has(node.type) ? 'looser' : 'tighter';
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
const asNode = (node) =>
|
|
129
|
+
|
|
130
|
+
node;
|
|
113
131
|
const shortNegationOf = (node, context) => {
|
|
114
132
|
if (node.type === AST_NODE_TYPES.UnaryExpression && node.operator === '!') {
|
|
115
133
|
return context.isBoolean(node.argument)
|
|
@@ -144,17 +162,6 @@ const shortNegationOf = (node, context) => {
|
|
|
144
162
|
precedence: 'tighter',
|
|
145
163
|
};
|
|
146
164
|
};
|
|
147
|
-
const asOperand = (negation, operator) => operator !== undefined && isLooserThan(negation.precedence, operator)
|
|
148
|
-
? `(${negation.text})`
|
|
149
|
-
: negation.text;
|
|
150
|
-
const isLooserThan = (precedence, operator) => precedence === 'looser' || (operator === '&&' && precedence === '||');
|
|
151
|
-
const precedenceOf = (node) => {
|
|
152
|
-
if (node.type === AST_NODE_TYPES.LogicalExpression) {
|
|
153
|
-
|
|
154
|
-
return node.operator === '??' ? 'looser' : node.operator;
|
|
155
|
-
}
|
|
156
|
-
return LOOSER_THAN_LOGICAL.has(node.type) ? 'looser' : 'tighter';
|
|
157
|
-
};
|
|
158
165
|
const LOOSER_THAN_LOGICAL = new Set([
|
|
159
166
|
AST_NODE_TYPES.ArrowFunctionExpression,
|
|
160
167
|
AST_NODE_TYPES.AssignmentExpression,
|
|
@@ -205,11 +212,4 @@ const isNeverNaN = (type, checker) => {
|
|
|
205
212
|
(brandType.flags & ts.TypeFlags.BooleanLiteral) !== 0 &&
|
|
206
213
|
checker.typeToString(brandType) === 'false');
|
|
207
214
|
};
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
const asNode = (node) =>
|
|
213
|
-
|
|
214
|
-
node;
|
|
215
215
|
//# sourceMappingURL=negation.mjs.map
|
package/dist/negation.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"negation.mjs","sourceRoot":"","sources":["../src/negation.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,GAIf,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,uEAAuE;AAEvE,iFAAiF;AACjF,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,KAAK,EAAE,KAAK;IACZ,KAAK,EAAE,KAAK;IACZ,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI;IACV,GAAG,EAAE,IAAI;IACT,IAAI,EAAE,GAAG;IACT,GAAG,EAAE,IAAI;IACT,IAAI,EAAE,GAAG;CACD,CAAC;AAeX;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAC9B,CACE,QAGC,EACc,EAAE,CACnB,CAAC,IAAI,EAAE,EAAE;IACP,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;IAElD,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAC3C,OAAO,CAAC,iBAAiB,CACvB,QAAQ,CAAC,qBAAqB,CA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