eslint-plugin-boundaries 4.2.0 → 5.0.0-beta.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 +29 -10
- package/package.json +13 -14
- package/src/configs/recommended.js +0 -5
package/README.md
CHANGED
|
@@ -53,22 +53,43 @@ npm install --save-dev eslint eslint-plugin-boundaries
|
|
|
53
53
|
|
|
54
54
|
`eslint-plugin-boundaries` does not install `eslint` for you. You must install it yourself.
|
|
55
55
|
|
|
56
|
-
Activate the plugin and one of the canned configs in your `.
|
|
56
|
+
Activate the plugin and one of the canned configs in your `.eslint.config.js` file:
|
|
57
57
|
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
```js
|
|
59
|
+
import boundaries from "eslint-plugin-boundaries";
|
|
60
|
+
|
|
61
|
+
export default [
|
|
62
|
+
{
|
|
63
|
+
files: ["**/*.js"],
|
|
64
|
+
plugins: {
|
|
65
|
+
boundaries,
|
|
66
|
+
},
|
|
67
|
+
rules: {
|
|
68
|
+
...boundaries.configs.recommended.rules,
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
];
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Eslint v9 and above
|
|
75
|
+
|
|
76
|
+
You must use beta versions of this plugin starting from `5.0.0-beta.0` to use it with eslint v9 and above. The compatibility is not guaranteed yet. In case you face any issue, please [open an issue](https://github.com/javierbrea/eslint-plugin-boundaries/issues).
|
|
77
|
+
|
|
78
|
+
To install the latest beta version, you can use the next command:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
npm install --save-dev eslint-plugin-boundaries@beta
|
|
63
82
|
```
|
|
64
83
|
|
|
84
|
+
Note that all examples in these docs except the installation one are still written using JSON format, but you should use JavaScript format in your `.eslint.config.js` file for eslint version 9 and above. Please read the [eslint v9 migration guide](https://eslint.org/docs/latest/use/migrate-to-9.0.0) for further info. Once we have tested enough the compatibility with eslint v9 of predefined configurations, examples, and the integration with other eslint plugins, such as those needed to use TypeScript with this plugin, we will update the examples and release a stable version.
|
|
85
|
+
|
|
65
86
|
## Overview
|
|
66
87
|
|
|
67
88
|
All of the plugin rules need to be able to identify the elements in the project, so, first of all you have to define your project element types by using the `boundaries/elements` setting.
|
|
68
89
|
|
|
69
90
|
The plugin will use the provided patterns to identify each file as one of the element types. It will also assign a type to each dependency detected in the [dependency nodes (`import` or other statements)](#boundariesdependency-nodes), and it will check if the relationship between the dependent element and the dependency is allowed or not.
|
|
70
91
|
|
|
71
|
-
```
|
|
92
|
+
```js
|
|
72
93
|
{
|
|
73
94
|
"settings": {
|
|
74
95
|
"boundaries/elements": [
|
|
@@ -286,14 +307,12 @@ By default, the plugin uses the current working directory (`process.cwd()`) as r
|
|
|
286
307
|
For example, supposing that the `.eslintrc.js` file is located in the project root, you could define the root path as in:
|
|
287
308
|
|
|
288
309
|
```js
|
|
289
|
-
{
|
|
290
310
|
settings: {
|
|
291
311
|
"boundaries/root-path": path.resolve(__dirname)
|
|
292
312
|
}
|
|
293
|
-
}
|
|
294
313
|
```
|
|
295
314
|
|
|
296
|
-
Note that the path should be absolute and resolved before passing it to the plugin. Otherwise, it will be resolved using the current working directory, and the problem will persist.
|
|
315
|
+
Note that the path should be absolute and resolved before passing it to the plugin. Otherwise, it will be resolved using the current working directory, and the problem will persist. You can also use the next environment variable to define the root path when executing the lint command:
|
|
297
316
|
|
|
298
317
|
```bash
|
|
299
318
|
ESLINT_PLUGIN_BOUNDARIES_ROOT_PATH=../../project-root npm run lint
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-boundaries",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0-beta.0",
|
|
4
4
|
"description": "Eslint plugin checking architecture boundaries between elements",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -25,33 +25,32 @@
|
|
|
25
25
|
"lint": "eslint src *.js test",
|
|
26
26
|
"lint-staged": "lint-staged",
|
|
27
27
|
"test": "jest",
|
|
28
|
-
"test:unit": "cross-env ESLINT_PLUGIN_BOUNDARIES_DEBUG=1 npm run test",
|
|
28
|
+
"test:unit": "cross-env ESLINT_USE_FLAT_CONFIG=true ESLINT_PLUGIN_BOUNDARIES_DEBUG=1 npm run test",
|
|
29
29
|
"prepare": "is-ci || husky install"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"eslint": ">=
|
|
32
|
+
"eslint": ">=9.0.0"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"chalk": "4.1.2",
|
|
36
36
|
"eslint-import-resolver-node": "0.3.9",
|
|
37
|
-
"eslint-module-utils": "2.8.
|
|
37
|
+
"eslint-module-utils": "2.8.1",
|
|
38
38
|
"is-core-module": "2.13.1",
|
|
39
39
|
"micromatch": "4.0.5"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@typescript-eslint/
|
|
43
|
-
"@typescript-eslint/
|
|
42
|
+
"@typescript-eslint/parser": "8.0.0-alpha.30",
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "8.0.0-alpha.30",
|
|
44
44
|
"cross-env": "7.0.3",
|
|
45
|
-
"eslint": "
|
|
46
|
-
"eslint-config-prettier": "9.
|
|
47
|
-
"eslint-import-resolver-typescript": "3.6.1",
|
|
48
|
-
"eslint-plugin-prettier": "5.0.1",
|
|
45
|
+
"eslint": "9.5.0",
|
|
46
|
+
"eslint-config-prettier": "9.1.0",
|
|
49
47
|
"eslint-plugin-local-rules": "2.0.1",
|
|
50
|
-
"
|
|
48
|
+
"eslint-plugin-prettier": "5.1.3",
|
|
49
|
+
"husky": "9.0.11",
|
|
51
50
|
"is-ci": "3.0.1",
|
|
52
51
|
"jest": "29.7.0",
|
|
53
|
-
"lint-staged": "15.
|
|
54
|
-
"prettier": "3.
|
|
52
|
+
"lint-staged": "15.2.2",
|
|
53
|
+
"prettier": "3.2.5"
|
|
55
54
|
},
|
|
56
55
|
"lint-staged": {
|
|
57
56
|
"test/**/*.js": "eslint",
|
|
@@ -59,6 +58,6 @@
|
|
|
59
58
|
"*.js": "eslint"
|
|
60
59
|
},
|
|
61
60
|
"engines": {
|
|
62
|
-
"node": ">=
|
|
61
|
+
"node": ">=18.18"
|
|
63
62
|
}
|
|
64
63
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
const { PLUGIN_NAME } = require("../constants/plugin");
|
|
2
|
-
|
|
3
1
|
const {
|
|
4
2
|
ELEMENTS,
|
|
5
|
-
IGNORE,
|
|
6
3
|
// rules
|
|
7
4
|
RULE_ELEMENT_TYPES,
|
|
8
5
|
RULE_ENTRY_POINT,
|
|
@@ -14,7 +11,6 @@ const {
|
|
|
14
11
|
} = require("../constants/settings");
|
|
15
12
|
|
|
16
13
|
module.exports = {
|
|
17
|
-
plugins: [PLUGIN_NAME],
|
|
18
14
|
rules: {
|
|
19
15
|
[RULE_ELEMENT_TYPES]: [2],
|
|
20
16
|
[RULE_ENTRY_POINT]: [2],
|
|
@@ -31,6 +27,5 @@ module.exports = {
|
|
|
31
27
|
},
|
|
32
28
|
settings: {
|
|
33
29
|
[ELEMENTS]: [],
|
|
34
|
-
[IGNORE]: ["**/*.spec?.js", "**/*.test?.js"],
|
|
35
30
|
},
|
|
36
31
|
};
|