eslint-plugin-constructors 1.3.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,6 +6,8 @@
6
6
  <img alt="[Latest Build]" src="https://img.shields.io/npm/v/eslint-plugin-constructors?logo=icinga&style=for-the-badge&label=Latest%20Build&color=32fcee"></a>
7
7
  <a href="#license">
8
8
  <img alt="[License: MIT]" src="https://img.shields.io/badge/License-MIT-f1f20a.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
9
+ <a>
10
+ <img src="https://img.shields.io/npm/dm/eslint-plugin-constructors?style=for-the-badge&logo=npm&color=black"></a>
9
11
  <a target="_blank" href="https://eslint.org/">
10
12
  <img alt="[Requires ESLint >=9.0.0]" src="https://img.shields.io/badge/Requires-ESLint_%3E%3D9.0.0-4B32C3?style=for-the-badge&logo=eslint"></a>
11
13
  <br><br>
@@ -16,7 +18,7 @@ ESLint rules to enforce best practices for constructor usage.
16
18
 
17
19
  ---
18
20
 
19
- ## Installation
21
+ ## <img height=30 width=27 align="top" src="https://api.iconify.design/ic/sharp-install-desktop.svg?color=%232b2b2a"> Installation
20
22
 
21
23
  From your project root:
22
24
 
@@ -27,13 +29,11 @@ npm i -D eslint-plugin-constructors
27
29
  ---
28
30
 
29
31
  <h2 id="usage">
32
+ <img height=30 width=28 align="top" src="https://api.iconify.design/entypo/power-plug.svg?color=%232b2b2a">
30
33
  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
34
  </h2>
35
35
 
36
- Add recommended config to your `eslint.config.*js`:
36
+ Add a bundled config to your `eslint.config.*js`:
37
37
 
38
38
  ```js
39
39
  ...
@@ -52,15 +52,15 @@ export default [
52
52
  ]
53
53
  ```
54
54
 
55
+ Available bundles: `recommended`, `problem`
56
+
55
57
  **Note:** Rule config is either a severity string (`'off'`, `'warn'`, `'error'`) or an array `[severity, options]` when the rule accepts options.
56
58
 
57
59
  ---
58
60
 
59
61
  <h2 id="supported-rules">
62
+ <img height=30 width=27 align="top" src="https://api.iconify.design/mdi/format-list-checks.svg?color=%232b2b2a">
60
63
  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
64
  </h2>
65
65
 
66
66
  | ID | Description | Auto-fixable | Recommended |
@@ -173,7 +173,7 @@ If you don't follow the convention of suffixing custom error classes w/ `Error`.
173
173
  <a title="Included in recommended config" href="#usage">
174
174
  <img height=18 alt="[Recommended]" src="https://img.shields.io/badge/Recommended-f1f20a?style=flat-square" align="middle"></a>
175
175
  <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-39b23f?style=flat-square" align="middle"></a>
176
+ <img height=18 alt="[Auto-fixable]" src="https://img.shields.io/badge/Auto--fixable-3b5bdb?style=flat-square" align="middle"></a>
177
177
  <a title="Accepts array w/ options" href="#usage">
178
178
  <img height=18 alt="[Configurable]" src="https://img.shields.io/badge/Configurable-black?style=flat-square" align="middle"></a>
179
179
  <a title="Copy rule URL" target="_blank"
@@ -228,7 +228,7 @@ If you prefer calling built-ins w/o `new` (which the runtime allows for some of
228
228
 
229
229
  ---
230
230
 
231
- ## Shield embed
231
+ ## <img width=30 align="top" src="https://api.iconify.design/boxicons/code-alt-filled.svg?color=%232b2b2a"> Shield embed
232
232
 
233
233
  <a target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-constructors/#readme">
234
234
  <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 +248,10 @@ If you prefer calling built-ins w/o `new` (which the runtime allows for some of
248
248
 
249
249
  ---
250
250
 
251
- ## License
251
+ ## <img height=30 width=27 align="top" src="https://api.iconify.design/ic/baseline-account-balance.svg?color=%232b2b2a"> License
252
252
 
253
253
  <a target="_blank" href="https://codeberg.org/adamlui/eslint-plugin-constructors/src/branch/main/docs/LICENSE.md">
254
- <img height=62 src="https://cdn.staticdelivr.com/gl/adamlui/eslint-plugin-greasemonkey/9e820e5d51/assets/images/logos/mit-license/red-pixelated.png"></a>
254
+ <img height=85 src="https://cdn.staticdelivr.com/gl/adamlui/eslint-plugin-greasemonkey/9e820e5d51/assets/images/logos/mit-license/red-pixelated.png"></a>
255
255
  <br><br>
256
256
 
257
257
  <details>
@@ -268,7 +268,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
268
268
 
269
269
  ---
270
270
 
271
- ## Related
271
+ ## <img height=30 width=29 align="top" src="https://api.iconify.design/bxs/package.svg?color=%232b2b2a"> Related
272
272
 
273
273
  <!-- eslint-plugin-greasemonkey -->
274
274
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-constructors",
3
- "version": "1.3.0",
3
+ "version": "1.4.1",
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.3.0",
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.1",
82
+ "eslint-plugin-security": "^4.2.0",
83
83
  "husky": "^9.1.7",
84
84
  "yamllint-js": "^0.2.4"
85
85
  }
@@ -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