@yasainet/eslint 0.0.76 → 0.0.78
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/package.json
CHANGED
|
@@ -20,7 +20,7 @@ function findProjectRoot() {
|
|
|
20
20
|
|
|
21
21
|
const PROJECT_ROOT = findProjectRoot();
|
|
22
22
|
|
|
23
|
-
const EXCLUDE_LIST = ["type.ts", "proxy.ts"];
|
|
23
|
+
const EXCLUDE_LIST = ["type.ts", "proxy.ts", "utils.ts"];
|
|
24
24
|
|
|
25
25
|
export function generatePrefixLibMapping(featureRoot) {
|
|
26
26
|
const libRoot = featureRoot.replace(/features$/, "lib");
|
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
export const LIB_BOUNDARY_PATTERNS = [
|
|
2
2
|
{
|
|
3
|
-
|
|
3
|
+
regex: "^@/lib/(?!.*/utils$).+",
|
|
4
4
|
message:
|
|
5
|
-
"lib/* は queries からのみ import
|
|
5
|
+
"lib/* は queries からのみ import 可 (lib/**/utils.ts の純粋ヘルパーは全層から可)。他層は queries 経由で使う。",
|
|
6
|
+
},
|
|
7
|
+
];
|
|
8
|
+
|
|
9
|
+
export const LIB_OUTBOUND_PATTERNS = [
|
|
10
|
+
{
|
|
11
|
+
regex: "^@/(?!lib/).+",
|
|
12
|
+
message:
|
|
13
|
+
"lib は app 内部 (@/features 等) を import 不可。lib は最下層の API 橋渡し。外部 SDK と @/lib/** のみ依存可。",
|
|
14
|
+
},
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
export const LIB_UTILS_PURITY_PATTERNS = [
|
|
18
|
+
...LIB_OUTBOUND_PATTERNS,
|
|
19
|
+
{
|
|
20
|
+
regex: "^@/lib/(?!.*/types$).+",
|
|
21
|
+
message:
|
|
22
|
+
"lib/**/utils.ts は純粋ヘルパー。client/index は import 不可、@/lib/**/types のみ可。",
|
|
6
23
|
},
|
|
7
24
|
];
|
|
8
25
|
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LIB_OUTBOUND_PATTERNS,
|
|
3
|
+
LIB_UTILS_PURITY_PATTERNS,
|
|
4
|
+
} from "../../_internal/import-patterns.mjs";
|
|
1
5
|
import { checkFile } from "../../_internal/plugins.mjs";
|
|
2
6
|
|
|
3
7
|
export function createTopLevelLibConfigs({ featureRoot }) {
|
|
@@ -14,5 +18,25 @@ export function createTopLevelLibConfigs({ featureRoot }) {
|
|
|
14
18
|
],
|
|
15
19
|
},
|
|
16
20
|
},
|
|
21
|
+
{
|
|
22
|
+
name: "imports/top-level-lib",
|
|
23
|
+
files: [`${libRoot}/**/*.ts`],
|
|
24
|
+
rules: {
|
|
25
|
+
"no-restricted-imports": [
|
|
26
|
+
"error",
|
|
27
|
+
{ patterns: LIB_OUTBOUND_PATTERNS },
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: "imports/top-level-lib-utils",
|
|
33
|
+
files: [`${libRoot}/**/utils.ts`],
|
|
34
|
+
rules: {
|
|
35
|
+
"no-restricted-imports": [
|
|
36
|
+
"error",
|
|
37
|
+
{ patterns: LIB_UTILS_PURITY_PATTERNS },
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
},
|
|
17
41
|
];
|
|
18
42
|
}
|