eslint-plugin-node-dependencies 0.11.2 → 0.12.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
CHANGED
|
@@ -41,13 +41,27 @@ 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 `.eslintrc` configuration file (you can omit the `eslint-plugin-` prefix)
|
|
44
|
+
Add `node-dependencies` to the plugins section of your `eslint.config.js` or `.eslintrc` configuration file (you can omit the `eslint-plugin-` prefix)
|
|
45
45
|
and either use one of the two configurations available (`recommended`) or configure the rules you want:
|
|
46
46
|
|
|
47
|
-
### The recommended configuration
|
|
47
|
+
### The recommended configuration (New Config)
|
|
48
|
+
|
|
49
|
+
The `plugin.configs["flat/recommended"]` config enables a subset of [the rules](#white_check_mark-rules) that should be most useful to most users.
|
|
50
|
+
*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
|
+
|
|
52
|
+
```js
|
|
53
|
+
// eslint.config.js
|
|
54
|
+
import * as nodeDependenciesPlugin from "eslint-plugin-node-dependencies"
|
|
55
|
+
|
|
56
|
+
export default [
|
|
57
|
+
...nodeDependenciesPlugin.configs["flat/recommended"],
|
|
58
|
+
];
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### The recommended configuration (Legacy Config)
|
|
48
62
|
|
|
49
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.
|
|
50
|
-
*See [lib/configs/recommended.ts](https://github.com/ota-meshi/eslint-plugin-node-dependencies/blob/main/lib/configs/recommended.ts) for more details.*
|
|
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.*
|
|
51
65
|
|
|
52
66
|
```js
|
|
53
67
|
// .eslintrc.js
|
|
@@ -67,6 +81,21 @@ module.exports = {
|
|
|
67
81
|
|
|
68
82
|
Override/add specific rules configurations. *See also: [http://eslint.org/docs/user-guide/configuring](http://eslint.org/docs/user-guide/configuring)*.
|
|
69
83
|
|
|
84
|
+
```js
|
|
85
|
+
// eslint.config.js
|
|
86
|
+
import * as nodeDependenciesPlugin from "eslint-plugin-node-dependencies"
|
|
87
|
+
|
|
88
|
+
export default [
|
|
89
|
+
{
|
|
90
|
+
plugins: { "node-dependencies": nodeDependenciesPlugin }
|
|
91
|
+
rules: {
|
|
92
|
+
// Override/add rules settings here, such as:
|
|
93
|
+
"node-dependencies/rule-name": "error"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
];
|
|
97
|
+
```
|
|
98
|
+
|
|
70
99
|
```js
|
|
71
100
|
// .eslintrc.js
|
|
72
101
|
module.exports = {
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.recommendedConfig = void 0;
|
|
30
|
+
const recommended_1 = __importDefault(require("../rules/recommended"));
|
|
31
|
+
const jsonParser = __importStar(require("jsonc-eslint-parser"));
|
|
32
|
+
exports.recommendedConfig = [
|
|
33
|
+
{
|
|
34
|
+
plugins: {
|
|
35
|
+
get "node-dependencies"() {
|
|
36
|
+
return require("../../index");
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
files: ["**/package.json", "package.json"],
|
|
42
|
+
languageOptions: {
|
|
43
|
+
parser: jsonParser,
|
|
44
|
+
},
|
|
45
|
+
rules: recommended_1.default.rules,
|
|
46
|
+
},
|
|
47
|
+
];
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
const recommended_1 = __importDefault(require("./rules/recommended"));
|
|
2
6
|
module.exports = {
|
|
3
7
|
plugins: ["node-dependencies"],
|
|
4
8
|
overrides: [
|
|
5
9
|
{
|
|
6
10
|
files: ["package.json"],
|
|
7
11
|
parser: require.resolve("jsonc-eslint-parser"),
|
|
8
|
-
rules:
|
|
9
|
-
"node-dependencies/compat-engines": "error",
|
|
10
|
-
"node-dependencies/no-dupe-deps": "error",
|
|
11
|
-
"node-dependencies/valid-semver": "error",
|
|
12
|
-
},
|
|
12
|
+
rules: recommended_1.default.rules,
|
|
13
13
|
},
|
|
14
14
|
],
|
|
15
15
|
};
|
package/dist/index.js
CHANGED
|
@@ -27,9 +27,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
const rules_1 = require("./utils/rules");
|
|
29
29
|
const recommended_1 = __importDefault(require("./configs/recommended"));
|
|
30
|
+
const recommended_2 = require("./configs/flat/recommended");
|
|
30
31
|
const meta = __importStar(require("./meta"));
|
|
31
32
|
const configs = {
|
|
32
33
|
recommended: recommended_1.default,
|
|
34
|
+
"flat/recommended": recommended_2.recommendedConfig,
|
|
33
35
|
};
|
|
34
36
|
const rules = rules_1.rules.reduce((obj, r) => {
|
|
35
37
|
obj[r.meta.docs.ruleName] = r;
|
|
@@ -2,4 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.syncPackageJson = void 0;
|
|
4
4
|
const synckit_1 = require("synckit");
|
|
5
|
-
|
|
5
|
+
const module_1 = require("module");
|
|
6
|
+
exports.syncPackageJson = (0, synckit_1.createSyncFn)(getWorkerPath());
|
|
7
|
+
function getWorkerPath() {
|
|
8
|
+
try {
|
|
9
|
+
return require.resolve("./worker");
|
|
10
|
+
}
|
|
11
|
+
catch (_a) {
|
|
12
|
+
}
|
|
13
|
+
const r = (0, module_1.createRequire)(__filename);
|
|
14
|
+
return r.resolve(`./worker.ts`);
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-node-dependencies",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "ESLint plugin to check Node.js dependencies.",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=14.17.0"
|
|
@@ -16,15 +16,16 @@
|
|
|
16
16
|
"lint": "eslint . --ext .js,.vue,.ts,.json,.yaml,.yml",
|
|
17
17
|
"eslint-fix": "eslint . --ext .js,.vue,.ts,.json,.yaml,.yml --fix",
|
|
18
18
|
"pretest": "npm run build",
|
|
19
|
-
"test:base": "mocha --require ts-node/register \"tests/**/*.ts\" --reporter dot --timeout 60000",
|
|
19
|
+
"test:base": "mocha --require ts-node/register/transpile-only \"tests/**/*.ts\" --reporter dot --timeout 60000",
|
|
20
20
|
"test": "npm run test:nyc",
|
|
21
21
|
"test:nyc": "nyc --reporter=lcov npm run test:base",
|
|
22
22
|
"test:debug": "mocha --require ts-node/register/transpile-only \"tests/**/*.ts\" --reporter dot --timeout 60000",
|
|
23
23
|
"test:watch": "npm run test:base -- --watch",
|
|
24
24
|
"update": "ts-node --transpile-only ./tools/update.ts && npm run eslint-fix",
|
|
25
25
|
"new": "ts-node ./tools/new-rule.ts",
|
|
26
|
-
"docs:watch": "
|
|
27
|
-
"docs:build": "
|
|
26
|
+
"docs:watch": "npm run build && vitepress dev docs",
|
|
27
|
+
"docs:build": "npm run build && vitepress build docs",
|
|
28
|
+
"docs:build-and-preview": "npm run docs:build && npx http-server docs/.vitepress/dist",
|
|
28
29
|
"prerelease": "npm run test && npm run build",
|
|
29
30
|
"release": "changeset publish",
|
|
30
31
|
"preversion": "npm test && git add .",
|
|
@@ -56,48 +57,49 @@
|
|
|
56
57
|
"devDependencies": {
|
|
57
58
|
"@changesets/changelog-github": "^0.5.0",
|
|
58
59
|
"@changesets/cli": "^2.24.2",
|
|
60
|
+
"@eslint-community/eslint-utils": "^4.4.0",
|
|
59
61
|
"@ota-meshi/eslint-plugin": "^0.15.0",
|
|
62
|
+
"@shikijs/vitepress-twoslash": "^1.2.1",
|
|
60
63
|
"@types/chai": "^4.2.18",
|
|
61
64
|
"@types/eslint": "^8.0.0",
|
|
62
65
|
"@types/eslint-scope": "^3.7.0",
|
|
63
|
-
"@types/eslint-visitor-keys": "^
|
|
66
|
+
"@types/eslint-visitor-keys": "^3.0.0",
|
|
64
67
|
"@types/estree": "^1.0.0",
|
|
65
68
|
"@types/mocha": "^10.0.0",
|
|
66
69
|
"@types/node": "^20.0.0",
|
|
67
70
|
"@types/npm-package-arg": "^6.1.1",
|
|
68
71
|
"@types/semver": "^7.3.8",
|
|
69
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
70
|
-
"@typescript-eslint/parser": "^
|
|
72
|
+
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
|
73
|
+
"@typescript-eslint/parser": "^7.0.0",
|
|
71
74
|
"chai": "^5.0.0",
|
|
72
75
|
"env-cmd": "^10.1.0",
|
|
73
76
|
"eslint": "^8.0.0",
|
|
74
|
-
"eslint-compat-utils": "^0.
|
|
77
|
+
"eslint-compat-utils": "^0.5.0",
|
|
75
78
|
"eslint-config-prettier": "^9.0.0",
|
|
76
79
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
77
|
-
"eslint-plugin-eslint-plugin": "^
|
|
78
|
-
"eslint-plugin-json-schema-validator": "^
|
|
80
|
+
"eslint-plugin-eslint-plugin": "^6.0.0",
|
|
81
|
+
"eslint-plugin-json-schema-validator": "^5.0.0",
|
|
79
82
|
"eslint-plugin-jsonc": "^2.0.0",
|
|
80
|
-
"eslint-plugin-n": "^
|
|
83
|
+
"eslint-plugin-n": "^17.0.0",
|
|
81
84
|
"eslint-plugin-node-dependencies": "^0.11.0",
|
|
82
85
|
"eslint-plugin-prettier": "^5.0.0",
|
|
83
86
|
"eslint-plugin-regexp": "^2.0.0",
|
|
84
87
|
"eslint-plugin-vue": "^9.0.0",
|
|
85
88
|
"eslint-plugin-yml": "^1.0.0",
|
|
86
|
-
"eslint4b": "^7.3.1",
|
|
87
89
|
"mocha": "^10.0.0",
|
|
88
90
|
"mocha-chai-jest-snapshot": "^1.1.2",
|
|
89
91
|
"nyc": "^15.1.0",
|
|
90
92
|
"prettier": "^3.0.0",
|
|
91
|
-
"raw-loader": "^4.0.1",
|
|
92
93
|
"stylelint": "^16.0.0",
|
|
93
94
|
"stylelint-config-recommended-vue": "^1.0.0",
|
|
94
95
|
"stylelint-config-standard": "^36.0.0",
|
|
96
|
+
"stylelint-config-standard-vue": "^1.0.0",
|
|
95
97
|
"stylelint-stylus": "^1.0.0",
|
|
96
98
|
"ts-node": "^10.0.0",
|
|
99
|
+
"twoslash-eslint": "^0.2.5",
|
|
97
100
|
"typescript": "^5.0.0",
|
|
98
|
-
"
|
|
99
|
-
"vue-eslint-parser": "^9.0.0"
|
|
100
|
-
"vuepress": "^1.5.2"
|
|
101
|
+
"vitepress": "^1.0.1",
|
|
102
|
+
"vue-eslint-parser": "^9.0.0"
|
|
101
103
|
},
|
|
102
104
|
"dependencies": {
|
|
103
105
|
"jsonc-eslint-parser": "^2.0.2",
|