@yasainet/eslint 0.0.71 → 0.0.73
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/layers.mjs +27 -0
- package/src/next/naming.mjs +3 -1
package/package.json
CHANGED
package/src/common/layers.mjs
CHANGED
|
@@ -13,6 +13,11 @@ export function createLayersConfigs(featureRoot, { typeAware = true } = {}) {
|
|
|
13
13
|
const loggerMessage =
|
|
14
14
|
"logger is not allowed outside entries. Logging belongs in entries.";
|
|
15
15
|
|
|
16
|
+
const aliasDynamicImportSelector =
|
|
17
|
+
"ImportExpression[source.type='Literal'][source.value=/^@\\//]";
|
|
18
|
+
const aliasDynamicImportMessage =
|
|
19
|
+
"Dynamic imports of `@/` aliased paths are not allowed in features layers. They bypass prefix-lib and lateral cardinality (e.g. `await import('@/lib/supabase/admin')` from queries/server.ts escapes the lib-boundary check). Create the correct queries/<prefix>.ts or services/<prefix>.ts file instead. External npm packages can still be lazy-loaded for cold-start optimization.";
|
|
20
|
+
|
|
16
21
|
const noAnyReturnConfig = {
|
|
17
22
|
name: "layers/no-any-return",
|
|
18
23
|
files: [
|
|
@@ -87,6 +92,10 @@ export function createLayersConfigs(featureRoot, { typeAware = true } = {}) {
|
|
|
87
92
|
"throw is not allowed in queries. Queries must return Supabase's { data, error } shape as-is. Error handling belongs in entries.",
|
|
88
93
|
},
|
|
89
94
|
{ selector: loggerSelector, message: loggerMessage },
|
|
95
|
+
{
|
|
96
|
+
selector: aliasDynamicImportSelector,
|
|
97
|
+
message: aliasDynamicImportMessage,
|
|
98
|
+
},
|
|
90
99
|
],
|
|
91
100
|
},
|
|
92
101
|
},
|
|
@@ -124,6 +133,24 @@ export function createLayersConfigs(featureRoot, { typeAware = true } = {}) {
|
|
|
124
133
|
message:
|
|
125
134
|
"Dead fallback for nullable error. Check `if (error)` and return the error directly. Unhandled exceptions belong in entries.",
|
|
126
135
|
},
|
|
136
|
+
{
|
|
137
|
+
selector: aliasDynamicImportSelector,
|
|
138
|
+
message: aliasDynamicImportMessage,
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
// Entries: ban dynamic `@/` imports that bypass cardinality / lateral rules
|
|
144
|
+
{
|
|
145
|
+
name: "layers/entries",
|
|
146
|
+
files: [`${featureRoot}/**/entries/*.ts`],
|
|
147
|
+
rules: {
|
|
148
|
+
"no-restricted-syntax": [
|
|
149
|
+
"error",
|
|
150
|
+
{
|
|
151
|
+
selector: aliasDynamicImportSelector,
|
|
152
|
+
message: aliasDynamicImportMessage,
|
|
153
|
+
},
|
|
127
154
|
],
|
|
128
155
|
},
|
|
129
156
|
},
|
package/src/next/naming.mjs
CHANGED
|
@@ -46,7 +46,9 @@ export const namingConfigs = [
|
|
|
46
46
|
{
|
|
47
47
|
name: "naming/components-pascal-case",
|
|
48
48
|
files: ["src/components/**/*.tsx"],
|
|
49
|
-
|
|
49
|
+
// index.tsx は directory entry の慣例として PASCAL_CASE 強制から外す。
|
|
50
|
+
// 例: components/shared/layouts/Header/index.tsx
|
|
51
|
+
ignores: ["src/components/shared/ui/**", "src/components/**/index.tsx"],
|
|
50
52
|
plugins: { "check-file": checkFile },
|
|
51
53
|
rules: {
|
|
52
54
|
"check-file/filename-naming-convention": [
|