eslint-plugin-barrel-rules 1.3.0 → 1.3.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.ko.md +7 -3
- package/README.md +5 -2
- package/dist/index.cjs +25 -4
- package/dist/index.js +25 -4
- package/package.json +1 -1
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.3.
|
|
6
|
+
<img src="https://img.shields.io/badge/version-1.3.1-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>
|
|
@@ -28,7 +28,11 @@ JavaScript/TypeScript 프로젝트에서 Barrel Pattern(배럴 패턴)을 강제
|
|
|
28
28
|
내부 파일을 직접 import하는 것을 차단하여
|
|
29
29
|
**모듈화, 추상화, 유지보수성, 확장성**을 극대화합니다.
|
|
30
30
|
|
|
31
|
-
> 💡 Tip:
|
|
31
|
+
> 💡 Tip:
|
|
32
|
+
>
|
|
33
|
+
> > 이 플러그인은 `node_modules`(외부 패키지)의 import는 제한하거나 검사하지 않습니다.
|
|
34
|
+
> > 모든 규칙은 오직 프로젝트 내부(로컬 소스 파일) 경로의 import에만 적용됩니다.
|
|
35
|
+
>
|
|
32
36
|
> 코드 품질을 더욱 강화하고 싶다면, 이 플러그인과 함께 [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import)의 `no-cycle` 룰을 사용하는 것을 추천합니다.
|
|
33
37
|
> 이를 통해 프로젝트 내의 순환 참조(Import Cycle)도 효과적으로 감지하고 방지할 수 있습니다.
|
|
34
38
|
|
|
@@ -222,7 +226,7 @@ export default tseslint.config([
|
|
|
222
226
|
},
|
|
223
227
|
],
|
|
224
228
|
baseDir: __dirname,
|
|
225
|
-
globalAllowPaths: ["src/shares/*"
|
|
229
|
+
globalAllowPaths: ["src/shares/*"],
|
|
226
230
|
},
|
|
227
231
|
],
|
|
228
232
|
|
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.3.
|
|
6
|
+
<img src="https://img.shields.io/badge/version-1.3.1-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>
|
|
@@ -32,6 +32,9 @@ Direct imports from internal files are blocked, maximizing
|
|
|
32
32
|
**modularity, abstraction, maintainability, and scalability**.
|
|
33
33
|
|
|
34
34
|
> 💡 Tip:
|
|
35
|
+
> This plugin does not restrict or track imports from `node_modules` (external packages).
|
|
36
|
+
> The rules only apply to imports of internal (local source file) paths within your project.
|
|
37
|
+
>
|
|
35
38
|
> For even stronger code quality, we recommend using the `no-cycle` rule from [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import) together with this plugin.
|
|
36
39
|
> This allows you to detect and prevent circular dependencies (import cycles) in your project.
|
|
37
40
|
|
|
@@ -228,7 +231,7 @@ export default tseslint.config([
|
|
|
228
231
|
},
|
|
229
232
|
],
|
|
230
233
|
baseDir: __dirname,
|
|
231
|
-
globalAllowPaths: ["src/shares/*"
|
|
234
|
+
globalAllowPaths: ["src/shares/*"],
|
|
232
235
|
},
|
|
233
236
|
],
|
|
234
237
|
|
package/dist/index.cjs
CHANGED
|
@@ -123,13 +123,20 @@ var BARREL_ENTRY_POINT_FILE_NAMES = [
|
|
|
123
123
|
];
|
|
124
124
|
var RESOLVE_EXTENSIONS = [
|
|
125
125
|
".ts",
|
|
126
|
-
".tsx",
|
|
127
126
|
".js",
|
|
127
|
+
".tsx",
|
|
128
128
|
".jsx",
|
|
129
129
|
".json",
|
|
130
|
+
".d.js",
|
|
130
131
|
".d.ts",
|
|
131
132
|
".mjs",
|
|
132
|
-
".cjs"
|
|
133
|
+
".cjs",
|
|
134
|
+
".mts",
|
|
135
|
+
".cts",
|
|
136
|
+
".d.mjs",
|
|
137
|
+
".d.cjs",
|
|
138
|
+
".d.mts",
|
|
139
|
+
".d.cts"
|
|
133
140
|
];
|
|
134
141
|
var enforceBarrelPattern = {
|
|
135
142
|
meta: {
|
|
@@ -197,6 +204,9 @@ var enforceBarrelPattern = {
|
|
|
197
204
|
if (aliasResult.type === "success") {
|
|
198
205
|
absoluteImportPath = aliasResult.absolutePath;
|
|
199
206
|
} else {
|
|
207
|
+
if (!rawImportPath.startsWith(".") && !rawImportPath.startsWith("/") || rawImportPath.includes("/node_modules/")) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
200
210
|
absoluteImportPath = import_resolve.default.sync(rawImportPath, {
|
|
201
211
|
basedir: import_path2.default.dirname(absoluteCurrentFilePath),
|
|
202
212
|
extensions: RESOLVE_EXTENSIONS
|
|
@@ -250,12 +260,20 @@ var import_path3 = __toESM(require("path"), 1);
|
|
|
250
260
|
var import_resolve2 = __toESM(require("resolve"), 1);
|
|
251
261
|
var RESOLVE_EXTENSIONS2 = [
|
|
252
262
|
".ts",
|
|
253
|
-
".tsx",
|
|
254
263
|
".js",
|
|
264
|
+
".tsx",
|
|
255
265
|
".jsx",
|
|
266
|
+
".json",
|
|
267
|
+
".d.js",
|
|
256
268
|
".d.ts",
|
|
257
269
|
".mjs",
|
|
258
|
-
".cjs"
|
|
270
|
+
".cjs",
|
|
271
|
+
".mts",
|
|
272
|
+
".cts",
|
|
273
|
+
".d.mjs",
|
|
274
|
+
".d.cjs",
|
|
275
|
+
".d.mts",
|
|
276
|
+
".d.cts"
|
|
259
277
|
];
|
|
260
278
|
var isolateBarrelFile = {
|
|
261
279
|
meta: {
|
|
@@ -319,6 +337,9 @@ var isolateBarrelFile = {
|
|
|
319
337
|
if (aliasResult.type === "success") {
|
|
320
338
|
absoluteImportPath = aliasResult.absolutePath;
|
|
321
339
|
} else {
|
|
340
|
+
if (!rawImportPath.startsWith(".") && !rawImportPath.startsWith("/") || rawImportPath.includes("/node_modules/")) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
322
343
|
absoluteImportPath = import_resolve2.default.sync(rawImportPath, {
|
|
323
344
|
basedir: import_path3.default.dirname(absoluteCurrentFilePath),
|
|
324
345
|
extensions: RESOLVE_EXTENSIONS2
|
package/dist/index.js
CHANGED
|
@@ -87,13 +87,20 @@ var BARREL_ENTRY_POINT_FILE_NAMES = [
|
|
|
87
87
|
];
|
|
88
88
|
var RESOLVE_EXTENSIONS = [
|
|
89
89
|
".ts",
|
|
90
|
-
".tsx",
|
|
91
90
|
".js",
|
|
91
|
+
".tsx",
|
|
92
92
|
".jsx",
|
|
93
93
|
".json",
|
|
94
|
+
".d.js",
|
|
94
95
|
".d.ts",
|
|
95
96
|
".mjs",
|
|
96
|
-
".cjs"
|
|
97
|
+
".cjs",
|
|
98
|
+
".mts",
|
|
99
|
+
".cts",
|
|
100
|
+
".d.mjs",
|
|
101
|
+
".d.cjs",
|
|
102
|
+
".d.mts",
|
|
103
|
+
".d.cts"
|
|
97
104
|
];
|
|
98
105
|
var enforceBarrelPattern = {
|
|
99
106
|
meta: {
|
|
@@ -161,6 +168,9 @@ var enforceBarrelPattern = {
|
|
|
161
168
|
if (aliasResult.type === "success") {
|
|
162
169
|
absoluteImportPath = aliasResult.absolutePath;
|
|
163
170
|
} else {
|
|
171
|
+
if (!rawImportPath.startsWith(".") && !rawImportPath.startsWith("/") || rawImportPath.includes("/node_modules/")) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
164
174
|
absoluteImportPath = resolve.sync(rawImportPath, {
|
|
165
175
|
basedir: path2.dirname(absoluteCurrentFilePath),
|
|
166
176
|
extensions: RESOLVE_EXTENSIONS
|
|
@@ -214,12 +224,20 @@ import path3 from "path";
|
|
|
214
224
|
import resolve2 from "resolve";
|
|
215
225
|
var RESOLVE_EXTENSIONS2 = [
|
|
216
226
|
".ts",
|
|
217
|
-
".tsx",
|
|
218
227
|
".js",
|
|
228
|
+
".tsx",
|
|
219
229
|
".jsx",
|
|
230
|
+
".json",
|
|
231
|
+
".d.js",
|
|
220
232
|
".d.ts",
|
|
221
233
|
".mjs",
|
|
222
|
-
".cjs"
|
|
234
|
+
".cjs",
|
|
235
|
+
".mts",
|
|
236
|
+
".cts",
|
|
237
|
+
".d.mjs",
|
|
238
|
+
".d.cjs",
|
|
239
|
+
".d.mts",
|
|
240
|
+
".d.cts"
|
|
223
241
|
];
|
|
224
242
|
var isolateBarrelFile = {
|
|
225
243
|
meta: {
|
|
@@ -283,6 +301,9 @@ var isolateBarrelFile = {
|
|
|
283
301
|
if (aliasResult.type === "success") {
|
|
284
302
|
absoluteImportPath = aliasResult.absolutePath;
|
|
285
303
|
} else {
|
|
304
|
+
if (!rawImportPath.startsWith(".") && !rawImportPath.startsWith("/") || rawImportPath.includes("/node_modules/")) {
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
286
307
|
absoluteImportPath = resolve2.sync(rawImportPath, {
|
|
287
308
|
basedir: path3.dirname(absoluteCurrentFilePath),
|
|
288
309
|
extensions: RESOLVE_EXTENSIONS2
|