eslint-plugin-barrel-rules 1.0.1 → 1.0.3
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.ko.md +3 -3
- package/README.md +3 -3
- package/dist/index.cjs +12 -6
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +12 -6
- package/package.json +3 -3
package/README.ko.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# **Advanced Barrel Pattern Enforcement for JavaScript/TypeScript Projects**
|
|
4
4
|
|
|
5
5
|
<div align="center">
|
|
6
|
-
<img src="https://img.shields.io/badge/version-1.0.
|
|
6
|
+
<img src="https://img.shields.io/badge/version-1.0.3-blue.svg" alt="Version"/>
|
|
7
7
|
<img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License"/>
|
|
8
8
|
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs Welcome"/>
|
|
9
9
|
</div>
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
<img width="320" alt="Scry" src="https://github.com/user-attachments/assets/dc11d2d4-3896-4def-bf5f-e778086a3de8" />
|
|
13
13
|
</div>
|
|
14
14
|
|
|
15
|
-
Github: [https://github.com/racgoo/eslint-plugin-barrel-
|
|
15
|
+
Github: [https://github.com/racgoo/eslint-plugin-barrel-rules](https://github.com/racgoo/eslint-plugin-barrel-rules)
|
|
16
16
|
|
|
17
|
-
NPM: [https://
|
|
17
|
+
NPM: [https://www.npmjs.com/package/eslint-plugin-barrel-rules](https://www.npmjs.com/package/eslint-plugin-barrel-rules)
|
|
18
18
|
|
|
19
19
|
---
|
|
20
20
|
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# **Advanced Barrel Pattern Enforcement for JavaScript/TypeScript Projects**
|
|
4
4
|
|
|
5
5
|
<div align="center">
|
|
6
|
-
<img src="https://img.shields.io/badge/version-1.0.
|
|
6
|
+
<img src="https://img.shields.io/badge/version-1.0.3-blue.svg" alt="Version"/>
|
|
7
7
|
<img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License"/>
|
|
8
8
|
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs Welcome"/>
|
|
9
9
|
</div>
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
<img width="320" alt="Scry" src="https://github.com/user-attachments/assets/dc11d2d4-3896-4def-bf5f-e778086a3de8" />
|
|
13
13
|
</div>
|
|
14
14
|
|
|
15
|
-
Github: [https://github.com/racgoo/eslint-plugin-barrel-
|
|
15
|
+
Github: [https://github.com/racgoo/eslint-plugin-barrel-rules](https://github.com/racgoo/eslint-plugin-barrel-rules)
|
|
16
16
|
|
|
17
|
-
NPM: [https://
|
|
17
|
+
NPM: [https://www.npmjs.com/package/eslint-plugin-barrel-rules](https://www.npmjs.com/package/eslint-plugin-barrel-rules)
|
|
18
18
|
|
|
19
19
|
🇰🇷 [README (Korean)](./README.ko.md)
|
|
20
20
|
|
package/dist/index.cjs
CHANGED
|
@@ -62,15 +62,21 @@ var enforceBarrelPattern = {
|
|
|
62
62
|
//default options(baseDir is current working directory. almost user execute eslint in project root)
|
|
63
63
|
defaultOptions: [{ paths: [], baseDir: process.cwd() }],
|
|
64
64
|
create(context) {
|
|
65
|
-
const
|
|
66
|
-
const baseDir =
|
|
67
|
-
const targetPaths =
|
|
68
|
-
|
|
65
|
+
const option = context.options[0];
|
|
66
|
+
const baseDir = option.baseDir;
|
|
67
|
+
const targetPaths = option.paths.flatMap((_path) => {
|
|
68
|
+
const globResult = import_fast_glob.default.sync(_path, {
|
|
69
69
|
cwd: baseDir,
|
|
70
70
|
onlyDirectories: true,
|
|
71
71
|
absolute: true
|
|
72
|
-
})
|
|
73
|
-
|
|
72
|
+
});
|
|
73
|
+
if (globResult.length === 0) {
|
|
74
|
+
throw new Error(
|
|
75
|
+
`[enforce-barrel-pattern] In baseDir: ${baseDir}, path: ${_path}, any directory was not found`
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
return globResult;
|
|
79
|
+
});
|
|
74
80
|
return {
|
|
75
81
|
//check only import declaration(ESM)
|
|
76
82
|
ImportDeclaration(node) {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { RuleModule } from '@typescript-eslint/utils/ts-eslint';
|
|
2
2
|
|
|
3
|
-
type
|
|
3
|
+
type Option = {
|
|
4
4
|
paths: string[];
|
|
5
5
|
baseDir: string;
|
|
6
|
-
}
|
|
6
|
+
};
|
|
7
7
|
type MessageIds = "DirectImportDisallowed";
|
|
8
|
-
declare const enforceBarrelPattern: RuleModule<MessageIds,
|
|
8
|
+
declare const enforceBarrelPattern: RuleModule<MessageIds, Option[]>;
|
|
9
9
|
|
|
10
10
|
export { enforceBarrelPattern };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { RuleModule } from '@typescript-eslint/utils/ts-eslint';
|
|
2
2
|
|
|
3
|
-
type
|
|
3
|
+
type Option = {
|
|
4
4
|
paths: string[];
|
|
5
5
|
baseDir: string;
|
|
6
|
-
}
|
|
6
|
+
};
|
|
7
7
|
type MessageIds = "DirectImportDisallowed";
|
|
8
|
-
declare const enforceBarrelPattern: RuleModule<MessageIds,
|
|
8
|
+
declare const enforceBarrelPattern: RuleModule<MessageIds, Option[]>;
|
|
9
9
|
|
|
10
10
|
export { enforceBarrelPattern };
|
package/dist/index.js
CHANGED
|
@@ -26,15 +26,21 @@ var enforceBarrelPattern = {
|
|
|
26
26
|
//default options(baseDir is current working directory. almost user execute eslint in project root)
|
|
27
27
|
defaultOptions: [{ paths: [], baseDir: process.cwd() }],
|
|
28
28
|
create(context) {
|
|
29
|
-
const
|
|
30
|
-
const baseDir =
|
|
31
|
-
const targetPaths =
|
|
32
|
-
|
|
29
|
+
const option = context.options[0];
|
|
30
|
+
const baseDir = option.baseDir;
|
|
31
|
+
const targetPaths = option.paths.flatMap((_path) => {
|
|
32
|
+
const globResult = fastGlob.sync(_path, {
|
|
33
33
|
cwd: baseDir,
|
|
34
34
|
onlyDirectories: true,
|
|
35
35
|
absolute: true
|
|
36
|
-
})
|
|
37
|
-
|
|
36
|
+
});
|
|
37
|
+
if (globResult.length === 0) {
|
|
38
|
+
throw new Error(
|
|
39
|
+
`[enforce-barrel-pattern] In baseDir: ${baseDir}, path: ${_path}, any directory was not found`
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
return globResult;
|
|
43
|
+
});
|
|
38
44
|
return {
|
|
39
45
|
//check only import declaration(ESM)
|
|
40
46
|
ImportDeclaration(node) {
|
package/package.json
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
"description": "Enforce barrel module pattern",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
|
-
"url": "https://github.com/racgoo/eslint-plugin-barrel-
|
|
6
|
+
"url": "https://github.com/racgoo/eslint-plugin-barrel-rules"
|
|
7
7
|
},
|
|
8
8
|
"bugs": {
|
|
9
|
-
"url": "https://github.com/racgoo/eslint-plugin-barrel-
|
|
9
|
+
"url": "https://github.com/racgoo/eslint-plugin-barrel-rules/issues"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"dist",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"encapsulation directory",
|
|
24
24
|
"enforce barrel pattern"
|
|
25
25
|
],
|
|
26
|
-
"version": "1.0.
|
|
26
|
+
"version": "1.0.3",
|
|
27
27
|
"type": "module",
|
|
28
28
|
"main": "dist/index.cjs",
|
|
29
29
|
"module": "dist/index.js",
|