eslint-plugin-node-dependencies 1.3.0 → 2.0.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 +10 -66
- package/dist/chunk-C7Uep-_p.mjs +20 -0
- package/dist/index.d.mts +28 -0
- package/dist/index.mjs +1633 -0
- package/dist/worker.d.mts +7 -0
- package/dist/worker.mjs +30 -0
- package/package.json +17 -11
- package/dist/configs/flat/recommended.d.ts +0 -17
- package/dist/configs/flat/recommended.js +0 -57
- package/dist/configs/recommended.d.ts +0 -9
- package/dist/configs/recommended.js +0 -15
- package/dist/configs/rules/recommended.d.ts +0 -5
- package/dist/configs/rules/recommended.js +0 -9
- package/dist/index.d.ts +0 -34
- package/dist/index.js +0 -54
- package/dist/meta.d.ts +0 -1
- package/dist/meta.js +0 -5
- package/dist/rules/absolute-version.d.ts +0 -2
- package/dist/rules/absolute-version.js +0 -161
- package/dist/rules/compat-engines.d.ts +0 -2
- package/dist/rules/compat-engines.js +0 -263
- package/dist/rules/no-deprecated.d.ts +0 -2
- package/dist/rules/no-deprecated.js +0 -63
- package/dist/rules/no-dupe-deps.d.ts +0 -2
- package/dist/rules/no-dupe-deps.js +0 -90
- package/dist/rules/no-restricted-deps.d.ts +0 -2
- package/dist/rules/no-restricted-deps.js +0 -259
- package/dist/rules/prefer-caret-range-version.d.ts +0 -2
- package/dist/rules/prefer-caret-range-version.js +0 -99
- package/dist/rules/prefer-tilde-range-version.d.ts +0 -2
- package/dist/rules/prefer-tilde-range-version.js +0 -100
- package/dist/rules/require-provenance-deps.d.ts +0 -2
- package/dist/rules/require-provenance-deps.js +0 -98
- package/dist/rules/valid-engines.d.ts +0 -2
- package/dist/rules/valid-engines.js +0 -11
- package/dist/rules/valid-semver.d.ts +0 -2
- package/dist/rules/valid-semver.js +0 -78
- package/dist/types.d.ts +0 -51
- package/dist/types.js +0 -2
- package/dist/utils/ast-utils.d.ts +0 -3
- package/dist/utils/ast-utils.js +0 -24
- package/dist/utils/index.d.ts +0 -5
- package/dist/utils/index.js +0 -72
- package/dist/utils/meta.d.ts +0 -30
- package/dist/utils/meta.js +0 -269
- package/dist/utils/package-json/index.d.ts +0 -1
- package/dist/utils/package-json/index.js +0 -17
- package/dist/utils/package-json/worker.d.mts +0 -1
- package/dist/utils/package-json/worker.mjs +0 -26
- package/dist/utils/regexp.d.ts +0 -3
- package/dist/utils/regexp.js +0 -20
- package/dist/utils/rules.d.ts +0 -2
- package/dist/utils/rules.js +0 -28
- package/dist/utils/semver-range.d.ts +0 -7
- package/dist/utils/semver-range.js +0 -37
- package/dist/utils/semver.d.ts +0 -7
- package/dist/utils/semver.js +0 -204
package/README.md
CHANGED
|
@@ -32,8 +32,8 @@ npm install --save-dev eslint eslint-plugin-node-dependencies
|
|
|
32
32
|
|
|
33
33
|
> **Requirements**
|
|
34
34
|
>
|
|
35
|
-
> - ESLint
|
|
36
|
-
> - Node.js
|
|
35
|
+
> - ESLint v9.38.0 and above
|
|
36
|
+
> - Node.js `^20.19.0 || ^22.13.0 || >=24`
|
|
37
37
|
|
|
38
38
|
<!--DOCS_IGNORE_END-->
|
|
39
39
|
|
|
@@ -41,53 +41,33 @@ npm install --save-dev eslint eslint-plugin-node-dependencies
|
|
|
41
41
|
|
|
42
42
|
<!--USAGE_SECTION_START-->
|
|
43
43
|
|
|
44
|
-
Add `node-dependencies` to the plugins section of your `eslint.config.js`
|
|
45
|
-
and either use one of the two configurations available (`recommended`) or configure the rules you want:
|
|
44
|
+
Add `node-dependencies` to the plugins section of your `eslint.config.js` configuration file and either use one of the configurations available (`recommended`) or configure the rules you want:
|
|
46
45
|
|
|
47
|
-
### The recommended configuration
|
|
46
|
+
### The recommended configuration
|
|
48
47
|
|
|
49
|
-
The `plugin.configs
|
|
48
|
+
The `plugin.configs.recommended` config enables a subset of [the rules](#white_check_mark-rules) that should be most useful to most users.
|
|
50
49
|
*See [lib/configs/rules/recommended.ts](https://github.com/ota-meshi/eslint-plugin-node-dependencies/blob/main/lib/configs/rules/recommended.ts) for more details.*
|
|
51
50
|
|
|
52
51
|
```js
|
|
53
52
|
// eslint.config.js
|
|
54
|
-
import
|
|
53
|
+
import nodeDependenciesPlugin from "eslint-plugin-node-dependencies"
|
|
55
54
|
|
|
56
55
|
export default [
|
|
57
|
-
...nodeDependenciesPlugin.configs
|
|
56
|
+
...nodeDependenciesPlugin.configs.recommended,
|
|
58
57
|
];
|
|
59
58
|
```
|
|
60
59
|
|
|
61
|
-
### The recommended configuration (Legacy Config)
|
|
62
|
-
|
|
63
|
-
The `plugin:node-dependencies/recommended` config enables a subset of [the rules](#white_check_mark-rules) that should be most useful to most users.
|
|
64
|
-
*See [lib/configs/rules/recommended.ts](https://github.com/ota-meshi/eslint-plugin-node-dependencies/blob/main/lib/configs/rules/recommended.ts) for more details.*
|
|
65
|
-
|
|
66
|
-
```js
|
|
67
|
-
// .eslintrc.js
|
|
68
|
-
module.exports = {
|
|
69
|
-
"plugins": [
|
|
70
|
-
"node-dependencies"
|
|
71
|
-
],
|
|
72
|
-
"extends": [
|
|
73
|
-
// add more generic rulesets here, such as:
|
|
74
|
-
// 'eslint:recommended',
|
|
75
|
-
"plugin:node-dependencies/recommended"
|
|
76
|
-
]
|
|
77
|
-
}
|
|
78
|
-
```
|
|
79
|
-
|
|
80
60
|
### Advanced Configuration
|
|
81
61
|
|
|
82
62
|
Override/add specific rules configurations. *See also: [http://eslint.org/docs/user-guide/configuring](http://eslint.org/docs/user-guide/configuring)*.
|
|
83
63
|
|
|
84
64
|
```js
|
|
85
65
|
// eslint.config.js
|
|
86
|
-
import
|
|
66
|
+
import nodeDependenciesPlugin from "eslint-plugin-node-dependencies"
|
|
87
67
|
|
|
88
68
|
export default [
|
|
89
69
|
{
|
|
90
|
-
plugins: { "node-dependencies": nodeDependenciesPlugin }
|
|
70
|
+
plugins: { "node-dependencies": nodeDependenciesPlugin },
|
|
91
71
|
rules: {
|
|
92
72
|
// Override/add rules settings here, such as:
|
|
93
73
|
"node-dependencies/rule-name": "error"
|
|
@@ -96,42 +76,6 @@ export default [
|
|
|
96
76
|
];
|
|
97
77
|
```
|
|
98
78
|
|
|
99
|
-
```js
|
|
100
|
-
// .eslintrc.js
|
|
101
|
-
module.exports = {
|
|
102
|
-
"plugins": [
|
|
103
|
-
"node-dependencies"
|
|
104
|
-
],
|
|
105
|
-
"rules": {
|
|
106
|
-
// Override/add rules settings here, such as:
|
|
107
|
-
"node-dependencies/rule-name": "error"
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
#### Parser Configuration
|
|
113
|
-
|
|
114
|
-
If you have specified a parser, you need to configure a parser for `.json`.
|
|
115
|
-
|
|
116
|
-
For example, if you are using the `"@babel/eslint-parser"`, configure it as follows:
|
|
117
|
-
|
|
118
|
-
```js
|
|
119
|
-
module.exports = {
|
|
120
|
-
// ...
|
|
121
|
-
extends: [ "plugin:node-dependencies/recommended"],
|
|
122
|
-
// ...
|
|
123
|
-
parser: "@babel/eslint-parser",
|
|
124
|
-
// Add an `overrides` section to add a parser configuration for json.
|
|
125
|
-
overrides: [
|
|
126
|
-
{
|
|
127
|
-
files: ["*.json", "*.json5"],
|
|
128
|
-
parser: "jsonc-eslint-parser",
|
|
129
|
-
},
|
|
130
|
-
],
|
|
131
|
-
// ...
|
|
132
|
-
};
|
|
133
|
-
```
|
|
134
|
-
|
|
135
79
|
<!--USAGE_SECTION_END-->
|
|
136
80
|
|
|
137
81
|
## :white_check_mark: Rules
|
|
@@ -139,7 +83,7 @@ module.exports = {
|
|
|
139
83
|
<!--RULES_SECTION_START-->
|
|
140
84
|
|
|
141
85
|
The `--fix` option on the [command line](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) automatically fixes problems reported by rules which have a wrench :wrench: below.
|
|
142
|
-
The rules with the following star :star: are included in the `plugin
|
|
86
|
+
The rules with the following star :star: are included in the `plugin.configs.recommended` config.
|
|
143
87
|
|
|
144
88
|
<!--RULES_TABLE_START-->
|
|
145
89
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
|
|
3
|
+
//#region \0rolldown/runtime.js
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __exportAll = (all, no_symbols) => {
|
|
6
|
+
let target = {};
|
|
7
|
+
for (var name in all) {
|
|
8
|
+
__defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
if (!no_symbols) {
|
|
14
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
15
|
+
}
|
|
16
|
+
return target;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { __exportAll as t };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Linter, Rule } from "eslint";
|
|
2
|
+
|
|
3
|
+
//#region lib/meta.d.ts
|
|
4
|
+
declare namespace meta_d_exports {
|
|
5
|
+
export { name, version };
|
|
6
|
+
}
|
|
7
|
+
declare const name: string, version: string;
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region lib/index.d.ts
|
|
10
|
+
declare const configs: {
|
|
11
|
+
recommended: Linter.Config[];
|
|
12
|
+
"flat/recommended": Linter.Config[];
|
|
13
|
+
};
|
|
14
|
+
declare const rules: {
|
|
15
|
+
[key: string]: Rule.RuleModule;
|
|
16
|
+
};
|
|
17
|
+
declare const _default: {
|
|
18
|
+
meta: typeof meta_d_exports;
|
|
19
|
+
configs: {
|
|
20
|
+
recommended: Linter.Config[];
|
|
21
|
+
"flat/recommended": Linter.Config[];
|
|
22
|
+
};
|
|
23
|
+
rules: {
|
|
24
|
+
[key: string]: Rule.RuleModule;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
//#endregion
|
|
28
|
+
export { configs, _default as default, meta_d_exports as meta, rules };
|