eslint-fix-utils 0.4.3 → 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/dist/index.d.mts +92 -0
- package/package.json +32 -34
- package/lib/index.d.mts +0 -93
- /package/{lib → dist}/index.mjs +0 -0
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/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,47 +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
|
-
"
|
|
31
|
+
"dist/"
|
|
35
32
|
],
|
|
36
33
|
"devDependencies": {
|
|
37
|
-
"@eslint-community/eslint-plugin-eslint-comments": "4.
|
|
34
|
+
"@eslint-community/eslint-plugin-eslint-comments": "4.8.1",
|
|
38
35
|
"@eslint/js": "10.0.1",
|
|
39
|
-
"@eslint/json": "2.
|
|
40
|
-
"@eslint/markdown": "8.0.
|
|
36
|
+
"@eslint/json": "2.1.0",
|
|
37
|
+
"@eslint/markdown": "8.0.3",
|
|
41
38
|
"@ianvs/prettier-plugin-sort-imports": "4.7.1",
|
|
42
|
-
"@types/estree": "1.0.
|
|
43
|
-
"@types/node": "24.13.
|
|
44
|
-
"@
|
|
45
|
-
"@vitest/
|
|
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",
|
|
46
44
|
"console-fail-test": "0.6.1",
|
|
47
|
-
"eslint": "10.
|
|
48
|
-
"eslint-plugin-jsdoc": "
|
|
49
|
-
"eslint-plugin-jsonc": "3.2
|
|
50
|
-
"eslint-plugin-n": "18.
|
|
51
|
-
"eslint-plugin-package-json": "1.
|
|
52
|
-
"eslint-plugin-perfectionist": "5.
|
|
53
|
-
"eslint-plugin-regexp": "3.
|
|
54
|
-
"eslint-plugin-yml": "3.
|
|
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",
|
|
55
53
|
"jiti": "2.7.0",
|
|
56
|
-
"knip": "6.
|
|
57
|
-
"prettier": "3.9.
|
|
58
|
-
"prettier-plugin-curly": "0.4.
|
|
59
|
-
"prettier-plugin-packagejson": "3.0.
|
|
60
|
-
"prettier-plugin-sh": "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",
|
|
61
59
|
"pretty-quick": "4.2.2",
|
|
62
|
-
"simple-git-hooks": "2.
|
|
63
|
-
"tsdown": "0.
|
|
64
|
-
"typescript": "6.0.
|
|
65
|
-
"typescript-eslint": "8.
|
|
66
|
-
"vitest": "
|
|
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"
|
|
67
65
|
},
|
|
68
66
|
"peerDependencies": {
|
|
69
67
|
"@types/estree": ">=1",
|
package/lib/index.d.mts
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { Rule } from "eslint";
|
|
2
|
-
import * as ESTree from "estree";
|
|
3
|
-
|
|
4
|
-
//#region src/addObjectProperty.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Given an ObjectProperty, and a rule fixer, this function yields the addition
|
|
7
|
-
* of a new property to the given ObjectExpression, along with any necessary commas.
|
|
8
|
-
* The new property is at the end of the object.
|
|
9
|
-
* @param context ESLint Rule Context
|
|
10
|
-
* @param fixer Rule fixer
|
|
11
|
-
* @param objectExpression The object expression to which the property will be added
|
|
12
|
-
* @param propertyKey The key for the new property
|
|
13
|
-
* @param propertyValue The value for the new property
|
|
14
|
-
* @yields fixer addition for the new property into the object expression, as well as any necessary commas
|
|
15
|
-
*/
|
|
16
|
-
declare function addObjectProperty(context: Rule.RuleContext, fixer: Rule.RuleFixer, objectExpression: ESTree.ObjectExpression, propertyKey: string, propertyValue: unknown): Generator<Rule.Fix, void>;
|
|
17
|
-
//#endregion
|
|
18
|
-
//#region src/fixAddObjectProperty.d.ts
|
|
19
|
-
/**
|
|
20
|
-
* Given an ObjectExpression and the key and value of a property,
|
|
21
|
-
* this function returns a fixer function that you can provide to a report
|
|
22
|
-
* descriptor that will add the new property to it.
|
|
23
|
-
* @param context ESLint Rule Context
|
|
24
|
-
* @param objectExpression The object expression to which the property will be added
|
|
25
|
-
* @param propertyKey The key for the new property
|
|
26
|
-
* @param propertyValue The value for the new property
|
|
27
|
-
* @returns a fixer function that you can provide to a report descriptor that
|
|
28
|
-
* adds a new property to an object expression, along with any commas that
|
|
29
|
-
* are needed.
|
|
30
|
-
*/
|
|
31
|
-
declare const fixAddObjectProperty: (context: Rule.RuleContext, objectExpression: ESTree.ObjectExpression, propertyKey: string, propertyValue: unknown) => ((fixer: Rule.RuleFixer) => Generator<Rule.Fix, void>);
|
|
32
|
-
//#endregion
|
|
33
|
-
//#region src/removeArrayElement.d.ts
|
|
34
|
-
type ArrayElement = ESTree.Expression | ESTree.SpreadElement;
|
|
35
|
-
type ArrayElementsOrParent = ESTree.ArrayExpression | ESTree.ArrayExpression["elements"];
|
|
36
|
-
/**
|
|
37
|
-
* Given an ArrayExpression or the list of elements an ArrayExpression has,
|
|
38
|
-
* the index or node within that array that you want to remove, and a rule fixer,
|
|
39
|
-
* this function yields removals for the node itself, as well as any trailing
|
|
40
|
-
* commas that are no longer necessary.
|
|
41
|
-
* @param context ESLint Rule Context
|
|
42
|
-
* @param fixer Rule fixer
|
|
43
|
-
* @param elementOrIndex The child expression, spread element, or a numeric
|
|
44
|
-
* index of the child
|
|
45
|
-
* @param parentOrElements The array expression node, or its `.elements` array
|
|
46
|
-
* @yields fixer removals for the node itself, as well as any trailing commas
|
|
47
|
-
* that are no longer necessary.
|
|
48
|
-
*/
|
|
49
|
-
declare function removeArrayElement(context: Rule.RuleContext, fixer: Rule.RuleFixer, elementOrIndex: ArrayElement | number, parentOrElements: ArrayElementsOrParent): Generator<Rule.Fix, void>;
|
|
50
|
-
//#endregion
|
|
51
|
-
//#region src/fixRemoveArrayElement.d.ts
|
|
52
|
-
/**
|
|
53
|
-
* Given an ArrayExpression or the list of elements an ArrayExpression has, and
|
|
54
|
-
* the index or node within that array that you want to remove, this function
|
|
55
|
-
* returns a fixer function that you can provide to a report descriptor that
|
|
56
|
-
* will remove that node along with any trailing comma.
|
|
57
|
-
* @param context ESLint Rule Context
|
|
58
|
-
* @param elementOrIndex The child expression, spread element, or a numeric
|
|
59
|
-
* index of the child
|
|
60
|
-
* @param parentOrElements The array expression node, or its `.elements` array
|
|
61
|
-
* @returns a fixer function that you can provide to a report descriptor, that
|
|
62
|
-
* removes an element from an array expression, along with any commas that are
|
|
63
|
-
* no longer necessary.
|
|
64
|
-
*/
|
|
65
|
-
declare const fixRemoveArrayElement: (context: Rule.RuleContext, elementOrIndex: ArrayElement | number, parentOrElements: ArrayElementsOrParent) => ((fixer: Rule.RuleFixer) => Generator<Rule.Fix, void>);
|
|
66
|
-
//#endregion
|
|
67
|
-
//#region src/removeObjectProperty.d.ts
|
|
68
|
-
type ObjectProperty = ESTree.Property | ESTree.SpreadElement;
|
|
69
|
-
/**
|
|
70
|
-
* Given an ObjectProperty, and a rule fixer, this function yields removals for
|
|
71
|
-
* the node itself, as well as any trailing commas that are no longer necessary.
|
|
72
|
-
* @param context ESLint Rule Context
|
|
73
|
-
* @param fixer Rule fixer
|
|
74
|
-
* @param property The property node
|
|
75
|
-
* @yields fixer removals for the node itself, as well as any trailing commas
|
|
76
|
-
* that are no longer necessary.
|
|
77
|
-
*/
|
|
78
|
-
declare function removeObjectProperty(context: Rule.RuleContext, fixer: Rule.RuleFixer, property: ObjectProperty): Generator<Rule.Fix, void>;
|
|
79
|
-
//#endregion
|
|
80
|
-
//#region src/fixRemoveObjectProperty.d.ts
|
|
81
|
-
/**
|
|
82
|
-
* Given an ObjectProperty, this function returns a fixer function that you can
|
|
83
|
-
* provide to a report descriptor that will remove that node along with any
|
|
84
|
-
* trailing comma.
|
|
85
|
-
* @param context ESLint Rule Context
|
|
86
|
-
* @param property The property node
|
|
87
|
-
* @returns a fixer function that you can provide to a report descriptor, that
|
|
88
|
-
* removes a property from an object expression, along with any commas that
|
|
89
|
-
* are no longer necessary.
|
|
90
|
-
*/
|
|
91
|
-
declare const fixRemoveObjectProperty: (context: Rule.RuleContext, property: ObjectProperty) => ((fixer: Rule.RuleFixer) => Generator<Rule.Fix, void>);
|
|
92
|
-
//#endregion
|
|
93
|
-
export { type ArrayElement, type ArrayElementsOrParent, type ObjectProperty, addObjectProperty, fixAddObjectProperty, fixRemoveArrayElement, fixRemoveObjectProperty, removeArrayElement, removeObjectProperty };
|
/package/{lib → dist}/index.mjs
RENAMED
|
File without changes
|