eslint-plugin-constructors 1.3.0 → 1.4.0
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 +11 -13
- package/package.json +3 -3
- package/src/data/deprecations.js +1 -1
- package/src/index.js +6 -0
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ ESLint rules to enforce best practices for constructor usage.
|
|
|
16
16
|
|
|
17
17
|
---
|
|
18
18
|
|
|
19
|
-
## Installation
|
|
19
|
+
## <img height=30 width=27 align="top" src="https://api.iconify.design/ic/sharp-install-desktop.svg?color=%232b2b2a"> Installation
|
|
20
20
|
|
|
21
21
|
From your project root:
|
|
22
22
|
|
|
@@ -27,13 +27,11 @@ npm i -D eslint-plugin-constructors
|
|
|
27
27
|
---
|
|
28
28
|
|
|
29
29
|
<h2 id="usage">
|
|
30
|
+
<img height=30 width=28 align="top" src="https://api.iconify.design/entypo/power-plug.svg?color=%232b2b2a">
|
|
30
31
|
Usage
|
|
31
|
-
<a title="Copy section URL" target="_blank"
|
|
32
|
-
href="https://copy-to-clipboard.onrender.com/copy/https%3A%2F%2Fcodeberg.org%2Fadamlui%2Feslint-plugin-constructors%2F%23usage">
|
|
33
|
-
<img height=17 width=22 alt="[Copy section URL]" src="https://api.iconify.design/mdi/content-copy.svg?color=%23cccccc" align="bottom"></a>
|
|
34
32
|
</h2>
|
|
35
33
|
|
|
36
|
-
Add
|
|
34
|
+
Add a bundled config to your `eslint.config.*js`:
|
|
37
35
|
|
|
38
36
|
```js
|
|
39
37
|
...
|
|
@@ -52,15 +50,15 @@ export default [
|
|
|
52
50
|
]
|
|
53
51
|
```
|
|
54
52
|
|
|
53
|
+
Available bundles: `recommended`, `problem`
|
|
54
|
+
|
|
55
55
|
**Note:** Rule config is either a severity string (`'off'`, `'warn'`, `'error'`) or an array `[severity, options]` when the rule accepts options.
|
|
56
56
|
|
|
57
57
|
---
|
|
58
58
|
|
|
59
59
|
<h2 id="supported-rules">
|
|
60
|
+
<img height=30 width=27 align="top" src="https://api.iconify.design/mdi/format-list-checks.svg?color=%232b2b2a">
|
|
60
61
|
Supported rules
|
|
61
|
-
<a title="Copy section URL" target="_blank"
|
|
62
|
-
href="https://copy-to-clipboard.onrender.com/copy/https%3A%2F%2Fcodeberg.org%2Fadamlui%2Feslint-plugin-constructors%2F%23supported-rules">
|
|
63
|
-
<img height=17 width=22 alt="[Copy section URL]" src="https://api.iconify.design/mdi/content-copy.svg?color=%23cccccc" align="bottom"></a>
|
|
64
62
|
</h2>
|
|
65
63
|
|
|
66
64
|
| ID | Description | Auto-fixable | Recommended |
|
|
@@ -173,7 +171,7 @@ If you don't follow the convention of suffixing custom error classes w/ `Error`.
|
|
|
173
171
|
<a title="Included in recommended config" href="#usage">
|
|
174
172
|
<img height=18 alt="[Recommended]" src="https://img.shields.io/badge/Recommended-f1f20a?style=flat-square" align="middle"></a>
|
|
175
173
|
<a title="Accepts eslint --fix" target="_blank" href="https://eslint.org/docs/latest/use/command-line-interface#--fix">
|
|
176
|
-
<img height=18 alt="[Auto-fixable]" src="https://img.shields.io/badge/Auto--fixable-
|
|
174
|
+
<img height=18 alt="[Auto-fixable]" src="https://img.shields.io/badge/Auto--fixable-3b5bdb?style=flat-square" align="middle"></a>
|
|
177
175
|
<a title="Accepts array w/ options" href="#usage">
|
|
178
176
|
<img height=18 alt="[Configurable]" src="https://img.shields.io/badge/Configurable-black?style=flat-square" align="middle"></a>
|
|
179
177
|
<a title="Copy rule URL" target="_blank"
|
|
@@ -228,7 +226,7 @@ If you prefer calling built-ins w/o `new` (which the runtime allows for some of
|
|
|
228
226
|
|
|
229
227
|
---
|
|
230
228
|
|
|
231
|
-
## Shield embed
|
|
229
|
+
## <img height=30 align="top" src="https://api.iconify.design/boxicons/code-alt-filled.svg?color=%232b2b2a"> Shield embed
|
|
232
230
|
|
|
233
231
|
<a target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-constructors/#readme">
|
|
234
232
|
<img height=32 alt="[Linted by eslint-plugin-constructors]" src="https://img.shields.io/badge/Linted_by-eslint--plugin--constructors-black?logo=eslint&logoColor=white&labelColor=464646&style=for-the-badge"></a>
|
|
@@ -248,10 +246,10 @@ If you prefer calling built-ins w/o `new` (which the runtime allows for some of
|
|
|
248
246
|
|
|
249
247
|
---
|
|
250
248
|
|
|
251
|
-
## License
|
|
249
|
+
## <img height=30 width=27 align="top" src="https://api.iconify.design/ic/baseline-account-balance.svg?color=%232b2b2a"> License
|
|
252
250
|
|
|
253
251
|
<a target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-constructors/src/branch/main/docs/LICENSE.md">
|
|
254
|
-
<img height=
|
|
252
|
+
<img height=85 src="https://cdn.staticdelivr.com/gl/adamlui/eslint-plugin-greasemonkey/9e820e5d51/assets/images/logos/mit-license/red-pixelated.png"></a>
|
|
255
253
|
<br><br>
|
|
256
254
|
|
|
257
255
|
<details>
|
|
@@ -268,7 +266,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
268
266
|
|
|
269
267
|
---
|
|
270
268
|
|
|
271
|
-
## Related
|
|
269
|
+
## <img height=30 width=29 align="top" src="https://api.iconify.design/bxs/package.svg?color=%232b2b2a"> Related
|
|
272
270
|
|
|
273
271
|
<!-- eslint-plugin-greasemonkey -->
|
|
274
272
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-constructors",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "ESLint rules for constructor usage",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -74,12 +74,12 @@
|
|
|
74
74
|
"eslint": "^10.11.0",
|
|
75
75
|
"eslint-plugin-eslint-plugin": "^7.6.2",
|
|
76
76
|
"eslint-plugin-import-x": "^4.17.1",
|
|
77
|
-
"eslint-plugin-n": "^18.
|
|
77
|
+
"eslint-plugin-n": "^18.4.0",
|
|
78
78
|
"eslint-plugin-no-secrets": "^2.3.3",
|
|
79
79
|
"eslint-plugin-no-unsanitized": "^4.1.5",
|
|
80
80
|
"eslint-plugin-promise": "^7.3.0",
|
|
81
81
|
"eslint-plugin-regexp": "^3.3.1",
|
|
82
|
-
"eslint-plugin-security": "^4.0
|
|
82
|
+
"eslint-plugin-security": "^4.2.0",
|
|
83
83
|
"husky": "^9.1.7",
|
|
84
84
|
"yamllint-js": "^0.2.4"
|
|
85
85
|
}
|
package/src/data/deprecations.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
export const rules = { // old: new
|
|
4
4
|
'require-new': {
|
|
5
|
-
'require-new': { mode: 'errors', // 2026-9-24
|
|
5
|
+
'require-new': { mode: 'errors', // 2026-9-24 announced certain default switch + possible unnamed syntax removal
|
|
6
6
|
builtins: 'all', 'error-only': 'errors' } // 2026-9-13 announced removal @ v2
|
|
7
7
|
}
|
|
8
8
|
}
|
package/src/index.js
CHANGED
|
@@ -28,6 +28,12 @@ plugin.configs = {
|
|
|
28
28
|
'constructors/require-error-subclass-name': 'error',
|
|
29
29
|
'constructors/require-new': 'error'
|
|
30
30
|
}
|
|
31
|
+
},
|
|
32
|
+
problem: {
|
|
33
|
+
plugins: { constructors: plugin },
|
|
34
|
+
rules: Object.fromEntries(Object.entries(plugin.rules)
|
|
35
|
+
.filter(([, rule]) => rule.meta.type == 'problem')
|
|
36
|
+
.map(([id]) => [`constructors/${id}`, 'error']))
|
|
31
37
|
}
|
|
32
38
|
}
|
|
33
39
|
|