@yasainet/eslint 0.0.82 → 0.0.84
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 +1 -1
- package/src/common/_internal/constants.mjs +6 -17
- package/src/common/_internal/find-up.mjs +18 -0
- package/src/common/_internal/plugins.mjs +0 -6
- package/src/common/base/typescript.mjs +7 -16
- package/src/common/layers/queries.mjs +2 -21
- package/src/common/local-plugins/supabase-columns-satisfies.mjs +52 -8
- package/src/next/boundaries/callee-boundaries.mjs +59 -0
- package/src/next/directives.mjs +6 -18
- package/src/next/index.mjs +2 -10
- package/src/next/tailwindcss.mjs +10 -15
- package/src/next/boundaries/components.mjs +0 -36
- package/src/next/boundaries/hooks.mjs +0 -36
- package/src/next/boundaries/page.mjs +0 -36
- package/src/next/boundaries/route.mjs +0 -36
- package/src/next/boundaries/sitemap.mjs +0 -36
package/package.json
CHANGED
|
@@ -1,24 +1,13 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import path from "path";
|
|
3
|
-
import { fileURLToPath } from "url";
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
import { findUp } from "./find-up.mjs";
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
!dir.includes("/node_modules/")
|
|
13
|
-
) {
|
|
14
|
-
return dir;
|
|
15
|
-
}
|
|
16
|
-
dir = path.dirname(dir);
|
|
17
|
-
}
|
|
18
|
-
return process.cwd();
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const PROJECT_ROOT = findProjectRoot();
|
|
6
|
+
const PROJECT_ROOT = findUp(
|
|
7
|
+
import.meta.dirname,
|
|
8
|
+
(dir) => (fs.existsSync(path.join(dir, "package.json")) ? dir : null),
|
|
9
|
+
process.cwd(),
|
|
10
|
+
);
|
|
22
11
|
|
|
23
12
|
const EXCLUDE_LIST = ["types.ts", "proxy.ts", "utils.ts"];
|
|
24
13
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { dirname, sep } from "node:path";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 祖先ディレクトリを遡り、resolve(dir) が truthy を返した値を返す。
|
|
5
|
+
* node_modules 配下 (path segment 判定) は skip。
|
|
6
|
+
* root まで到達しても見つからなければ fallback を返す。
|
|
7
|
+
*/
|
|
8
|
+
export function findUp(start, resolve, fallback) {
|
|
9
|
+
let dir = start;
|
|
10
|
+
while (dir !== dirname(dir)) {
|
|
11
|
+
if (!dir.split(sep).includes("node_modules")) {
|
|
12
|
+
const found = resolve(dir);
|
|
13
|
+
if (found) return found;
|
|
14
|
+
}
|
|
15
|
+
dir = dirname(dir);
|
|
16
|
+
}
|
|
17
|
+
return fallback;
|
|
18
|
+
}
|
|
@@ -2,10 +2,4 @@ import stylistic from "@stylistic/eslint-plugin";
|
|
|
2
2
|
import checkFile from "eslint-plugin-check-file";
|
|
3
3
|
import simpleImportSortPlugin from "eslint-plugin-simple-import-sort";
|
|
4
4
|
|
|
5
|
-
export const plugins = {
|
|
6
|
-
"@stylistic": stylistic,
|
|
7
|
-
"check-file": checkFile,
|
|
8
|
-
"simple-import-sort": simpleImportSortPlugin,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
5
|
export { checkFile, simpleImportSortPlugin, stylistic };
|
|
@@ -1,25 +1,16 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
|
-
import {
|
|
2
|
+
import { join } from "node:path";
|
|
3
3
|
|
|
4
4
|
import tseslint from "typescript-eslint";
|
|
5
5
|
|
|
6
|
+
import { findUp } from "../_internal/find-up.mjs";
|
|
6
7
|
import { simpleImportSortPlugin, stylistic } from "../_internal/plugins.mjs";
|
|
7
8
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
existsSync(join(dir, "tsconfig.json"))
|
|
14
|
-
) {
|
|
15
|
-
return dir;
|
|
16
|
-
}
|
|
17
|
-
dir = dirname(dir);
|
|
18
|
-
}
|
|
19
|
-
return process.cwd();
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const projectRoot = findProjectRoot(import.meta.dirname);
|
|
9
|
+
const projectRoot = findUp(
|
|
10
|
+
import.meta.dirname,
|
|
11
|
+
(dir) => (existsSync(join(dir, "tsconfig.json")) ? dir : null),
|
|
12
|
+
process.cwd(),
|
|
13
|
+
);
|
|
23
14
|
|
|
24
15
|
const sharedRulesConfig = {
|
|
25
16
|
name: "rules/shared",
|
|
@@ -112,27 +112,8 @@ export function createQueriesConfigs({ featureRoot, prefixLibMapping }) {
|
|
|
112
112
|
"queries で if 文は禁止。条件分岐は services に置く。",
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
|
-
selector:
|
|
116
|
-
|
|
117
|
-
"queries でループは禁止。queries は薄い CRUD ラッパー、反復は services に置く。",
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
selector: "ForOfStatement",
|
|
121
|
-
message:
|
|
122
|
-
"queries でループは禁止。queries は薄い CRUD ラッパー、反復は services に置く。",
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
selector: "ForInStatement",
|
|
126
|
-
message:
|
|
127
|
-
"queries でループは禁止。queries は薄い CRUD ラッパー、反復は services に置く。",
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
selector: "WhileStatement",
|
|
131
|
-
message:
|
|
132
|
-
"queries でループは禁止。queries は薄い CRUD ラッパー、反復は services に置く。",
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
selector: "DoWhileStatement",
|
|
115
|
+
selector:
|
|
116
|
+
"ForStatement, ForOfStatement, ForInStatement, WhileStatement, DoWhileStatement",
|
|
136
117
|
message:
|
|
137
118
|
"queries でループは禁止。queries は薄い CRUD ラッパー、反復は services に置く。",
|
|
138
119
|
},
|
|
@@ -1,15 +1,58 @@
|
|
|
1
1
|
const COLUMNS_NAME = /^[A-Z][A-Z0-9_]*_COLUMNS$/;
|
|
2
2
|
|
|
3
|
-
function
|
|
4
|
-
if (!initNode) return false;
|
|
5
|
-
if (initNode.type !== "TSAsExpression") return false;
|
|
3
|
+
function isAsConst(initNode) {
|
|
4
|
+
if (!initNode || initNode.type !== "TSAsExpression") return false;
|
|
6
5
|
const ann = initNode.typeAnnotation;
|
|
7
6
|
if (!ann || ann.type !== "TSTypeReference") return false;
|
|
8
7
|
if (ann.typeName.type !== "Identifier") return false;
|
|
9
|
-
|
|
8
|
+
return ann.typeName.name === "const";
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function isAsConstStringLiteral(initNode) {
|
|
12
|
+
if (!isAsConst(initNode)) return false;
|
|
13
|
+
const inner = initNode.expression;
|
|
14
|
+
return inner.type === "Literal" && typeof inner.value === "string";
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function isLocalAsConstStringRef(identifier, sourceCode) {
|
|
18
|
+
let scope = sourceCode.getScope(identifier);
|
|
19
|
+
while (scope) {
|
|
20
|
+
const variable = scope.set.get(identifier.name);
|
|
21
|
+
if (variable) {
|
|
22
|
+
const def = variable.defs[0];
|
|
23
|
+
if (!def || def.type !== "Variable") return false;
|
|
24
|
+
if (def.parent?.kind !== "const") return false;
|
|
25
|
+
return isAsConstStringLiteral(def.node.init);
|
|
26
|
+
}
|
|
27
|
+
scope = scope.upper;
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* `*_COLUMNS` 定数の shape を検証し、Supabase `.select()` の型推論を保つ。
|
|
34
|
+
*
|
|
35
|
+
* 許容するのは以下のいずれか:
|
|
36
|
+
* - `"..." as const` (string literal)
|
|
37
|
+
* - `` `${IDENT}, ...` as const `` (template literal で interpolation が
|
|
38
|
+
* 全て **同一 file scope の as const string literal Identifier** であるもの)
|
|
39
|
+
*
|
|
40
|
+
* Why-not type-aware (cross-module 追跡): rule を dumb で機械的に保つため
|
|
41
|
+
* scope manager の参照解決のみで検査する。派生定数を作りたい場合は base 定数と
|
|
42
|
+
* 同じ file に集約する運用とする (詳細: yasainet/eslint#3)。
|
|
43
|
+
*/
|
|
44
|
+
function isValidShape(initNode, sourceCode) {
|
|
45
|
+
if (!isAsConst(initNode)) return false;
|
|
10
46
|
const inner = initNode.expression;
|
|
11
|
-
if (inner.type
|
|
12
|
-
|
|
47
|
+
if (inner.type === "Literal") return typeof inner.value === "string";
|
|
48
|
+
if (inner.type === "TemplateLiteral") {
|
|
49
|
+
return inner.expressions.every(
|
|
50
|
+
(expr) =>
|
|
51
|
+
expr.type === "Identifier" &&
|
|
52
|
+
isLocalAsConstStringRef(expr, sourceCode),
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
13
56
|
}
|
|
14
57
|
|
|
15
58
|
export const supabaseColumnsSatisfiesRule = {
|
|
@@ -17,17 +60,18 @@ export const supabaseColumnsSatisfiesRule = {
|
|
|
17
60
|
type: "problem",
|
|
18
61
|
messages: {
|
|
19
62
|
shape:
|
|
20
|
-
'column 定数 `{{ name }}` は `"
|
|
63
|
+
'column 定数 `{{ name }}` は `"..." as const` か、`` `${BASE}, ...` as const `` で同一 file 内の as const literal を合成する。配列 / 識別子追跡不可能な template literal / 文字列結合は不可。`as const` を外すと Supabase `.select()` の型推論が壊れる。',
|
|
21
64
|
},
|
|
22
65
|
schema: [],
|
|
23
66
|
},
|
|
24
67
|
create(context) {
|
|
68
|
+
const sourceCode = context.sourceCode;
|
|
25
69
|
return {
|
|
26
70
|
VariableDeclarator(node) {
|
|
27
71
|
if (node.id.type !== "Identifier") return;
|
|
28
72
|
if (!COLUMNS_NAME.test(node.id.name)) return;
|
|
29
73
|
if (!node.init) return;
|
|
30
|
-
if (
|
|
74
|
+
if (isValidShape(node.init, sourceCode)) return;
|
|
31
75
|
context.report({
|
|
32
76
|
node: node.id,
|
|
33
77
|
messageId: "shape",
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LIB_BOUNDARY_PATTERNS,
|
|
3
|
+
MAPPING_PATTERNS,
|
|
4
|
+
} from "../../common/_internal/import-patterns.mjs";
|
|
5
|
+
|
|
6
|
+
function createCalleeBoundaryConfig({ name, files, surface, via = "entries" }) {
|
|
7
|
+
return {
|
|
8
|
+
name,
|
|
9
|
+
files,
|
|
10
|
+
rules: {
|
|
11
|
+
"no-restricted-imports": [
|
|
12
|
+
"error",
|
|
13
|
+
{
|
|
14
|
+
patterns: [
|
|
15
|
+
{
|
|
16
|
+
group: ["**/queries/*", "**/queries"],
|
|
17
|
+
message: `${surface} は queries を直接 import 不可。${via} 経由で使う。`,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
group: ["**/services/*", "**/services"],
|
|
21
|
+
message: `${surface} は services を直接 import 不可。${via} 経由で使う。`,
|
|
22
|
+
},
|
|
23
|
+
...LIB_BOUNDARY_PATTERNS,
|
|
24
|
+
...MAPPING_PATTERNS,
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const calleeBoundaryConfigs = [
|
|
33
|
+
createCalleeBoundaryConfig({
|
|
34
|
+
name: "imports/page-boundary",
|
|
35
|
+
surface: "page.tsx",
|
|
36
|
+
files: ["src/app/**/page.tsx"],
|
|
37
|
+
}),
|
|
38
|
+
createCalleeBoundaryConfig({
|
|
39
|
+
name: "imports/route-boundary",
|
|
40
|
+
surface: "route.ts",
|
|
41
|
+
files: ["src/app/**/route.ts"],
|
|
42
|
+
}),
|
|
43
|
+
createCalleeBoundaryConfig({
|
|
44
|
+
name: "imports/sitemap-boundary",
|
|
45
|
+
surface: "sitemap.ts",
|
|
46
|
+
files: ["src/app/sitemap.ts", "src/app/**/sitemap.ts"],
|
|
47
|
+
}),
|
|
48
|
+
createCalleeBoundaryConfig({
|
|
49
|
+
name: "imports/hooks-boundary",
|
|
50
|
+
surface: "hooks",
|
|
51
|
+
files: ["src/features/**/hooks/*.ts"],
|
|
52
|
+
}),
|
|
53
|
+
createCalleeBoundaryConfig({
|
|
54
|
+
name: "imports/components-boundary",
|
|
55
|
+
surface: "components",
|
|
56
|
+
files: ["src/components/**/*.{ts,tsx}"],
|
|
57
|
+
via: "entries か hooks",
|
|
58
|
+
}),
|
|
59
|
+
];
|
package/src/next/directives.mjs
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export const directivesConfigs = [
|
|
2
2
|
{
|
|
3
|
-
name: "directives/server-entry",
|
|
4
|
-
files: [
|
|
3
|
+
name: "directives/server-side-entry",
|
|
4
|
+
files: [
|
|
5
|
+
"src/features/**/entries/server.ts",
|
|
6
|
+
"src/features/**/entries/admin.ts",
|
|
7
|
+
],
|
|
5
8
|
rules: {
|
|
6
9
|
"no-restricted-syntax": [
|
|
7
10
|
"error",
|
|
@@ -9,22 +12,7 @@ export const directivesConfigs = [
|
|
|
9
12
|
selector:
|
|
10
13
|
"Program > :first-child:not(ExpressionStatement[expression.value='use server'])",
|
|
11
14
|
message:
|
|
12
|
-
'entries
|
|
13
|
-
},
|
|
14
|
-
],
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
name: "directives/admin-entry",
|
|
19
|
-
files: ["src/features/**/entries/admin.ts"],
|
|
20
|
-
rules: {
|
|
21
|
-
"no-restricted-syntax": [
|
|
22
|
-
"error",
|
|
23
|
-
{
|
|
24
|
-
selector:
|
|
25
|
-
"Program > :first-child:not(ExpressionStatement[expression.value='use server'])",
|
|
26
|
-
message:
|
|
27
|
-
'entries/admin.ts は先頭に "use server" directive が必須。',
|
|
15
|
+
'server-side entries (server.ts / admin.ts) は先頭に "use server" directive が必須。',
|
|
28
16
|
},
|
|
29
17
|
],
|
|
30
18
|
},
|
package/src/next/index.mjs
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { createEntryPointConfigs } from "../common/boundaries/entry-point.mjs";
|
|
2
2
|
import { createCommonConfigs } from "../common/index.mjs";
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import { hooksBoundaryConfigs } from "./boundaries/hooks.mjs";
|
|
4
|
+
import { calleeBoundaryConfigs } from "./boundaries/callee-boundaries.mjs";
|
|
6
5
|
import { libBoundaryConfigs } from "./boundaries/lib.mjs";
|
|
7
|
-
import { pageBoundaryConfigs } from "./boundaries/page.mjs";
|
|
8
|
-
import { routeBoundaryConfigs } from "./boundaries/route.mjs";
|
|
9
|
-
import { sitemapBoundaryConfigs } from "./boundaries/sitemap.mjs";
|
|
10
6
|
import { directivesConfigs } from "./directives.mjs";
|
|
11
7
|
import { importPathStyleConfigs } from "./imports.mjs";
|
|
12
8
|
import { componentsLayerConfigs } from "./layers/components.mjs";
|
|
@@ -25,11 +21,7 @@ export const eslintConfig = [
|
|
|
25
21
|
},
|
|
26
22
|
...createCommonConfigs("src/features"),
|
|
27
23
|
...libBoundaryConfigs,
|
|
28
|
-
...
|
|
29
|
-
...routeBoundaryConfigs,
|
|
30
|
-
...sitemapBoundaryConfigs,
|
|
31
|
-
...hooksBoundaryConfigs,
|
|
32
|
-
...componentsBoundaryConfigs,
|
|
24
|
+
...calleeBoundaryConfigs,
|
|
33
25
|
...hooksLayerConfigs,
|
|
34
26
|
...componentsLayerConfigs,
|
|
35
27
|
...directivesConfigs,
|
package/src/next/tailwindcss.mjs
CHANGED
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
|
-
import {
|
|
2
|
+
import { join } from "node:path";
|
|
3
3
|
|
|
4
4
|
import betterTailwindcss from "eslint-plugin-better-tailwindcss";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
let dir = start;
|
|
8
|
-
while (dir !== dirname(dir)) {
|
|
9
|
-
if (!dir.split(sep).includes("node_modules")) {
|
|
10
|
-
const candidate = join(dir, "src/app/globals.css");
|
|
11
|
-
if (existsSync(candidate)) {
|
|
12
|
-
return candidate;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
dir = dirname(dir);
|
|
16
|
-
}
|
|
17
|
-
return "src/app/globals.css";
|
|
18
|
-
};
|
|
6
|
+
import { findUp } from "../common/_internal/find-up.mjs";
|
|
19
7
|
|
|
20
|
-
const entryPoint =
|
|
8
|
+
const entryPoint = findUp(
|
|
9
|
+
import.meta.dirname,
|
|
10
|
+
(dir) => {
|
|
11
|
+
const candidate = join(dir, "src/app/globals.css");
|
|
12
|
+
return existsSync(candidate) ? candidate : null;
|
|
13
|
+
},
|
|
14
|
+
"src/app/globals.css",
|
|
15
|
+
);
|
|
21
16
|
|
|
22
17
|
export const tailwindcssConfigs = [
|
|
23
18
|
{
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
LIB_BOUNDARY_PATTERNS,
|
|
3
|
-
MAPPING_PATTERNS,
|
|
4
|
-
} from "../../common/_internal/import-patterns.mjs";
|
|
5
|
-
|
|
6
|
-
const COMPONENTS_BOUNDARY_PATTERNS = [
|
|
7
|
-
{
|
|
8
|
-
group: ["**/queries/*", "**/queries"],
|
|
9
|
-
message:
|
|
10
|
-
"components は queries を直接 import 不可。entries か hooks 経由で使う。",
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
group: ["**/services/*", "**/services"],
|
|
14
|
-
message:
|
|
15
|
-
"components は services を直接 import 不可。entries か hooks 経由で使う。",
|
|
16
|
-
},
|
|
17
|
-
];
|
|
18
|
-
|
|
19
|
-
export const componentsBoundaryConfigs = [
|
|
20
|
-
{
|
|
21
|
-
name: "imports/components-boundary",
|
|
22
|
-
files: ["src/components/**/*.{ts,tsx}"],
|
|
23
|
-
rules: {
|
|
24
|
-
"no-restricted-imports": [
|
|
25
|
-
"error",
|
|
26
|
-
{
|
|
27
|
-
patterns: [
|
|
28
|
-
...COMPONENTS_BOUNDARY_PATTERNS,
|
|
29
|
-
...LIB_BOUNDARY_PATTERNS,
|
|
30
|
-
...MAPPING_PATTERNS,
|
|
31
|
-
],
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
];
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
LIB_BOUNDARY_PATTERNS,
|
|
3
|
-
MAPPING_PATTERNS,
|
|
4
|
-
} from "../../common/_internal/import-patterns.mjs";
|
|
5
|
-
|
|
6
|
-
const HOOKS_BOUNDARY_PATTERNS = [
|
|
7
|
-
{
|
|
8
|
-
group: ["**/queries/*", "**/queries"],
|
|
9
|
-
message:
|
|
10
|
-
"hooks は queries を直接 import 不可。entries 経由で使う。",
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
group: ["**/services/*", "**/services"],
|
|
14
|
-
message:
|
|
15
|
-
"hooks は services を直接 import 不可。entries 経由で使う。",
|
|
16
|
-
},
|
|
17
|
-
];
|
|
18
|
-
|
|
19
|
-
export const hooksBoundaryConfigs = [
|
|
20
|
-
{
|
|
21
|
-
name: "imports/hooks-boundary",
|
|
22
|
-
files: ["src/features/**/hooks/*.ts"],
|
|
23
|
-
rules: {
|
|
24
|
-
"no-restricted-imports": [
|
|
25
|
-
"error",
|
|
26
|
-
{
|
|
27
|
-
patterns: [
|
|
28
|
-
...HOOKS_BOUNDARY_PATTERNS,
|
|
29
|
-
...LIB_BOUNDARY_PATTERNS,
|
|
30
|
-
...MAPPING_PATTERNS,
|
|
31
|
-
],
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
];
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
LIB_BOUNDARY_PATTERNS,
|
|
3
|
-
MAPPING_PATTERNS,
|
|
4
|
-
} from "../../common/_internal/import-patterns.mjs";
|
|
5
|
-
|
|
6
|
-
const PAGE_BOUNDARY_PATTERNS = [
|
|
7
|
-
{
|
|
8
|
-
group: ["**/queries/*", "**/queries"],
|
|
9
|
-
message:
|
|
10
|
-
"page.tsx は queries を直接 import 不可。entries 経由で使う。",
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
group: ["**/services/*", "**/services"],
|
|
14
|
-
message:
|
|
15
|
-
"page.tsx は services を直接 import 不可。entries 経由で使う。",
|
|
16
|
-
},
|
|
17
|
-
];
|
|
18
|
-
|
|
19
|
-
export const pageBoundaryConfigs = [
|
|
20
|
-
{
|
|
21
|
-
name: "imports/page-boundary",
|
|
22
|
-
files: ["src/app/**/page.tsx"],
|
|
23
|
-
rules: {
|
|
24
|
-
"no-restricted-imports": [
|
|
25
|
-
"error",
|
|
26
|
-
{
|
|
27
|
-
patterns: [
|
|
28
|
-
...PAGE_BOUNDARY_PATTERNS,
|
|
29
|
-
...LIB_BOUNDARY_PATTERNS,
|
|
30
|
-
...MAPPING_PATTERNS,
|
|
31
|
-
],
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
];
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
LIB_BOUNDARY_PATTERNS,
|
|
3
|
-
MAPPING_PATTERNS,
|
|
4
|
-
} from "../../common/_internal/import-patterns.mjs";
|
|
5
|
-
|
|
6
|
-
const ROUTE_BOUNDARY_PATTERNS = [
|
|
7
|
-
{
|
|
8
|
-
group: ["**/queries/*", "**/queries"],
|
|
9
|
-
message:
|
|
10
|
-
"route.ts は queries を直接 import 不可。entries 経由で使う。",
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
group: ["**/services/*", "**/services"],
|
|
14
|
-
message:
|
|
15
|
-
"route.ts は services を直接 import 不可。entries 経由で使う。",
|
|
16
|
-
},
|
|
17
|
-
];
|
|
18
|
-
|
|
19
|
-
export const routeBoundaryConfigs = [
|
|
20
|
-
{
|
|
21
|
-
name: "imports/route-boundary",
|
|
22
|
-
files: ["src/app/**/route.ts"],
|
|
23
|
-
rules: {
|
|
24
|
-
"no-restricted-imports": [
|
|
25
|
-
"error",
|
|
26
|
-
{
|
|
27
|
-
patterns: [
|
|
28
|
-
...ROUTE_BOUNDARY_PATTERNS,
|
|
29
|
-
...LIB_BOUNDARY_PATTERNS,
|
|
30
|
-
...MAPPING_PATTERNS,
|
|
31
|
-
],
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
];
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
LIB_BOUNDARY_PATTERNS,
|
|
3
|
-
MAPPING_PATTERNS,
|
|
4
|
-
} from "../../common/_internal/import-patterns.mjs";
|
|
5
|
-
|
|
6
|
-
const SITEMAP_BOUNDARY_PATTERNS = [
|
|
7
|
-
{
|
|
8
|
-
group: ["**/queries/*", "**/queries"],
|
|
9
|
-
message:
|
|
10
|
-
"sitemap.ts は queries を直接 import 不可。entries 経由で使う。",
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
group: ["**/services/*", "**/services"],
|
|
14
|
-
message:
|
|
15
|
-
"sitemap.ts は services を直接 import 不可。entries 経由で使う。",
|
|
16
|
-
},
|
|
17
|
-
];
|
|
18
|
-
|
|
19
|
-
export const sitemapBoundaryConfigs = [
|
|
20
|
-
{
|
|
21
|
-
name: "imports/sitemap-boundary",
|
|
22
|
-
files: ["src/app/sitemap.ts", "src/app/**/sitemap.ts"],
|
|
23
|
-
rules: {
|
|
24
|
-
"no-restricted-imports": [
|
|
25
|
-
"error",
|
|
26
|
-
{
|
|
27
|
-
patterns: [
|
|
28
|
-
...SITEMAP_BOUNDARY_PATTERNS,
|
|
29
|
-
...LIB_BOUNDARY_PATTERNS,
|
|
30
|
-
...MAPPING_PATTERNS,
|
|
31
|
-
],
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
];
|