eslint-fix-utils 0.4.2 → 0.4.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 +39 -41
- package/dist/index.d.mts +92 -0
- package/{lib → dist}/index.mjs +1 -7
- package/package.json +36 -43
- package/CHANGELOG.md +0 -50
- package/lib/index.d.mts +0 -528
package/README.md
CHANGED
|
@@ -35,20 +35,20 @@ You'll then be able to use any of its exported utilities in your rules.
|
|
|
35
35
|
Version of [`addObjectProperty`](#addobjectproperty) that can be passed directly as a `fix` property.
|
|
36
36
|
|
|
37
37
|
```ts
|
|
38
|
-
import { fixAddObjectProperty } from
|
|
38
|
+
import { fixAddObjectProperty } from 'eslint-fix-utils';
|
|
39
39
|
|
|
40
40
|
// ...
|
|
41
41
|
|
|
42
42
|
export function report(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
node: ESTree.ObjectExpression,
|
|
44
|
+
propertyKey: string,
|
|
45
|
+
propertyValue: string,
|
|
46
46
|
) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
context.report({
|
|
48
|
+
fix: fixAddObjectProperty(context, node, propertyKey, propertyValue),
|
|
49
|
+
messageId,
|
|
50
|
+
node,
|
|
51
|
+
});
|
|
52
52
|
}
|
|
53
53
|
```
|
|
54
54
|
|
|
@@ -57,16 +57,16 @@ export function report(
|
|
|
57
57
|
Version of [`removeArrayElement`](#removearrayelement) that can be passed directly as a `fix` property.
|
|
58
58
|
|
|
59
59
|
```ts
|
|
60
|
-
import { fixRemoveArrayElement } from
|
|
60
|
+
import { fixRemoveArrayElement } from 'eslint-fix-utils';
|
|
61
61
|
|
|
62
62
|
// ...
|
|
63
63
|
|
|
64
64
|
export function report(index: number, node: ESTree.ArrayExpression) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
context.report({
|
|
66
|
+
fix: fixRemoveArrayElement(context, index, node.elements),
|
|
67
|
+
messageId,
|
|
68
|
+
node: node.elements[index],
|
|
69
|
+
});
|
|
70
70
|
}
|
|
71
71
|
```
|
|
72
72
|
|
|
@@ -75,16 +75,16 @@ export function report(index: number, node: ESTree.ArrayExpression) {
|
|
|
75
75
|
Version of [`removeObjectProperty`](#removeobjectproperty) that can be passed directly as a `fix` property.
|
|
76
76
|
|
|
77
77
|
```ts
|
|
78
|
-
import { fixRemoveObjectProperty } from
|
|
78
|
+
import { fixRemoveObjectProperty } from 'eslint-fix-utils';
|
|
79
79
|
|
|
80
80
|
// ...
|
|
81
81
|
|
|
82
82
|
export function report(index: number, node: ESTree.ObjectExpression) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
83
|
+
context.report({
|
|
84
|
+
fix: fixRemoveObjectProperty(context, node.properties[index]),
|
|
85
|
+
messageId,
|
|
86
|
+
node: node.properties[index],
|
|
87
|
+
});
|
|
88
88
|
}
|
|
89
89
|
```
|
|
90
90
|
|
|
@@ -142,19 +142,19 @@ Parameters:
|
|
|
142
142
|
4. `parentOrElements`: the array expression node, or its `.elements` array
|
|
143
143
|
|
|
144
144
|
```ts
|
|
145
|
-
import { removeArrayElement } from
|
|
145
|
+
import { removeArrayElement } from 'eslint-fix-utils';
|
|
146
146
|
|
|
147
147
|
// ...
|
|
148
148
|
|
|
149
149
|
export function report(index: number, node: ESTree.ArrayExpression) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
150
|
+
context.report({
|
|
151
|
+
fix(fixer) {
|
|
152
|
+
// Removes the last element of the array:
|
|
153
|
+
return removeArrayElement(context, fixer, index, node.elements);
|
|
154
|
+
},
|
|
155
|
+
messageId,
|
|
156
|
+
node: node.elements[index],
|
|
157
|
+
});
|
|
158
158
|
}
|
|
159
159
|
```
|
|
160
160
|
|
|
@@ -180,19 +180,19 @@ Parameters:
|
|
|
180
180
|
3. `property`: the property node
|
|
181
181
|
|
|
182
182
|
```ts
|
|
183
|
-
import { removeObjectProperty } from
|
|
183
|
+
import { removeObjectProperty } from 'eslint-fix-utils';
|
|
184
184
|
|
|
185
185
|
// ...
|
|
186
186
|
|
|
187
187
|
export function report(index: number, node: ESTree.ObjectExpression) {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
188
|
+
context.report({
|
|
189
|
+
fix(fixer) {
|
|
190
|
+
// Removes the last property of the object:
|
|
191
|
+
return removeObjectProperty(context, fixer, node.properties[index]);
|
|
192
|
+
},
|
|
193
|
+
messageId,
|
|
194
|
+
node: node.properties[index],
|
|
195
|
+
});
|
|
196
196
|
}
|
|
197
197
|
```
|
|
198
198
|
|
|
@@ -217,7 +217,6 @@ Thanks! 🔧
|
|
|
217
217
|
<!-- spellchecker: disable -->
|
|
218
218
|
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
219
219
|
<!-- prettier-ignore-start -->
|
|
220
|
-
<!-- markdownlint-disable -->
|
|
221
220
|
<table>
|
|
222
221
|
<tbody>
|
|
223
222
|
<tr>
|
|
@@ -228,7 +227,6 @@ Thanks! 🔧
|
|
|
228
227
|
</tbody>
|
|
229
228
|
</table>
|
|
230
229
|
|
|
231
|
-
<!-- markdownlint-restore -->
|
|
232
230
|
<!-- prettier-ignore-end -->
|
|
233
231
|
|
|
234
232
|
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Rule } from "eslint";
|
|
2
|
+
import * as ESTree from "estree";
|
|
3
|
+
//#region src/addObjectProperty.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Given an ObjectProperty, and a rule fixer, this function yields the addition
|
|
6
|
+
* of a new property to the given ObjectExpression, along with any necessary commas.
|
|
7
|
+
* The new property is at the end of the object.
|
|
8
|
+
* @param context ESLint Rule Context
|
|
9
|
+
* @param fixer Rule fixer
|
|
10
|
+
* @param objectExpression The object expression to which the property will be added
|
|
11
|
+
* @param propertyKey The key for the new property
|
|
12
|
+
* @param propertyValue The value for the new property
|
|
13
|
+
* @yields fixer addition for the new property into the object expression, as well as any necessary commas
|
|
14
|
+
*/
|
|
15
|
+
export declare function addObjectProperty(context: Rule.RuleContext, fixer: Rule.RuleFixer, objectExpression: ESTree.ObjectExpression, propertyKey: string, propertyValue: unknown): Generator<Rule.Fix, void>;
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/fixAddObjectProperty.d.ts
|
|
18
|
+
/**
|
|
19
|
+
* Given an ObjectExpression and the key and value of a property,
|
|
20
|
+
* this function returns a fixer function that you can provide to a report
|
|
21
|
+
* descriptor that will add the new property to it.
|
|
22
|
+
* @param context ESLint Rule Context
|
|
23
|
+
* @param objectExpression The object expression to which the property will be added
|
|
24
|
+
* @param propertyKey The key for the new property
|
|
25
|
+
* @param propertyValue The value for the new property
|
|
26
|
+
* @returns a fixer function that you can provide to a report descriptor that
|
|
27
|
+
* adds a new property to an object expression, along with any commas that
|
|
28
|
+
* are needed.
|
|
29
|
+
*/
|
|
30
|
+
export declare const fixAddObjectProperty: (context: Rule.RuleContext, objectExpression: ESTree.ObjectExpression, propertyKey: string, propertyValue: unknown) => ((fixer: Rule.RuleFixer) => Generator<Rule.Fix, void>);
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/removeArrayElement.d.ts
|
|
33
|
+
type ArrayElement = ESTree.Expression | ESTree.SpreadElement;
|
|
34
|
+
type ArrayElementsOrParent = ESTree.ArrayExpression | ESTree.ArrayExpression["elements"];
|
|
35
|
+
/**
|
|
36
|
+
* Given an ArrayExpression or the list of elements an ArrayExpression has,
|
|
37
|
+
* the index or node within that array that you want to remove, and a rule fixer,
|
|
38
|
+
* this function yields removals for the node itself, as well as any trailing
|
|
39
|
+
* commas that are no longer necessary.
|
|
40
|
+
* @param context ESLint Rule Context
|
|
41
|
+
* @param fixer Rule fixer
|
|
42
|
+
* @param elementOrIndex The child expression, spread element, or a numeric
|
|
43
|
+
* index of the child
|
|
44
|
+
* @param parentOrElements The array expression node, or its `.elements` array
|
|
45
|
+
* @yields fixer removals for the node itself, as well as any trailing commas
|
|
46
|
+
* that are no longer necessary.
|
|
47
|
+
*/
|
|
48
|
+
export declare function removeArrayElement(context: Rule.RuleContext, fixer: Rule.RuleFixer, elementOrIndex: ArrayElement | number, parentOrElements: ArrayElementsOrParent): Generator<Rule.Fix, void>;
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/fixRemoveArrayElement.d.ts
|
|
51
|
+
/**
|
|
52
|
+
* Given an ArrayExpression or the list of elements an ArrayExpression has, and
|
|
53
|
+
* the index or node within that array that you want to remove, this function
|
|
54
|
+
* returns a fixer function that you can provide to a report descriptor that
|
|
55
|
+
* will remove that node along with any trailing comma.
|
|
56
|
+
* @param context ESLint Rule Context
|
|
57
|
+
* @param elementOrIndex The child expression, spread element, or a numeric
|
|
58
|
+
* index of the child
|
|
59
|
+
* @param parentOrElements The array expression node, or its `.elements` array
|
|
60
|
+
* @returns a fixer function that you can provide to a report descriptor, that
|
|
61
|
+
* removes an element from an array expression, along with any commas that are
|
|
62
|
+
* no longer necessary.
|
|
63
|
+
*/
|
|
64
|
+
export declare const fixRemoveArrayElement: (context: Rule.RuleContext, elementOrIndex: ArrayElement | number, parentOrElements: ArrayElementsOrParent) => ((fixer: Rule.RuleFixer) => Generator<Rule.Fix, void>);
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region src/removeObjectProperty.d.ts
|
|
67
|
+
type ObjectProperty = ESTree.Property | ESTree.SpreadElement;
|
|
68
|
+
/**
|
|
69
|
+
* Given an ObjectProperty, and a rule fixer, this function yields removals for
|
|
70
|
+
* the node itself, as well as any trailing commas that are no longer necessary.
|
|
71
|
+
* @param context ESLint Rule Context
|
|
72
|
+
* @param fixer Rule fixer
|
|
73
|
+
* @param property The property node
|
|
74
|
+
* @yields fixer removals for the node itself, as well as any trailing commas
|
|
75
|
+
* that are no longer necessary.
|
|
76
|
+
*/
|
|
77
|
+
export declare function removeObjectProperty(context: Rule.RuleContext, fixer: Rule.RuleFixer, property: ObjectProperty): Generator<Rule.Fix, void>;
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region src/fixRemoveObjectProperty.d.ts
|
|
80
|
+
/**
|
|
81
|
+
* Given an ObjectProperty, this function returns a fixer function that you can
|
|
82
|
+
* provide to a report descriptor that will remove that node along with any
|
|
83
|
+
* trailing comma.
|
|
84
|
+
* @param context ESLint Rule Context
|
|
85
|
+
* @param property The property node
|
|
86
|
+
* @returns a fixer function that you can provide to a report descriptor, that
|
|
87
|
+
* removes a property from an object expression, along with any commas that
|
|
88
|
+
* are no longer necessary.
|
|
89
|
+
*/
|
|
90
|
+
export declare const fixRemoveObjectProperty: (context: Rule.RuleContext, property: ObjectProperty) => ((fixer: Rule.RuleFixer) => Generator<Rule.Fix, void>);
|
|
91
|
+
//#endregion
|
|
92
|
+
export type { ArrayElement, ArrayElementsOrParent, ObjectProperty };
|
package/{lib → dist}/index.mjs
RENAMED
|
@@ -30,7 +30,6 @@ function* addObjectProperty(context, fixer, objectExpression, propertyKey, prope
|
|
|
30
30
|
const textToInsert = ` ${`${JSON.stringify(propertyKey)}: ${JSON.stringify(propertyValue)}`}\n`;
|
|
31
31
|
yield fixer.insertTextAfterRange(insertPosition, textToInsert);
|
|
32
32
|
}
|
|
33
|
-
|
|
34
33
|
//#endregion
|
|
35
34
|
//#region src/fixAddObjectProperty.ts
|
|
36
35
|
/**
|
|
@@ -48,7 +47,6 @@ function* addObjectProperty(context, fixer, objectExpression, propertyKey, prope
|
|
|
48
47
|
const fixAddObjectProperty = (context, objectExpression, propertyKey, propertyValue) => {
|
|
49
48
|
return (fixer) => addObjectProperty(context, fixer, objectExpression, propertyKey, propertyValue);
|
|
50
49
|
};
|
|
51
|
-
|
|
52
50
|
//#endregion
|
|
53
51
|
//#region src/removeArrayElement.ts
|
|
54
52
|
/**
|
|
@@ -79,7 +77,6 @@ function getElementAndIndex(elements, elementOrIndex) {
|
|
|
79
77
|
if (index === -1) throw new Error("Node is not a child of the parent array.");
|
|
80
78
|
return [elements[index], index];
|
|
81
79
|
}
|
|
82
|
-
|
|
83
80
|
//#endregion
|
|
84
81
|
//#region src/fixRemoveArrayElement.ts
|
|
85
82
|
/**
|
|
@@ -98,7 +95,6 @@ function getElementAndIndex(elements, elementOrIndex) {
|
|
|
98
95
|
const fixRemoveArrayElement = (context, elementOrIndex, parentOrElements) => {
|
|
99
96
|
return (fixer) => removeArrayElement(context, fixer, elementOrIndex, parentOrElements);
|
|
100
97
|
};
|
|
101
|
-
|
|
102
98
|
//#endregion
|
|
103
99
|
//#region src/removeObjectProperty.ts
|
|
104
100
|
/**
|
|
@@ -117,7 +113,6 @@ function* removeObjectProperty(context, fixer, property) {
|
|
|
117
113
|
yield fixer.remove(property);
|
|
118
114
|
if (tokenAfter?.value === ",") yield fixer.remove(tokenAfter);
|
|
119
115
|
}
|
|
120
|
-
|
|
121
116
|
//#endregion
|
|
122
117
|
//#region src/fixRemoveObjectProperty.ts
|
|
123
118
|
/**
|
|
@@ -133,6 +128,5 @@ function* removeObjectProperty(context, fixer, property) {
|
|
|
133
128
|
const fixRemoveObjectProperty = (context, property) => {
|
|
134
129
|
return (fixer) => removeObjectProperty(context, fixer, property);
|
|
135
130
|
};
|
|
136
|
-
|
|
137
131
|
//#endregion
|
|
138
|
-
export { addObjectProperty, fixAddObjectProperty, fixRemoveArrayElement, fixRemoveObjectProperty, removeArrayElement, removeObjectProperty };
|
|
132
|
+
export { addObjectProperty, fixAddObjectProperty, fixRemoveArrayElement, fixRemoveObjectProperty, removeArrayElement, removeObjectProperty };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-fix-utils",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "Utilities for ESLint rule fixers and suggestions. 🧑🔧",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
"name": "michael faith",
|
|
18
|
-
"email": "michaelfaith@users.noreply.github.com",
|
|
19
18
|
"url": "https://michael.faith"
|
|
20
19
|
}
|
|
21
20
|
],
|
|
@@ -23,50 +22,46 @@
|
|
|
23
22
|
"type": "module",
|
|
24
23
|
"exports": {
|
|
25
24
|
".": {
|
|
26
|
-
"types": "./
|
|
27
|
-
"default": "./
|
|
28
|
-
}
|
|
25
|
+
"types": "./dist/index.d.mts",
|
|
26
|
+
"default": "./dist/index.mjs"
|
|
27
|
+
},
|
|
28
|
+
"./package.json": "./package.json"
|
|
29
29
|
},
|
|
30
|
-
"main": "lib/index.mjs",
|
|
31
|
-
"module": "lib/index.mjs",
|
|
32
|
-
"types": "lib/index.d.mts",
|
|
33
30
|
"files": [
|
|
34
|
-
"
|
|
35
|
-
"lib/"
|
|
31
|
+
"dist/"
|
|
36
32
|
],
|
|
37
|
-
"lint-staged": {
|
|
38
|
-
"*": "prettier --ignore-unknown --write"
|
|
39
|
-
},
|
|
40
33
|
"devDependencies": {
|
|
41
|
-
"@eslint-community/eslint-plugin-eslint-comments": "4.
|
|
34
|
+
"@eslint-community/eslint-plugin-eslint-comments": "4.8.1",
|
|
42
35
|
"@eslint/js": "10.0.1",
|
|
43
|
-
"@
|
|
44
|
-
"@
|
|
45
|
-
"@
|
|
46
|
-
"@
|
|
36
|
+
"@eslint/json": "2.1.0",
|
|
37
|
+
"@eslint/markdown": "8.0.3",
|
|
38
|
+
"@ianvs/prettier-plugin-sort-imports": "4.7.1",
|
|
39
|
+
"@types/estree": "1.0.9",
|
|
40
|
+
"@types/node": "24.13.5",
|
|
41
|
+
"@typescript/native": "npm:typescript@7.0.2",
|
|
42
|
+
"@vitest/coverage-v8": "5.0.1",
|
|
43
|
+
"@vitest/eslint-plugin": "1.6.27",
|
|
47
44
|
"console-fail-test": "0.6.1",
|
|
48
|
-
"
|
|
49
|
-
"eslint": "
|
|
50
|
-
"eslint-plugin-
|
|
51
|
-
"eslint-plugin-
|
|
52
|
-
"eslint-plugin-
|
|
53
|
-
"eslint-plugin-
|
|
54
|
-
"eslint-plugin-
|
|
55
|
-
"eslint-plugin-
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"typescript-eslint": "8.56.0",
|
|
69
|
-
"vitest": "4.0.15"
|
|
45
|
+
"eslint": "10.10.0",
|
|
46
|
+
"eslint-plugin-jsdoc": "64.5.2",
|
|
47
|
+
"eslint-plugin-jsonc": "3.4.2",
|
|
48
|
+
"eslint-plugin-n": "18.3.0",
|
|
49
|
+
"eslint-plugin-package-json": "1.8.1",
|
|
50
|
+
"eslint-plugin-perfectionist": "5.11.1",
|
|
51
|
+
"eslint-plugin-regexp": "3.3.0",
|
|
52
|
+
"eslint-plugin-yml": "3.8.1",
|
|
53
|
+
"jiti": "2.7.0",
|
|
54
|
+
"knip": "6.36.0",
|
|
55
|
+
"prettier": "3.9.7",
|
|
56
|
+
"prettier-plugin-curly": "0.4.1",
|
|
57
|
+
"prettier-plugin-packagejson": "3.0.2",
|
|
58
|
+
"prettier-plugin-sh": "0.19.0",
|
|
59
|
+
"pretty-quick": "4.2.2",
|
|
60
|
+
"simple-git-hooks": "2.14.0",
|
|
61
|
+
"tsdown": "0.23.0",
|
|
62
|
+
"typescript": "npm:@typescript/typescript6@6.0.2",
|
|
63
|
+
"typescript-eslint": "8.70.0",
|
|
64
|
+
"vitest": "5.0.1"
|
|
70
65
|
},
|
|
71
66
|
"peerDependencies": {
|
|
72
67
|
"@types/estree": ">=1",
|
|
@@ -85,9 +80,7 @@
|
|
|
85
80
|
"format": "prettier .",
|
|
86
81
|
"lint": "eslint . --max-warnings 0",
|
|
87
82
|
"lint:knip": "knip",
|
|
88
|
-
"lint:md": "markdownlint \"**/*.md\" \".github/**/*.md\"",
|
|
89
|
-
"lint:spelling": "cspell \"**\" \".github/**/*\"",
|
|
90
83
|
"test": "vitest",
|
|
91
|
-
"
|
|
84
|
+
"typecheck": "tsc"
|
|
92
85
|
}
|
|
93
86
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
# [0.4.0](https://github.com/michaelfaith/eslint-fix-utils/compare/0.3.0...0.4.0) (2025-06-12)
|
|
4
|
-
|
|
5
|
-
### Features
|
|
6
|
-
|
|
7
|
-
- bundle esm-only ([#170](https://github.com/michaelfaith/eslint-fix-utils/issues/170)) ([62e4938](https://github.com/michaelfaith/eslint-fix-utils/commit/62e4938aa6e67db31611e59b6fe19692069a56de)), closes [#167](https://github.com/michaelfaith/eslint-fix-utils/issues/167)
|
|
8
|
-
|
|
9
|
-
# [0.3.0](https://github.com/michaelfaith/eslint-fix-utils/compare/0.2.1...0.3.0) (2025-06-11)
|
|
10
|
-
|
|
11
|
-
### Bug Fixes
|
|
12
|
-
|
|
13
|
-
- bump to create-typescript-app@2 with transitions action ([#79](https://github.com/michaelfaith/eslint-fix-utils/issues/79)) ([0bb023f](https://github.com/michaelfaith/eslint-fix-utils/commit/0bb023f96c18632b1c688d3210ae2567cee4b8e0)), closes [#75](https://github.com/michaelfaith/eslint-fix-utils/issues/75)
|
|
14
|
-
|
|
15
|
-
### Features
|
|
16
|
-
|
|
17
|
-
- remove support for node 18 ([#169](https://github.com/michaelfaith/eslint-fix-utils/issues/169)) ([1b076be](https://github.com/michaelfaith/eslint-fix-utils/commit/1b076be4533fc4e91e6c7af430ea2c597eb6d87b)), closes [#166](https://github.com/michaelfaith/eslint-fix-utils/issues/166)
|
|
18
|
-
|
|
19
|
-
## [0.4.2](https://github.com/michaelfaith/eslint-fix-utils/compare/v0.4.1...v0.4.2) (2026-03-01)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
### Bug Fixes
|
|
23
|
-
|
|
24
|
-
* update repo references ([#430](https://github.com/michaelfaith/eslint-fix-utils/issues/430)) ([60ee8aa](https://github.com/michaelfaith/eslint-fix-utils/commit/60ee8aab7989ab4f904c7fe98e9169061530de5d))
|
|
25
|
-
|
|
26
|
-
## [0.4.1](https://github.com/michaelfaith/eslint-fix-utils/compare/0.4.0...v0.4.1) (2026-02-01)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
### Features
|
|
30
|
-
|
|
31
|
-
* add functions for adding a new property to an object ([#399](https://github.com/michaelfaith/eslint-fix-utils/issues/399)) ([47daa1b](https://github.com/michaelfaith/eslint-fix-utils/commit/47daa1be7da85f7939573057c6a649aa35cfdd77))
|
|
32
|
-
|
|
33
|
-
## [0.2.1](https://github.com/michaelfaith/eslint-fix-utils/compare/0.2.0...0.2.1) (2025-01-28)
|
|
34
|
-
|
|
35
|
-
### Bug Fixes
|
|
36
|
-
|
|
37
|
-
- make `@types/estree` peer dependency optional ([#25](https://github.com/michaelfaith/eslint-fix-utils/issues/25)) ([f6ddd9d](https://github.com/michaelfaith/eslint-fix-utils/commit/f6ddd9d20de032992202d9287be3c7abee4f0d15)), closes [#24](https://github.com/michaelfaith/eslint-fix-utils/issues/24)
|
|
38
|
-
|
|
39
|
-
# [0.2.0](https://github.com/michaelfaith/eslint-fix-utils/compare/0.1.0...0.2.0) (2025-01-23)
|
|
40
|
-
|
|
41
|
-
### Features
|
|
42
|
-
|
|
43
|
-
- empty commit to trigger 0.2.0 ([1658b2d](https://github.com/michaelfaith/eslint-fix-utils/commit/1658b2d849fe9f636f24f154831ad8eeecb5721c))
|
|
44
|
-
|
|
45
|
-
# 0.1.0 (2025-01-19)
|
|
46
|
-
|
|
47
|
-
### Features
|
|
48
|
-
|
|
49
|
-
- initial functionality ✨ ([6bf5c33](https://github.com/michaelfaith/eslint-fix-utils/commit/6bf5c3329eb47c43d38128328fd4501277b3c8ad))
|
|
50
|
-
- initialized repo ✨ ([31c7630](https://github.com/michaelfaith/eslint-fix-utils/commit/31c7630c769a8a57b9be85247c6546baceae82f2))
|
package/lib/index.d.mts
DELETED
|
@@ -1,528 +0,0 @@
|
|
|
1
|
-
import { Rule } from "eslint";
|
|
2
|
-
|
|
3
|
-
//#region node_modules/.pnpm/@types+estree@1.0.6/node_modules/@types/estree/index.d.ts
|
|
4
|
-
// This definition file follows a somewhat unusual format. ESTree allows
|
|
5
|
-
// runtime type checks based on the `type` parameter. In order to explain this
|
|
6
|
-
// to typescript we want to use discriminated union types:
|
|
7
|
-
// https://github.com/Microsoft/TypeScript/pull/9163
|
|
8
|
-
//
|
|
9
|
-
// For ESTree this is a bit tricky because the high level interfaces like
|
|
10
|
-
// Node or Function are pulling double duty. We want to pass common fields down
|
|
11
|
-
// to the interfaces that extend them (like Identifier or
|
|
12
|
-
// ArrowFunctionExpression), but you can't extend a type union or enforce
|
|
13
|
-
// common fields on them. So we've split the high level interfaces into two
|
|
14
|
-
// types, a base type which passes down inherited fields, and a type union of
|
|
15
|
-
// all types which extend the base type. Only the type union is exported, and
|
|
16
|
-
// the union is how other types refer to the collection of inheriting types.
|
|
17
|
-
//
|
|
18
|
-
// This makes the definitions file here somewhat more difficult to maintain,
|
|
19
|
-
// but it has the notable advantage of making ESTree much easier to use as
|
|
20
|
-
// an end user.
|
|
21
|
-
interface BaseNodeWithoutComments {
|
|
22
|
-
// Every leaf interface that extends BaseNode must specify a type property.
|
|
23
|
-
// The type property should be a string literal. For example, Identifier
|
|
24
|
-
// has: `type: "Identifier"`
|
|
25
|
-
type: string;
|
|
26
|
-
loc?: SourceLocation | null | undefined;
|
|
27
|
-
range?: [number, number] | undefined;
|
|
28
|
-
}
|
|
29
|
-
interface BaseNode extends BaseNodeWithoutComments {
|
|
30
|
-
leadingComments?: Comment[] | undefined;
|
|
31
|
-
trailingComments?: Comment[] | undefined;
|
|
32
|
-
}
|
|
33
|
-
interface Comment extends BaseNodeWithoutComments {
|
|
34
|
-
type: "Line" | "Block";
|
|
35
|
-
value: string;
|
|
36
|
-
}
|
|
37
|
-
interface SourceLocation {
|
|
38
|
-
source?: string | null | undefined;
|
|
39
|
-
start: Position;
|
|
40
|
-
end: Position;
|
|
41
|
-
}
|
|
42
|
-
interface Position {
|
|
43
|
-
/** >= 1 */
|
|
44
|
-
line: number;
|
|
45
|
-
/** >= 0 */
|
|
46
|
-
column: number;
|
|
47
|
-
}
|
|
48
|
-
interface BaseFunction extends BaseNode {
|
|
49
|
-
params: Pattern[];
|
|
50
|
-
generator?: boolean | undefined;
|
|
51
|
-
async?: boolean | undefined; // The body is either BlockStatement or Expression because arrow functions
|
|
52
|
-
// can have a body that's either. FunctionDeclarations and
|
|
53
|
-
// FunctionExpressions have only BlockStatement bodies.
|
|
54
|
-
body: BlockStatement | Expression;
|
|
55
|
-
}
|
|
56
|
-
type Statement = ExpressionStatement | BlockStatement | StaticBlock | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | Declaration;
|
|
57
|
-
interface BaseStatement extends BaseNode {}
|
|
58
|
-
interface EmptyStatement extends BaseStatement {
|
|
59
|
-
type: "EmptyStatement";
|
|
60
|
-
}
|
|
61
|
-
interface BlockStatement extends BaseStatement {
|
|
62
|
-
type: "BlockStatement";
|
|
63
|
-
body: Statement[];
|
|
64
|
-
innerComments?: Comment[] | undefined;
|
|
65
|
-
}
|
|
66
|
-
interface StaticBlock extends Omit<BlockStatement, "type"> {
|
|
67
|
-
type: "StaticBlock";
|
|
68
|
-
}
|
|
69
|
-
interface ExpressionStatement extends BaseStatement {
|
|
70
|
-
type: "ExpressionStatement";
|
|
71
|
-
expression: Expression;
|
|
72
|
-
}
|
|
73
|
-
interface IfStatement extends BaseStatement {
|
|
74
|
-
type: "IfStatement";
|
|
75
|
-
test: Expression;
|
|
76
|
-
consequent: Statement;
|
|
77
|
-
alternate?: Statement | null | undefined;
|
|
78
|
-
}
|
|
79
|
-
interface LabeledStatement extends BaseStatement {
|
|
80
|
-
type: "LabeledStatement";
|
|
81
|
-
label: Identifier;
|
|
82
|
-
body: Statement;
|
|
83
|
-
}
|
|
84
|
-
interface BreakStatement extends BaseStatement {
|
|
85
|
-
type: "BreakStatement";
|
|
86
|
-
label?: Identifier | null | undefined;
|
|
87
|
-
}
|
|
88
|
-
interface ContinueStatement extends BaseStatement {
|
|
89
|
-
type: "ContinueStatement";
|
|
90
|
-
label?: Identifier | null | undefined;
|
|
91
|
-
}
|
|
92
|
-
interface WithStatement extends BaseStatement {
|
|
93
|
-
type: "WithStatement";
|
|
94
|
-
object: Expression;
|
|
95
|
-
body: Statement;
|
|
96
|
-
}
|
|
97
|
-
interface SwitchStatement extends BaseStatement {
|
|
98
|
-
type: "SwitchStatement";
|
|
99
|
-
discriminant: Expression;
|
|
100
|
-
cases: SwitchCase[];
|
|
101
|
-
}
|
|
102
|
-
interface ReturnStatement extends BaseStatement {
|
|
103
|
-
type: "ReturnStatement";
|
|
104
|
-
argument?: Expression | null | undefined;
|
|
105
|
-
}
|
|
106
|
-
interface ThrowStatement extends BaseStatement {
|
|
107
|
-
type: "ThrowStatement";
|
|
108
|
-
argument: Expression;
|
|
109
|
-
}
|
|
110
|
-
interface TryStatement extends BaseStatement {
|
|
111
|
-
type: "TryStatement";
|
|
112
|
-
block: BlockStatement;
|
|
113
|
-
handler?: CatchClause | null | undefined;
|
|
114
|
-
finalizer?: BlockStatement | null | undefined;
|
|
115
|
-
}
|
|
116
|
-
interface WhileStatement extends BaseStatement {
|
|
117
|
-
type: "WhileStatement";
|
|
118
|
-
test: Expression;
|
|
119
|
-
body: Statement;
|
|
120
|
-
}
|
|
121
|
-
interface DoWhileStatement extends BaseStatement {
|
|
122
|
-
type: "DoWhileStatement";
|
|
123
|
-
body: Statement;
|
|
124
|
-
test: Expression;
|
|
125
|
-
}
|
|
126
|
-
interface ForStatement extends BaseStatement {
|
|
127
|
-
type: "ForStatement";
|
|
128
|
-
init?: VariableDeclaration | Expression | null | undefined;
|
|
129
|
-
test?: Expression | null | undefined;
|
|
130
|
-
update?: Expression | null | undefined;
|
|
131
|
-
body: Statement;
|
|
132
|
-
}
|
|
133
|
-
interface BaseForXStatement extends BaseStatement {
|
|
134
|
-
left: VariableDeclaration | Pattern;
|
|
135
|
-
right: Expression;
|
|
136
|
-
body: Statement;
|
|
137
|
-
}
|
|
138
|
-
interface ForInStatement extends BaseForXStatement {
|
|
139
|
-
type: "ForInStatement";
|
|
140
|
-
}
|
|
141
|
-
interface DebuggerStatement extends BaseStatement {
|
|
142
|
-
type: "DebuggerStatement";
|
|
143
|
-
}
|
|
144
|
-
type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration;
|
|
145
|
-
interface BaseDeclaration extends BaseStatement {}
|
|
146
|
-
interface MaybeNamedFunctionDeclaration extends BaseFunction, BaseDeclaration {
|
|
147
|
-
type: "FunctionDeclaration";
|
|
148
|
-
/** It is null when a function declaration is a part of the `export default function` statement */
|
|
149
|
-
id: Identifier | null;
|
|
150
|
-
body: BlockStatement;
|
|
151
|
-
}
|
|
152
|
-
interface FunctionDeclaration extends MaybeNamedFunctionDeclaration {
|
|
153
|
-
id: Identifier;
|
|
154
|
-
}
|
|
155
|
-
interface VariableDeclaration extends BaseDeclaration {
|
|
156
|
-
type: "VariableDeclaration";
|
|
157
|
-
declarations: VariableDeclarator[];
|
|
158
|
-
kind: "var" | "let" | "const";
|
|
159
|
-
}
|
|
160
|
-
interface VariableDeclarator extends BaseNode {
|
|
161
|
-
type: "VariableDeclarator";
|
|
162
|
-
id: Pattern;
|
|
163
|
-
init?: Expression | null | undefined;
|
|
164
|
-
}
|
|
165
|
-
interface ExpressionMap {
|
|
166
|
-
ArrayExpression: ArrayExpression;
|
|
167
|
-
ArrowFunctionExpression: ArrowFunctionExpression;
|
|
168
|
-
AssignmentExpression: AssignmentExpression;
|
|
169
|
-
AwaitExpression: AwaitExpression;
|
|
170
|
-
BinaryExpression: BinaryExpression;
|
|
171
|
-
CallExpression: CallExpression;
|
|
172
|
-
ChainExpression: ChainExpression;
|
|
173
|
-
ClassExpression: ClassExpression;
|
|
174
|
-
ConditionalExpression: ConditionalExpression;
|
|
175
|
-
FunctionExpression: FunctionExpression;
|
|
176
|
-
Identifier: Identifier;
|
|
177
|
-
ImportExpression: ImportExpression;
|
|
178
|
-
Literal: Literal;
|
|
179
|
-
LogicalExpression: LogicalExpression;
|
|
180
|
-
MemberExpression: MemberExpression;
|
|
181
|
-
MetaProperty: MetaProperty;
|
|
182
|
-
NewExpression: NewExpression;
|
|
183
|
-
ObjectExpression: ObjectExpression;
|
|
184
|
-
SequenceExpression: SequenceExpression;
|
|
185
|
-
TaggedTemplateExpression: TaggedTemplateExpression;
|
|
186
|
-
TemplateLiteral: TemplateLiteral;
|
|
187
|
-
ThisExpression: ThisExpression;
|
|
188
|
-
UnaryExpression: UnaryExpression;
|
|
189
|
-
UpdateExpression: UpdateExpression;
|
|
190
|
-
YieldExpression: YieldExpression;
|
|
191
|
-
}
|
|
192
|
-
type Expression = ExpressionMap[keyof ExpressionMap];
|
|
193
|
-
interface BaseExpression extends BaseNode {}
|
|
194
|
-
type ChainElement = SimpleCallExpression | MemberExpression;
|
|
195
|
-
interface ChainExpression extends BaseExpression {
|
|
196
|
-
type: "ChainExpression";
|
|
197
|
-
expression: ChainElement;
|
|
198
|
-
}
|
|
199
|
-
interface ThisExpression extends BaseExpression {
|
|
200
|
-
type: "ThisExpression";
|
|
201
|
-
}
|
|
202
|
-
interface ArrayExpression extends BaseExpression {
|
|
203
|
-
type: "ArrayExpression";
|
|
204
|
-
elements: Array<Expression | SpreadElement | null>;
|
|
205
|
-
}
|
|
206
|
-
interface ObjectExpression extends BaseExpression {
|
|
207
|
-
type: "ObjectExpression";
|
|
208
|
-
properties: Array<Property | SpreadElement>;
|
|
209
|
-
}
|
|
210
|
-
interface PrivateIdentifier extends BaseNode {
|
|
211
|
-
type: "PrivateIdentifier";
|
|
212
|
-
name: string;
|
|
213
|
-
}
|
|
214
|
-
interface Property extends BaseNode {
|
|
215
|
-
type: "Property";
|
|
216
|
-
key: Expression | PrivateIdentifier;
|
|
217
|
-
value: Expression | Pattern; // Could be an AssignmentProperty
|
|
218
|
-
kind: "init" | "get" | "set";
|
|
219
|
-
method: boolean;
|
|
220
|
-
shorthand: boolean;
|
|
221
|
-
computed: boolean;
|
|
222
|
-
}
|
|
223
|
-
interface PropertyDefinition extends BaseNode {
|
|
224
|
-
type: "PropertyDefinition";
|
|
225
|
-
key: Expression | PrivateIdentifier;
|
|
226
|
-
value?: Expression | null | undefined;
|
|
227
|
-
computed: boolean;
|
|
228
|
-
static: boolean;
|
|
229
|
-
}
|
|
230
|
-
interface FunctionExpression extends BaseFunction, BaseExpression {
|
|
231
|
-
id?: Identifier | null | undefined;
|
|
232
|
-
type: "FunctionExpression";
|
|
233
|
-
body: BlockStatement;
|
|
234
|
-
}
|
|
235
|
-
interface SequenceExpression extends BaseExpression {
|
|
236
|
-
type: "SequenceExpression";
|
|
237
|
-
expressions: Expression[];
|
|
238
|
-
}
|
|
239
|
-
interface UnaryExpression extends BaseExpression {
|
|
240
|
-
type: "UnaryExpression";
|
|
241
|
-
operator: UnaryOperator;
|
|
242
|
-
prefix: true;
|
|
243
|
-
argument: Expression;
|
|
244
|
-
}
|
|
245
|
-
interface BinaryExpression extends BaseExpression {
|
|
246
|
-
type: "BinaryExpression";
|
|
247
|
-
operator: BinaryOperator;
|
|
248
|
-
left: Expression | PrivateIdentifier;
|
|
249
|
-
right: Expression;
|
|
250
|
-
}
|
|
251
|
-
interface AssignmentExpression extends BaseExpression {
|
|
252
|
-
type: "AssignmentExpression";
|
|
253
|
-
operator: AssignmentOperator;
|
|
254
|
-
left: Pattern | MemberExpression;
|
|
255
|
-
right: Expression;
|
|
256
|
-
}
|
|
257
|
-
interface UpdateExpression extends BaseExpression {
|
|
258
|
-
type: "UpdateExpression";
|
|
259
|
-
operator: UpdateOperator;
|
|
260
|
-
argument: Expression;
|
|
261
|
-
prefix: boolean;
|
|
262
|
-
}
|
|
263
|
-
interface LogicalExpression extends BaseExpression {
|
|
264
|
-
type: "LogicalExpression";
|
|
265
|
-
operator: LogicalOperator;
|
|
266
|
-
left: Expression;
|
|
267
|
-
right: Expression;
|
|
268
|
-
}
|
|
269
|
-
interface ConditionalExpression extends BaseExpression {
|
|
270
|
-
type: "ConditionalExpression";
|
|
271
|
-
test: Expression;
|
|
272
|
-
alternate: Expression;
|
|
273
|
-
consequent: Expression;
|
|
274
|
-
}
|
|
275
|
-
interface BaseCallExpression extends BaseExpression {
|
|
276
|
-
callee: Expression | Super;
|
|
277
|
-
arguments: Array<Expression | SpreadElement>;
|
|
278
|
-
}
|
|
279
|
-
type CallExpression = SimpleCallExpression | NewExpression;
|
|
280
|
-
interface SimpleCallExpression extends BaseCallExpression {
|
|
281
|
-
type: "CallExpression";
|
|
282
|
-
optional: boolean;
|
|
283
|
-
}
|
|
284
|
-
interface NewExpression extends BaseCallExpression {
|
|
285
|
-
type: "NewExpression";
|
|
286
|
-
}
|
|
287
|
-
interface MemberExpression extends BaseExpression, BasePattern {
|
|
288
|
-
type: "MemberExpression";
|
|
289
|
-
object: Expression | Super;
|
|
290
|
-
property: Expression | PrivateIdentifier;
|
|
291
|
-
computed: boolean;
|
|
292
|
-
optional: boolean;
|
|
293
|
-
}
|
|
294
|
-
type Pattern = Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression;
|
|
295
|
-
interface BasePattern extends BaseNode {}
|
|
296
|
-
interface SwitchCase extends BaseNode {
|
|
297
|
-
type: "SwitchCase";
|
|
298
|
-
test?: Expression | null | undefined;
|
|
299
|
-
consequent: Statement[];
|
|
300
|
-
}
|
|
301
|
-
interface CatchClause extends BaseNode {
|
|
302
|
-
type: "CatchClause";
|
|
303
|
-
param: Pattern | null;
|
|
304
|
-
body: BlockStatement;
|
|
305
|
-
}
|
|
306
|
-
interface Identifier extends BaseNode, BaseExpression, BasePattern {
|
|
307
|
-
type: "Identifier";
|
|
308
|
-
name: string;
|
|
309
|
-
}
|
|
310
|
-
type Literal = SimpleLiteral | RegExpLiteral | BigIntLiteral;
|
|
311
|
-
interface SimpleLiteral extends BaseNode, BaseExpression {
|
|
312
|
-
type: "Literal";
|
|
313
|
-
value: string | boolean | number | null;
|
|
314
|
-
raw?: string | undefined;
|
|
315
|
-
}
|
|
316
|
-
interface RegExpLiteral extends BaseNode, BaseExpression {
|
|
317
|
-
type: "Literal";
|
|
318
|
-
value?: RegExp | null | undefined;
|
|
319
|
-
regex: {
|
|
320
|
-
pattern: string;
|
|
321
|
-
flags: string;
|
|
322
|
-
};
|
|
323
|
-
raw?: string | undefined;
|
|
324
|
-
}
|
|
325
|
-
interface BigIntLiteral extends BaseNode, BaseExpression {
|
|
326
|
-
type: "Literal";
|
|
327
|
-
value?: bigint | null | undefined;
|
|
328
|
-
bigint: string;
|
|
329
|
-
raw?: string | undefined;
|
|
330
|
-
}
|
|
331
|
-
type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete";
|
|
332
|
-
type BinaryOperator = "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "**" | "|" | "^" | "&" | "in" | "instanceof";
|
|
333
|
-
type LogicalOperator = "||" | "&&" | "??";
|
|
334
|
-
type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "**=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" | "||=" | "&&=" | "??=";
|
|
335
|
-
type UpdateOperator = "++" | "--";
|
|
336
|
-
interface ForOfStatement extends BaseForXStatement {
|
|
337
|
-
type: "ForOfStatement";
|
|
338
|
-
await: boolean;
|
|
339
|
-
}
|
|
340
|
-
interface Super extends BaseNode {
|
|
341
|
-
type: "Super";
|
|
342
|
-
}
|
|
343
|
-
interface SpreadElement extends BaseNode {
|
|
344
|
-
type: "SpreadElement";
|
|
345
|
-
argument: Expression;
|
|
346
|
-
}
|
|
347
|
-
interface ArrowFunctionExpression extends BaseExpression, BaseFunction {
|
|
348
|
-
type: "ArrowFunctionExpression";
|
|
349
|
-
expression: boolean;
|
|
350
|
-
body: BlockStatement | Expression;
|
|
351
|
-
}
|
|
352
|
-
interface YieldExpression extends BaseExpression {
|
|
353
|
-
type: "YieldExpression";
|
|
354
|
-
argument?: Expression | null | undefined;
|
|
355
|
-
delegate: boolean;
|
|
356
|
-
}
|
|
357
|
-
interface TemplateLiteral extends BaseExpression {
|
|
358
|
-
type: "TemplateLiteral";
|
|
359
|
-
quasis: TemplateElement[];
|
|
360
|
-
expressions: Expression[];
|
|
361
|
-
}
|
|
362
|
-
interface TaggedTemplateExpression extends BaseExpression {
|
|
363
|
-
type: "TaggedTemplateExpression";
|
|
364
|
-
tag: Expression;
|
|
365
|
-
quasi: TemplateLiteral;
|
|
366
|
-
}
|
|
367
|
-
interface TemplateElement extends BaseNode {
|
|
368
|
-
type: "TemplateElement";
|
|
369
|
-
tail: boolean;
|
|
370
|
-
value: {
|
|
371
|
-
/** It is null when the template literal is tagged and the text has an invalid escape (e.g. - tag`\unicode and \u{55}`) */cooked?: string | null | undefined;
|
|
372
|
-
raw: string;
|
|
373
|
-
};
|
|
374
|
-
}
|
|
375
|
-
interface AssignmentProperty extends Property {
|
|
376
|
-
value: Pattern;
|
|
377
|
-
kind: "init";
|
|
378
|
-
method: boolean; // false
|
|
379
|
-
}
|
|
380
|
-
interface ObjectPattern extends BasePattern {
|
|
381
|
-
type: "ObjectPattern";
|
|
382
|
-
properties: Array<AssignmentProperty | RestElement>;
|
|
383
|
-
}
|
|
384
|
-
interface ArrayPattern extends BasePattern {
|
|
385
|
-
type: "ArrayPattern";
|
|
386
|
-
elements: Array<Pattern | null>;
|
|
387
|
-
}
|
|
388
|
-
interface RestElement extends BasePattern {
|
|
389
|
-
type: "RestElement";
|
|
390
|
-
argument: Pattern;
|
|
391
|
-
}
|
|
392
|
-
interface AssignmentPattern extends BasePattern {
|
|
393
|
-
type: "AssignmentPattern";
|
|
394
|
-
left: Pattern;
|
|
395
|
-
right: Expression;
|
|
396
|
-
}
|
|
397
|
-
interface BaseClass extends BaseNode {
|
|
398
|
-
superClass?: Expression | null | undefined;
|
|
399
|
-
body: ClassBody;
|
|
400
|
-
}
|
|
401
|
-
interface ClassBody extends BaseNode {
|
|
402
|
-
type: "ClassBody";
|
|
403
|
-
body: Array<MethodDefinition | PropertyDefinition | StaticBlock>;
|
|
404
|
-
}
|
|
405
|
-
interface MethodDefinition extends BaseNode {
|
|
406
|
-
type: "MethodDefinition";
|
|
407
|
-
key: Expression | PrivateIdentifier;
|
|
408
|
-
value: FunctionExpression;
|
|
409
|
-
kind: "constructor" | "method" | "get" | "set";
|
|
410
|
-
computed: boolean;
|
|
411
|
-
static: boolean;
|
|
412
|
-
}
|
|
413
|
-
interface MaybeNamedClassDeclaration extends BaseClass, BaseDeclaration {
|
|
414
|
-
type: "ClassDeclaration";
|
|
415
|
-
/** It is null when a class declaration is a part of the `export default class` statement */
|
|
416
|
-
id: Identifier | null;
|
|
417
|
-
}
|
|
418
|
-
interface ClassDeclaration extends MaybeNamedClassDeclaration {
|
|
419
|
-
id: Identifier;
|
|
420
|
-
}
|
|
421
|
-
interface ClassExpression extends BaseClass, BaseExpression {
|
|
422
|
-
type: "ClassExpression";
|
|
423
|
-
id?: Identifier | null | undefined;
|
|
424
|
-
}
|
|
425
|
-
interface MetaProperty extends BaseExpression {
|
|
426
|
-
type: "MetaProperty";
|
|
427
|
-
meta: Identifier;
|
|
428
|
-
property: Identifier;
|
|
429
|
-
}
|
|
430
|
-
interface ImportExpression extends BaseExpression {
|
|
431
|
-
type: "ImportExpression";
|
|
432
|
-
source: Expression;
|
|
433
|
-
}
|
|
434
|
-
interface AwaitExpression extends BaseExpression {
|
|
435
|
-
type: "AwaitExpression";
|
|
436
|
-
argument: Expression;
|
|
437
|
-
}
|
|
438
|
-
//#endregion
|
|
439
|
-
//#region src/addObjectProperty.d.ts
|
|
440
|
-
/**
|
|
441
|
-
* Given an ObjectProperty, and a rule fixer, this function yields the addition
|
|
442
|
-
* of a new property to the given ObjectExpression, along with any necessary commas.
|
|
443
|
-
* The new property is at the end of the object.
|
|
444
|
-
* @param context ESLint Rule Context
|
|
445
|
-
* @param fixer Rule fixer
|
|
446
|
-
* @param objectExpression The object expression to which the property will be added
|
|
447
|
-
* @param propertyKey The key for the new property
|
|
448
|
-
* @param propertyValue The value for the new property
|
|
449
|
-
* @yields fixer addition for the new property into the object expression, as well as any necessary commas
|
|
450
|
-
*/
|
|
451
|
-
declare function addObjectProperty(context: Rule.RuleContext, fixer: Rule.RuleFixer, objectExpression: ObjectExpression, propertyKey: string, propertyValue: unknown): Generator<Rule.Fix, void>;
|
|
452
|
-
//#endregion
|
|
453
|
-
//#region src/fixAddObjectProperty.d.ts
|
|
454
|
-
/**
|
|
455
|
-
* Given an ObjectExpression and the key and value of a property,
|
|
456
|
-
* this function returns a fixer function that you can provide to a report
|
|
457
|
-
* descriptor that will add the new property to it.
|
|
458
|
-
* @param context ESLint Rule Context
|
|
459
|
-
* @param objectExpression The object expression to which the property will be added
|
|
460
|
-
* @param propertyKey The key for the new property
|
|
461
|
-
* @param propertyValue The value for the new property
|
|
462
|
-
* @returns a fixer function that you can provide to a report descriptor that
|
|
463
|
-
* adds a new property to an object expression, along with any commas that
|
|
464
|
-
* are needed.
|
|
465
|
-
*/
|
|
466
|
-
declare const fixAddObjectProperty: (context: Rule.RuleContext, objectExpression: ObjectExpression, propertyKey: string, propertyValue: unknown) => ((fixer: Rule.RuleFixer) => Generator<Rule.Fix, void>);
|
|
467
|
-
//#endregion
|
|
468
|
-
//#region src/removeArrayElement.d.ts
|
|
469
|
-
type ArrayElement = Expression | SpreadElement;
|
|
470
|
-
type ArrayElementsOrParent = ArrayExpression | ArrayExpression["elements"];
|
|
471
|
-
/**
|
|
472
|
-
* Given an ArrayExpression or the list of elements an ArrayExpression has,
|
|
473
|
-
* the index or node within that array that you want to remove, and a rule fixer,
|
|
474
|
-
* this function yields removals for the node itself, as well as any trailing
|
|
475
|
-
* commas that are no longer necessary.
|
|
476
|
-
* @param context ESLint Rule Context
|
|
477
|
-
* @param fixer Rule fixer
|
|
478
|
-
* @param elementOrIndex The child expression, spread element, or a numeric
|
|
479
|
-
* index of the child
|
|
480
|
-
* @param parentOrElements The array expression node, or its `.elements` array
|
|
481
|
-
* @yields fixer removals for the node itself, as well as any trailing commas
|
|
482
|
-
* that are no longer necessary.
|
|
483
|
-
*/
|
|
484
|
-
declare function removeArrayElement(context: Rule.RuleContext, fixer: Rule.RuleFixer, elementOrIndex: ArrayElement | number, parentOrElements: ArrayElementsOrParent): Generator<Rule.Fix, void>;
|
|
485
|
-
//#endregion
|
|
486
|
-
//#region src/fixRemoveArrayElement.d.ts
|
|
487
|
-
/**
|
|
488
|
-
* Given an ArrayExpression or the list of elements an ArrayExpression has, and
|
|
489
|
-
* the index or node within that array that you want to remove, this function
|
|
490
|
-
* returns a fixer function that you can provide to a report descriptor that
|
|
491
|
-
* will remove that node along with any trailing comma.
|
|
492
|
-
* @param context ESLint Rule Context
|
|
493
|
-
* @param elementOrIndex The child expression, spread element, or a numeric
|
|
494
|
-
* index of the child
|
|
495
|
-
* @param parentOrElements The array expression node, or its `.elements` array
|
|
496
|
-
* @returns a fixer function that you can provide to a report descriptor, that
|
|
497
|
-
* removes an element from an array expression, along with any commas that are
|
|
498
|
-
* no longer necessary.
|
|
499
|
-
*/
|
|
500
|
-
declare const fixRemoveArrayElement: (context: Rule.RuleContext, elementOrIndex: ArrayElement | number, parentOrElements: ArrayElementsOrParent) => ((fixer: Rule.RuleFixer) => Generator<Rule.Fix, void>);
|
|
501
|
-
//#endregion
|
|
502
|
-
//#region src/removeObjectProperty.d.ts
|
|
503
|
-
type ObjectProperty = Property | SpreadElement;
|
|
504
|
-
/**
|
|
505
|
-
* Given an ObjectProperty, and a rule fixer, this function yields removals for
|
|
506
|
-
* the node itself, as well as any trailing commas that are no longer necessary.
|
|
507
|
-
* @param context ESLint Rule Context
|
|
508
|
-
* @param fixer Rule fixer
|
|
509
|
-
* @param property The property node
|
|
510
|
-
* @yields fixer removals for the node itself, as well as any trailing commas
|
|
511
|
-
* that are no longer necessary.
|
|
512
|
-
*/
|
|
513
|
-
declare function removeObjectProperty(context: Rule.RuleContext, fixer: Rule.RuleFixer, property: ObjectProperty): Generator<Rule.Fix, void>;
|
|
514
|
-
//#endregion
|
|
515
|
-
//#region src/fixRemoveObjectProperty.d.ts
|
|
516
|
-
/**
|
|
517
|
-
* Given an ObjectProperty, this function returns a fixer function that you can
|
|
518
|
-
* provide to a report descriptor that will remove that node along with any
|
|
519
|
-
* trailing comma.
|
|
520
|
-
* @param context ESLint Rule Context
|
|
521
|
-
* @param property The property node
|
|
522
|
-
* @returns a fixer function that you can provide to a report descriptor, that
|
|
523
|
-
* removes a property from an object expression, along with any commas that
|
|
524
|
-
* are no longer necessary.
|
|
525
|
-
*/
|
|
526
|
-
declare const fixRemoveObjectProperty: (context: Rule.RuleContext, property: ObjectProperty) => ((fixer: Rule.RuleFixer) => Generator<Rule.Fix, void>);
|
|
527
|
-
//#endregion
|
|
528
|
-
export { type ArrayElement, type ArrayElementsOrParent, type ObjectProperty, addObjectProperty, fixAddObjectProperty, fixRemoveArrayElement, fixRemoveObjectProperty, removeArrayElement, removeObjectProperty };
|