eslint-plugin-maintainability 3.0.9 → 3.0.10
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/package.json +5 -17
- package/src/index.d.ts +15 -250
- package/src/index.js +1 -17
- package/src/oxlint.d.ts +17 -20
- package/src/oxlint.js +0 -18
- package/src/rules/error-handling/error-message.js +0 -17
- package/src/rules/error-handling/no-missing-error-context.js +1 -21
- package/src/rules/error-handling/no-silent-errors.js +1 -21
- package/src/rules/error-handling/no-unhandled-promise.js +4 -100
- package/src/rules/maintainability/cognitive-complexity.js +3 -46
- package/src/rules/maintainability/consistent-function-scoping.js +0 -45
- package/src/rules/maintainability/identical-functions.js +0 -43
- package/src/rules/maintainability/max-parameters.js +2 -17
- package/src/rules/maintainability/nested-complexity-hotspots.js +1 -55
- package/src/rules/maintainability/no-lonely-if.js +0 -15
- package/src/rules/maintainability/no-nested-ternary.js +0 -27
- package/src/rules/maintainability/no-unreadable-iife.js +1 -21
- package/src/types/index.js +0 -5
- package/CHANGELOG.md +0 -192
- package/src/rules/error-handling/error-message.d.ts +0 -20
- package/src/rules/error-handling/no-missing-error-context.d.ts +0 -26
- package/src/rules/error-handling/no-silent-errors.d.ts +0 -24
- package/src/rules/error-handling/no-unhandled-promise.d.ts +0 -41
- package/src/rules/maintainability/cognitive-complexity.d.ts +0 -28
- package/src/rules/maintainability/consistent-function-scoping.d.ts +0 -20
- package/src/rules/maintainability/identical-functions.d.ts +0 -33
- package/src/rules/maintainability/max-parameters.d.ts +0 -29
- package/src/rules/maintainability/nested-complexity-hotspots.d.ts +0 -31
- package/src/rules/maintainability/no-lonely-if.d.ts +0 -19
- package/src/rules/maintainability/no-nested-ternary.d.ts +0 -19
- package/src/rules/maintainability/no-unreadable-iife.d.ts +0 -24
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-maintainability",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.10",
|
|
4
4
|
"description": "ESLint plugin for maintainable code — limits cognitive complexity, nesting depth, parameter counts, duplicate functions, and unhandled or silent errors.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -26,10 +26,8 @@
|
|
|
26
26
|
},
|
|
27
27
|
"files": [
|
|
28
28
|
"src/",
|
|
29
|
-
"dist/",
|
|
30
29
|
"README.md",
|
|
31
|
-
"LICENSE"
|
|
32
|
-
"CHANGELOG.md"
|
|
30
|
+
"LICENSE"
|
|
33
31
|
],
|
|
34
32
|
"keywords": [
|
|
35
33
|
"eslint",
|
|
@@ -65,29 +63,19 @@
|
|
|
65
63
|
},
|
|
66
64
|
"dependencies": {
|
|
67
65
|
"tslib": "^2.3.0",
|
|
68
|
-
"@interlace/eslint-devkit": "
|
|
69
|
-
},
|
|
70
|
-
"devDependencies": {
|
|
71
|
-
"@typescript-eslint/parser": "^8.46.2",
|
|
72
|
-
"@typescript-eslint/rule-tester": "^8.46.2"
|
|
66
|
+
"@interlace/eslint-devkit": "^1.6.1"
|
|
73
67
|
},
|
|
74
68
|
"repository": {
|
|
75
69
|
"type": "git",
|
|
76
|
-
"url": "https://github.com/ofri-peretz/eslint",
|
|
70
|
+
"url": "git+https://github.com/ofri-peretz/eslint.git",
|
|
77
71
|
"directory": "packages/eslint-plugin-maintainability"
|
|
78
72
|
},
|
|
79
73
|
"homepage": "https://eslint.interlace.tools/docs/quality/plugin-maintainability?utm_source=npm&utm_medium=referral&utm_campaign=eslint-plugin-maintainability",
|
|
80
74
|
"bugs": {
|
|
81
75
|
"url": "https://github.com/ofri-peretz/eslint/issues"
|
|
82
76
|
},
|
|
83
|
-
"scripts": {
|
|
84
|
-
"build": "tsx ../../scripts/build-package.ts",
|
|
85
|
-
"test": "vitest run",
|
|
86
|
-
"test:coverage": "vitest run --coverage",
|
|
87
|
-
"typecheck": "tsc -p tsconfig.lib.json --noEmit"
|
|
88
|
-
},
|
|
89
77
|
"funding": {
|
|
90
78
|
"type": "github",
|
|
91
|
-
"url": "https://github.com/ofri-peretz/eslint"
|
|
79
|
+
"url": "git+https://github.com/ofri-peretz/eslint.git"
|
|
92
80
|
}
|
|
93
81
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -1,252 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
'nested-complexity-hotspots': TSESLint.RuleModule<"extractMethod" | "nestedComplexity" | "useEarlyReturn" | "useGuardClauses", [(import("./rules/maintainability/nested-complexity-hotspots").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
12
|
-
name: string;
|
|
13
|
-
};
|
|
14
|
-
'identical-functions': TSESLint.RuleModule<"identicalFunctions" | "extractGeneric" | "useHigherOrder" | "applyInheritance", [(import("./rules/maintainability/identical-functions").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
15
|
-
name: string;
|
|
16
|
-
};
|
|
17
|
-
'max-parameters': TSESLint.RuleModule<"tooManyParameters" | "useObjectParameter" | "extractToClass" | "splitFunction", [(import("./rules/maintainability/max-parameters").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
18
|
-
name: string;
|
|
19
|
-
};
|
|
20
|
-
'no-lonely-if': TSESLint.RuleModule<"noLonelyIf", [(import("./rules/maintainability/no-lonely-if").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
21
|
-
name: string;
|
|
22
|
-
};
|
|
23
|
-
'no-nested-ternary': TSESLint.RuleModule<"noNestedTernary", [(import("./rules/maintainability/no-nested-ternary").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
24
|
-
name: string;
|
|
25
|
-
};
|
|
26
|
-
'consistent-function-scoping': TSESLint.RuleModule<"inconsistentFunctionScoping" | "moveToModuleScope", [(import("./rules/maintainability/consistent-function-scoping").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
27
|
-
name: string;
|
|
28
|
-
};
|
|
29
|
-
'no-unreadable-iife': TSESLint.RuleModule<"unreadableIIFE" | "suggestNamedFunction" | "suggestBlockScope" | "complexIIFE", [(import("./rules/maintainability/no-unreadable-iife").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
30
|
-
name: string;
|
|
31
|
-
};
|
|
32
|
-
'error-message': TSESLint.RuleModule<"missingErrorMessage" | "addErrorMessage", [(import("./rules/error-handling/error-message").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
33
|
-
name: string;
|
|
34
|
-
};
|
|
35
|
-
'no-missing-error-context': TSESLint.RuleModule<"addErrorMessage" | "missingErrorContext" | "addErrorStack" | "useErrorClass", [(import("./rules/error-handling/no-missing-error-context").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
36
|
-
name: string;
|
|
37
|
-
};
|
|
38
|
-
'no-silent-errors': TSESLint.RuleModule<"silentError" | "addErrorLogging" | "addErrorHandling" | "rethrowError", [(import("./rules/error-handling/no-silent-errors").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
39
|
-
name: string;
|
|
40
|
-
};
|
|
41
|
-
'no-unhandled-promise': TSESLint.RuleModule<"unhandledPromise" | "addCatch" | "useTryCatch" | "useAwait", [(import("./rules/error-handling/no-unhandled-promise").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
42
|
-
name: string;
|
|
43
|
-
};
|
|
44
|
-
'maintainability/cognitive-complexity': TSESLint.RuleModule<"highCognitiveComplexity" | "extractMethod" | "simplifyLogic" | "useStrategy", [(import("./rules/maintainability/cognitive-complexity").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
45
|
-
name: string;
|
|
46
|
-
};
|
|
47
|
-
'maintainability/nested-complexity-hotspots': TSESLint.RuleModule<"extractMethod" | "nestedComplexity" | "useEarlyReturn" | "useGuardClauses", [(import("./rules/maintainability/nested-complexity-hotspots").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
48
|
-
name: string;
|
|
49
|
-
};
|
|
50
|
-
'maintainability/identical-functions': TSESLint.RuleModule<"identicalFunctions" | "extractGeneric" | "useHigherOrder" | "applyInheritance", [(import("./rules/maintainability/identical-functions").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
51
|
-
name: string;
|
|
52
|
-
};
|
|
53
|
-
'maintainability/max-parameters': TSESLint.RuleModule<"tooManyParameters" | "useObjectParameter" | "extractToClass" | "splitFunction", [(import("./rules/maintainability/max-parameters").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
54
|
-
name: string;
|
|
55
|
-
};
|
|
56
|
-
'maintainability/no-lonely-if': TSESLint.RuleModule<"noLonelyIf", [(import("./rules/maintainability/no-lonely-if").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
57
|
-
name: string;
|
|
58
|
-
};
|
|
59
|
-
'maintainability/no-nested-ternary': TSESLint.RuleModule<"noNestedTernary", [(import("./rules/maintainability/no-nested-ternary").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
60
|
-
name: string;
|
|
61
|
-
};
|
|
62
|
-
'maintainability/consistent-function-scoping': TSESLint.RuleModule<"inconsistentFunctionScoping" | "moveToModuleScope", [(import("./rules/maintainability/consistent-function-scoping").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
63
|
-
name: string;
|
|
64
|
-
};
|
|
65
|
-
'maintainability/no-unreadable-iife': TSESLint.RuleModule<"unreadableIIFE" | "suggestNamedFunction" | "suggestBlockScope" | "complexIIFE", [(import("./rules/maintainability/no-unreadable-iife").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
66
|
-
name: string;
|
|
67
|
-
};
|
|
68
|
-
'maintainability/error-message': TSESLint.RuleModule<"missingErrorMessage" | "addErrorMessage", [(import("./rules/error-handling/error-message").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
69
|
-
name: string;
|
|
70
|
-
};
|
|
71
|
-
'maintainability/no-missing-error-context': TSESLint.RuleModule<"addErrorMessage" | "missingErrorContext" | "addErrorStack" | "useErrorClass", [(import("./rules/error-handling/no-missing-error-context").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
72
|
-
name: string;
|
|
73
|
-
};
|
|
74
|
-
'maintainability/no-silent-errors': TSESLint.RuleModule<"silentError" | "addErrorLogging" | "addErrorHandling" | "rethrowError", [(import("./rules/error-handling/no-silent-errors").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
75
|
-
name: string;
|
|
76
|
-
};
|
|
77
|
-
'maintainability/no-unhandled-promise': TSESLint.RuleModule<"unhandledPromise" | "addCatch" | "useTryCatch" | "useAwait", [(import("./rules/error-handling/no-unhandled-promise").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
78
|
-
name: string;
|
|
79
|
-
};
|
|
80
|
-
};
|
|
1
|
+
// Minimal declaration written by scripts/build-package.ts.
|
|
2
|
+
//
|
|
3
|
+
// tsc's generated entry declaration inlined every inferred rule-option type
|
|
4
|
+
// (up to 166 kB per plugin) for an API no consumer calls directly. This types
|
|
5
|
+
// what a flat config actually touches. Per-rule option types remain available
|
|
6
|
+
// from the "./types" subpath export where a plugin provides one.
|
|
7
|
+
import type { Linter, Rule } from 'eslint';
|
|
8
|
+
|
|
9
|
+
export declare const rules: Record<string, Rule.RuleModule>;
|
|
10
|
+
export declare const configs: Record<string, Linter.Config>;
|
|
81
11
|
export declare const plugin: {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
version: string;
|
|
85
|
-
};
|
|
86
|
-
rules: {
|
|
87
|
-
'cognitive-complexity': TSESLint.RuleModule<"highCognitiveComplexity" | "extractMethod" | "simplifyLogic" | "useStrategy", [(import("./rules/maintainability/cognitive-complexity").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
88
|
-
name: string;
|
|
89
|
-
};
|
|
90
|
-
'nested-complexity-hotspots': TSESLint.RuleModule<"extractMethod" | "nestedComplexity" | "useEarlyReturn" | "useGuardClauses", [(import("./rules/maintainability/nested-complexity-hotspots").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
91
|
-
name: string;
|
|
92
|
-
};
|
|
93
|
-
'identical-functions': TSESLint.RuleModule<"identicalFunctions" | "extractGeneric" | "useHigherOrder" | "applyInheritance", [(import("./rules/maintainability/identical-functions").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
94
|
-
name: string;
|
|
95
|
-
};
|
|
96
|
-
'max-parameters': TSESLint.RuleModule<"tooManyParameters" | "useObjectParameter" | "extractToClass" | "splitFunction", [(import("./rules/maintainability/max-parameters").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
97
|
-
name: string;
|
|
98
|
-
};
|
|
99
|
-
'no-lonely-if': TSESLint.RuleModule<"noLonelyIf", [(import("./rules/maintainability/no-lonely-if").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
100
|
-
name: string;
|
|
101
|
-
};
|
|
102
|
-
'no-nested-ternary': TSESLint.RuleModule<"noNestedTernary", [(import("./rules/maintainability/no-nested-ternary").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
103
|
-
name: string;
|
|
104
|
-
};
|
|
105
|
-
'consistent-function-scoping': TSESLint.RuleModule<"inconsistentFunctionScoping" | "moveToModuleScope", [(import("./rules/maintainability/consistent-function-scoping").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
106
|
-
name: string;
|
|
107
|
-
};
|
|
108
|
-
'no-unreadable-iife': TSESLint.RuleModule<"unreadableIIFE" | "suggestNamedFunction" | "suggestBlockScope" | "complexIIFE", [(import("./rules/maintainability/no-unreadable-iife").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
109
|
-
name: string;
|
|
110
|
-
};
|
|
111
|
-
'error-message': TSESLint.RuleModule<"missingErrorMessage" | "addErrorMessage", [(import("./rules/error-handling/error-message").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
112
|
-
name: string;
|
|
113
|
-
};
|
|
114
|
-
'no-missing-error-context': TSESLint.RuleModule<"addErrorMessage" | "missingErrorContext" | "addErrorStack" | "useErrorClass", [(import("./rules/error-handling/no-missing-error-context").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
115
|
-
name: string;
|
|
116
|
-
};
|
|
117
|
-
'no-silent-errors': TSESLint.RuleModule<"silentError" | "addErrorLogging" | "addErrorHandling" | "rethrowError", [(import("./rules/error-handling/no-silent-errors").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
118
|
-
name: string;
|
|
119
|
-
};
|
|
120
|
-
'no-unhandled-promise': TSESLint.RuleModule<"unhandledPromise" | "addCatch" | "useTryCatch" | "useAwait", [(import("./rules/error-handling/no-unhandled-promise").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
121
|
-
name: string;
|
|
122
|
-
};
|
|
123
|
-
'maintainability/cognitive-complexity': TSESLint.RuleModule<"highCognitiveComplexity" | "extractMethod" | "simplifyLogic" | "useStrategy", [(import("./rules/maintainability/cognitive-complexity").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
124
|
-
name: string;
|
|
125
|
-
};
|
|
126
|
-
'maintainability/nested-complexity-hotspots': TSESLint.RuleModule<"extractMethod" | "nestedComplexity" | "useEarlyReturn" | "useGuardClauses", [(import("./rules/maintainability/nested-complexity-hotspots").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
127
|
-
name: string;
|
|
128
|
-
};
|
|
129
|
-
'maintainability/identical-functions': TSESLint.RuleModule<"identicalFunctions" | "extractGeneric" | "useHigherOrder" | "applyInheritance", [(import("./rules/maintainability/identical-functions").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
130
|
-
name: string;
|
|
131
|
-
};
|
|
132
|
-
'maintainability/max-parameters': TSESLint.RuleModule<"tooManyParameters" | "useObjectParameter" | "extractToClass" | "splitFunction", [(import("./rules/maintainability/max-parameters").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
133
|
-
name: string;
|
|
134
|
-
};
|
|
135
|
-
'maintainability/no-lonely-if': TSESLint.RuleModule<"noLonelyIf", [(import("./rules/maintainability/no-lonely-if").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
136
|
-
name: string;
|
|
137
|
-
};
|
|
138
|
-
'maintainability/no-nested-ternary': TSESLint.RuleModule<"noNestedTernary", [(import("./rules/maintainability/no-nested-ternary").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
139
|
-
name: string;
|
|
140
|
-
};
|
|
141
|
-
'maintainability/consistent-function-scoping': TSESLint.RuleModule<"inconsistentFunctionScoping" | "moveToModuleScope", [(import("./rules/maintainability/consistent-function-scoping").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
142
|
-
name: string;
|
|
143
|
-
};
|
|
144
|
-
'maintainability/no-unreadable-iife': TSESLint.RuleModule<"unreadableIIFE" | "suggestNamedFunction" | "suggestBlockScope" | "complexIIFE", [(import("./rules/maintainability/no-unreadable-iife").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
145
|
-
name: string;
|
|
146
|
-
};
|
|
147
|
-
'maintainability/error-message': TSESLint.RuleModule<"missingErrorMessage" | "addErrorMessage", [(import("./rules/error-handling/error-message").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
148
|
-
name: string;
|
|
149
|
-
};
|
|
150
|
-
'maintainability/no-missing-error-context': TSESLint.RuleModule<"addErrorMessage" | "missingErrorContext" | "addErrorStack" | "useErrorClass", [(import("./rules/error-handling/no-missing-error-context").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
151
|
-
name: string;
|
|
152
|
-
};
|
|
153
|
-
'maintainability/no-silent-errors': TSESLint.RuleModule<"silentError" | "addErrorLogging" | "addErrorHandling" | "rethrowError", [(import("./rules/error-handling/no-silent-errors").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
154
|
-
name: string;
|
|
155
|
-
};
|
|
156
|
-
'maintainability/no-unhandled-promise': TSESLint.RuleModule<"unhandledPromise" | "addCatch" | "useTryCatch" | "useAwait", [(import("./rules/error-handling/no-unhandled-promise").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
157
|
-
name: string;
|
|
158
|
-
};
|
|
159
|
-
};
|
|
160
|
-
};
|
|
161
|
-
export declare const configs: {
|
|
162
|
-
recommended: {
|
|
163
|
-
plugins: {
|
|
164
|
-
maintainability: {
|
|
165
|
-
meta: {
|
|
166
|
-
name: string;
|
|
167
|
-
version: string;
|
|
168
|
-
};
|
|
169
|
-
rules: {
|
|
170
|
-
'cognitive-complexity': TSESLint.RuleModule<"highCognitiveComplexity" | "extractMethod" | "simplifyLogic" | "useStrategy", [(import("./rules/maintainability/cognitive-complexity").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
171
|
-
name: string;
|
|
172
|
-
};
|
|
173
|
-
'nested-complexity-hotspots': TSESLint.RuleModule<"extractMethod" | "nestedComplexity" | "useEarlyReturn" | "useGuardClauses", [(import("./rules/maintainability/nested-complexity-hotspots").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
174
|
-
name: string;
|
|
175
|
-
};
|
|
176
|
-
'identical-functions': TSESLint.RuleModule<"identicalFunctions" | "extractGeneric" | "useHigherOrder" | "applyInheritance", [(import("./rules/maintainability/identical-functions").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
177
|
-
name: string;
|
|
178
|
-
};
|
|
179
|
-
'max-parameters': TSESLint.RuleModule<"tooManyParameters" | "useObjectParameter" | "extractToClass" | "splitFunction", [(import("./rules/maintainability/max-parameters").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
180
|
-
name: string;
|
|
181
|
-
};
|
|
182
|
-
'no-lonely-if': TSESLint.RuleModule<"noLonelyIf", [(import("./rules/maintainability/no-lonely-if").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
183
|
-
name: string;
|
|
184
|
-
};
|
|
185
|
-
'no-nested-ternary': TSESLint.RuleModule<"noNestedTernary", [(import("./rules/maintainability/no-nested-ternary").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
186
|
-
name: string;
|
|
187
|
-
};
|
|
188
|
-
'consistent-function-scoping': TSESLint.RuleModule<"inconsistentFunctionScoping" | "moveToModuleScope", [(import("./rules/maintainability/consistent-function-scoping").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
189
|
-
name: string;
|
|
190
|
-
};
|
|
191
|
-
'no-unreadable-iife': TSESLint.RuleModule<"unreadableIIFE" | "suggestNamedFunction" | "suggestBlockScope" | "complexIIFE", [(import("./rules/maintainability/no-unreadable-iife").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
192
|
-
name: string;
|
|
193
|
-
};
|
|
194
|
-
'error-message': TSESLint.RuleModule<"missingErrorMessage" | "addErrorMessage", [(import("./rules/error-handling/error-message").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
195
|
-
name: string;
|
|
196
|
-
};
|
|
197
|
-
'no-missing-error-context': TSESLint.RuleModule<"addErrorMessage" | "missingErrorContext" | "addErrorStack" | "useErrorClass", [(import("./rules/error-handling/no-missing-error-context").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
198
|
-
name: string;
|
|
199
|
-
};
|
|
200
|
-
'no-silent-errors': TSESLint.RuleModule<"silentError" | "addErrorLogging" | "addErrorHandling" | "rethrowError", [(import("./rules/error-handling/no-silent-errors").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
201
|
-
name: string;
|
|
202
|
-
};
|
|
203
|
-
'no-unhandled-promise': TSESLint.RuleModule<"unhandledPromise" | "addCatch" | "useTryCatch" | "useAwait", [(import("./rules/error-handling/no-unhandled-promise").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
204
|
-
name: string;
|
|
205
|
-
};
|
|
206
|
-
'maintainability/cognitive-complexity': TSESLint.RuleModule<"highCognitiveComplexity" | "extractMethod" | "simplifyLogic" | "useStrategy", [(import("./rules/maintainability/cognitive-complexity").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
207
|
-
name: string;
|
|
208
|
-
};
|
|
209
|
-
'maintainability/nested-complexity-hotspots': TSESLint.RuleModule<"extractMethod" | "nestedComplexity" | "useEarlyReturn" | "useGuardClauses", [(import("./rules/maintainability/nested-complexity-hotspots").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
210
|
-
name: string;
|
|
211
|
-
};
|
|
212
|
-
'maintainability/identical-functions': TSESLint.RuleModule<"identicalFunctions" | "extractGeneric" | "useHigherOrder" | "applyInheritance", [(import("./rules/maintainability/identical-functions").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
213
|
-
name: string;
|
|
214
|
-
};
|
|
215
|
-
'maintainability/max-parameters': TSESLint.RuleModule<"tooManyParameters" | "useObjectParameter" | "extractToClass" | "splitFunction", [(import("./rules/maintainability/max-parameters").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
216
|
-
name: string;
|
|
217
|
-
};
|
|
218
|
-
'maintainability/no-lonely-if': TSESLint.RuleModule<"noLonelyIf", [(import("./rules/maintainability/no-lonely-if").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
219
|
-
name: string;
|
|
220
|
-
};
|
|
221
|
-
'maintainability/no-nested-ternary': TSESLint.RuleModule<"noNestedTernary", [(import("./rules/maintainability/no-nested-ternary").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
222
|
-
name: string;
|
|
223
|
-
};
|
|
224
|
-
'maintainability/consistent-function-scoping': TSESLint.RuleModule<"inconsistentFunctionScoping" | "moveToModuleScope", [(import("./rules/maintainability/consistent-function-scoping").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
225
|
-
name: string;
|
|
226
|
-
};
|
|
227
|
-
'maintainability/no-unreadable-iife': TSESLint.RuleModule<"unreadableIIFE" | "suggestNamedFunction" | "suggestBlockScope" | "complexIIFE", [(import("./rules/maintainability/no-unreadable-iife").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
228
|
-
name: string;
|
|
229
|
-
};
|
|
230
|
-
'maintainability/error-message': TSESLint.RuleModule<"missingErrorMessage" | "addErrorMessage", [(import("./rules/error-handling/error-message").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
231
|
-
name: string;
|
|
232
|
-
};
|
|
233
|
-
'maintainability/no-missing-error-context': TSESLint.RuleModule<"addErrorMessage" | "missingErrorContext" | "addErrorStack" | "useErrorClass", [(import("./rules/error-handling/no-missing-error-context").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
234
|
-
name: string;
|
|
235
|
-
};
|
|
236
|
-
'maintainability/no-silent-errors': TSESLint.RuleModule<"silentError" | "addErrorLogging" | "addErrorHandling" | "rethrowError", [(import("./rules/error-handling/no-silent-errors").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
237
|
-
name: string;
|
|
238
|
-
};
|
|
239
|
-
'maintainability/no-unhandled-promise': TSESLint.RuleModule<"unhandledPromise" | "addCatch" | "useTryCatch" | "useAwait", [(import("./rules/error-handling/no-unhandled-promise").Options | undefined)?], unknown, TSESLint.RuleListener> & {
|
|
240
|
-
name: string;
|
|
241
|
-
};
|
|
242
|
-
};
|
|
243
|
-
};
|
|
244
|
-
};
|
|
245
|
-
rules: {
|
|
246
|
-
'maintainability/cognitive-complexity': "warn";
|
|
247
|
-
'maintainability/identical-functions': "warn";
|
|
248
|
-
'maintainability/max-parameters': "warn";
|
|
249
|
-
};
|
|
250
|
-
};
|
|
12
|
+
meta: { name: string; version: string };
|
|
13
|
+
rules: Record<string, Rule.RuleModule>;
|
|
251
14
|
};
|
|
252
|
-
|
|
15
|
+
|
|
16
|
+
declare const _default: typeof plugin;
|
|
17
|
+
export default _default;
|
package/src/index.js
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
-
* MIT license that can be found in the LICENSE file.
|
|
6
|
-
*/
|
|
7
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
3
|
exports.configs = exports.plugin = exports.rules = void 0;
|
|
9
|
-
// Maintainability rules
|
|
10
4
|
const cognitive_complexity_1 = require("./rules/maintainability/cognitive-complexity");
|
|
11
5
|
const nested_complexity_hotspots_1 = require("./rules/maintainability/nested-complexity-hotspots");
|
|
12
6
|
const identical_functions_1 = require("./rules/maintainability/identical-functions");
|
|
@@ -15,11 +9,6 @@ const no_lonely_if_1 = require("./rules/maintainability/no-lonely-if");
|
|
|
15
9
|
const no_nested_ternary_1 = require("./rules/maintainability/no-nested-ternary");
|
|
16
10
|
const consistent_function_scoping_1 = require("./rules/maintainability/consistent-function-scoping");
|
|
17
11
|
const no_unreadable_iife_1 = require("./rules/maintainability/no-unreadable-iife");
|
|
18
|
-
// Error-handling rules (wired 2026-05-09 — implementations + docs both
|
|
19
|
-
// existed but the plugin index didn't register them; users following the
|
|
20
|
-
// docs couldn't enable them. They are also exported by `eslint-plugin-
|
|
21
|
-
// reliability` under the same names — the dual export is intentional
|
|
22
|
-
// because the rules apply to both maintainability and reliability concerns).
|
|
23
12
|
const error_message_1 = require("./rules/error-handling/error-message");
|
|
24
13
|
const no_missing_error_context_1 = require("./rules/error-handling/no-missing-error-context");
|
|
25
14
|
const no_silent_errors_1 = require("./rules/error-handling/no-silent-errors");
|
|
@@ -37,7 +26,6 @@ exports.rules = {
|
|
|
37
26
|
'no-missing-error-context': no_missing_error_context_1.noMissingErrorContext,
|
|
38
27
|
'no-silent-errors': no_silent_errors_1.noSilentErrors,
|
|
39
28
|
'no-unhandled-promise': no_unhandled_promise_1.noUnhandledPromise,
|
|
40
|
-
// Categorized names
|
|
41
29
|
'maintainability/cognitive-complexity': cognitive_complexity_1.cognitiveComplexity,
|
|
42
30
|
'maintainability/nested-complexity-hotspots': nested_complexity_hotspots_1.nestedComplexityHotspots,
|
|
43
31
|
'maintainability/identical-functions': identical_functions_1.identicalFunctions,
|
|
@@ -53,12 +41,8 @@ exports.rules = {
|
|
|
53
41
|
};
|
|
54
42
|
exports.plugin = {
|
|
55
43
|
meta: {
|
|
56
|
-
// Unscoped, matching package.json `name` and every other plugin in the
|
|
57
|
-
// ecosystem (`eslint-plugin-*`). These packages are published WITHOUT the
|
|
58
|
-
// `@interlace` scope; a scoped name here drifts from how consumers install
|
|
59
|
-
// and reference the plugin. Locked in index.test.ts.
|
|
60
44
|
name: 'eslint-plugin-maintainability',
|
|
61
|
-
version: '3.0.
|
|
45
|
+
version: '3.0.10',
|
|
62
46
|
},
|
|
63
47
|
rules: exports.rules,
|
|
64
48
|
};
|
package/src/oxlint.d.ts
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*/
|
|
19
|
-
import { plugin } from './index';
|
|
20
|
-
export = plugin;
|
|
1
|
+
// Minimal declaration written by scripts/build-package.ts.
|
|
2
|
+
//
|
|
3
|
+
// tsc's generated entry declaration inlined every inferred rule-option type
|
|
4
|
+
// (up to 166 kB per plugin) for an API no consumer calls directly. This types
|
|
5
|
+
// what a flat config actually touches. Per-rule option types remain available
|
|
6
|
+
// from the "./types" subpath export where a plugin provides one.
|
|
7
|
+
import type { Linter, Rule } from 'eslint';
|
|
8
|
+
|
|
9
|
+
export declare const rules: Record<string, Rule.RuleModule>;
|
|
10
|
+
export declare const configs: Record<string, Linter.Config>;
|
|
11
|
+
export declare const plugin: {
|
|
12
|
+
meta: { name: string; version: string };
|
|
13
|
+
rules: Record<string, Rule.RuleModule>;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
declare const _default: typeof plugin;
|
|
17
|
+
export default _default;
|
package/src/oxlint.js
CHANGED
|
@@ -1,21 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
-
* MIT license that can be found in the LICENSE file.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* oxlint sub-export.
|
|
9
|
-
*
|
|
10
|
-
* Consumers wire oxlint to this entry via:
|
|
11
|
-
* { "jsPlugins": ["eslint-plugin-maintainability/oxlint"] }
|
|
12
|
-
*
|
|
13
|
-
* oxlint's JS plugin loader does `require('eslint-plugin-maintainability/oxlint')` and reads
|
|
14
|
-
* `.rules` off the result. The compiled output of `export = plugin` is
|
|
15
|
-
* `module.exports = plugin`, which gives oxlint the plugin object directly
|
|
16
|
-
* (`{ meta, rules }`) — no wrapper, no `.default` indirection.
|
|
17
|
-
*
|
|
18
|
-
* Generated by scripts/generate-oxlint-shims.mjs. Do not edit by hand.
|
|
19
|
-
*/
|
|
20
2
|
const index_1 = require("./index");
|
|
21
3
|
module.exports = index_1.plugin;
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
-
* MIT license that can be found in the LICENSE file.
|
|
6
|
-
*/
|
|
7
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
3
|
exports.errorMessage = void 0;
|
|
9
4
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
@@ -52,7 +47,6 @@ exports.errorMessage = (0, eslint_devkit_1.createRule)({
|
|
|
52
47
|
create(context) {
|
|
53
48
|
const [options] = context.options;
|
|
54
49
|
const { allowEmptyCatch = false } = options || {};
|
|
55
|
-
// Built-in Error constructors that should have messages
|
|
56
50
|
const errorConstructors = new Set([
|
|
57
51
|
'Error',
|
|
58
52
|
'TypeError',
|
|
@@ -65,19 +59,14 @@ exports.errorMessage = (0, eslint_devkit_1.createRule)({
|
|
|
65
59
|
function isErrorConstructor(name) {
|
|
66
60
|
return errorConstructors.has(name);
|
|
67
61
|
}
|
|
68
|
-
// oxlint-disable-next-line consistent-function-scoping
|
|
69
62
|
function hasMessageArgument(node) {
|
|
70
|
-
// Check if there are arguments
|
|
71
63
|
if (!node.arguments || node.arguments.length === 0) {
|
|
72
64
|
return false;
|
|
73
65
|
}
|
|
74
|
-
// Check if first argument is a non-empty string or expression
|
|
75
66
|
const firstArg = node.arguments[0];
|
|
76
67
|
if (firstArg.type === 'Literal') {
|
|
77
|
-
// Allow non-empty strings
|
|
78
68
|
return (typeof firstArg.value === 'string' && firstArg.value.trim().length > 0);
|
|
79
69
|
}
|
|
80
|
-
// Allow any expression (variable, function call, etc.) as it might be dynamic
|
|
81
70
|
return true;
|
|
82
71
|
}
|
|
83
72
|
function isInCatchClause(node) {
|
|
@@ -93,13 +82,11 @@ exports.errorMessage = (0, eslint_devkit_1.createRule)({
|
|
|
93
82
|
function checkErrorCreation(node) {
|
|
94
83
|
let constructorName = null;
|
|
95
84
|
if (node.type === 'NewExpression') {
|
|
96
|
-
// new Error(...)
|
|
97
85
|
if (node.callee.type === 'Identifier') {
|
|
98
86
|
constructorName = node.callee.name;
|
|
99
87
|
}
|
|
100
88
|
}
|
|
101
89
|
else if (node.type === 'CallExpression') {
|
|
102
|
-
// Error(...) - function call style
|
|
103
90
|
if (node.callee.type === 'Identifier') {
|
|
104
91
|
constructorName = node.callee.name;
|
|
105
92
|
}
|
|
@@ -107,11 +94,9 @@ exports.errorMessage = (0, eslint_devkit_1.createRule)({
|
|
|
107
94
|
if (!constructorName || !isErrorConstructor(constructorName)) {
|
|
108
95
|
return;
|
|
109
96
|
}
|
|
110
|
-
// Allow empty catch if option is enabled
|
|
111
97
|
if (allowEmptyCatch && isInCatchClause(node)) {
|
|
112
98
|
return;
|
|
113
99
|
}
|
|
114
|
-
// Check if message is provided
|
|
115
100
|
if (!hasMessageArgument(node)) {
|
|
116
101
|
context.report({
|
|
117
102
|
node,
|
|
@@ -125,13 +110,11 @@ exports.errorMessage = (0, eslint_devkit_1.createRule)({
|
|
|
125
110
|
data: { constructor: constructorName },
|
|
126
111
|
fix(fixer) {
|
|
127
112
|
if (node.arguments.length === 0) {
|
|
128
|
-
// No arguments: replace the empty parentheses with ("Error message")
|
|
129
113
|
const parenStart = node.callee.range[1];
|
|
130
114
|
const parenEnd = node.range[1];
|
|
131
115
|
return fixer.replaceTextRange([parenStart, parenEnd], '("Error message")');
|
|
132
116
|
}
|
|
133
117
|
else {
|
|
134
|
-
// Has arguments: replace the first argument with "Error message"
|
|
135
118
|
return fixer.replaceText(node.arguments[0], '"Error message"');
|
|
136
119
|
}
|
|
137
120
|
},
|
|
@@ -1,26 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
-
* MIT license that can be found in the LICENSE file.
|
|
6
|
-
*/
|
|
7
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
3
|
exports.noMissingErrorContext = void 0;
|
|
9
4
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
10
5
|
const eslint_devkit_2 = require("@interlace/eslint-devkit");
|
|
11
|
-
/**
|
|
12
|
-
* Check if error has a message
|
|
13
|
-
*/
|
|
14
6
|
function hasErrorMessage(node) {
|
|
15
7
|
if (!node.argument) {
|
|
16
8
|
return false;
|
|
17
9
|
}
|
|
18
|
-
// Check if it's a new Error() with message (includes TypeError, ReferenceError, etc.)
|
|
19
10
|
if (node.argument.type === 'NewExpression' &&
|
|
20
11
|
node.argument.callee.type === 'Identifier' &&
|
|
21
12
|
(node.argument.callee.name === 'Error' ||
|
|
22
13
|
node.argument.callee.name.endsWith('Error'))) {
|
|
23
|
-
// Check if first argument is a string (message)
|
|
24
14
|
if (node.argument.arguments.length > 0) {
|
|
25
15
|
const firstArg = node.argument.arguments[0];
|
|
26
16
|
if (firstArg.type === 'Literal' && typeof firstArg.value === 'string') {
|
|
@@ -31,29 +21,22 @@ function hasErrorMessage(node) {
|
|
|
31
21
|
}
|
|
32
22
|
}
|
|
33
23
|
}
|
|
34
|
-
// Check if it's a string literal
|
|
35
24
|
if (node.argument.type === 'Literal' &&
|
|
36
25
|
typeof node.argument.value === 'string') {
|
|
37
26
|
return node.argument.value.length > 0;
|
|
38
27
|
}
|
|
39
|
-
// Check if it's a template literal
|
|
40
28
|
if (node.argument.type === 'TemplateLiteral') {
|
|
41
29
|
return true;
|
|
42
30
|
}
|
|
43
31
|
return false;
|
|
44
32
|
}
|
|
45
|
-
/**
|
|
46
|
-
* Check if error is an Error instance (has stack trace)
|
|
47
|
-
*/
|
|
48
33
|
function hasErrorStack(node) {
|
|
49
34
|
if (!node.argument) {
|
|
50
35
|
return false;
|
|
51
36
|
}
|
|
52
|
-
// Check if it's a new Error() instance
|
|
53
37
|
if (node.argument.type === 'NewExpression' &&
|
|
54
38
|
node.argument.callee.type === 'Identifier') {
|
|
55
39
|
const calleeName = node.argument.callee.name;
|
|
56
|
-
// Error, TypeError, ReferenceError, etc. all have stack traces
|
|
57
40
|
if (calleeName === 'Error' || calleeName.endsWith('Error')) {
|
|
58
41
|
return true;
|
|
59
42
|
}
|
|
@@ -141,9 +124,6 @@ exports.noMissingErrorContext = (0, eslint_devkit_2.createRule)({
|
|
|
141
124
|
if (isTestFile) {
|
|
142
125
|
return {};
|
|
143
126
|
}
|
|
144
|
-
/**
|
|
145
|
-
* Check throw statements
|
|
146
|
-
*/
|
|
147
127
|
function checkThrowStatement(node) {
|
|
148
128
|
const missing = [];
|
|
149
129
|
if (requireMessage && !hasErrorMessage(node)) {
|
|
@@ -164,7 +144,7 @@ exports.noMissingErrorContext = (0, eslint_devkit_2.createRule)({
|
|
|
164
144
|
suggest: [
|
|
165
145
|
{
|
|
166
146
|
messageId: 'addErrorMessage',
|
|
167
|
-
fix: () => null,
|
|
147
|
+
fix: () => null,
|
|
168
148
|
},
|
|
169
149
|
{
|
|
170
150
|
messageId: 'addErrorStack',
|