@yasainet/eslint 0.0.61 → 0.0.62
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
package/src/common/constants.mjs
CHANGED
|
@@ -23,10 +23,10 @@ const PROJECT_ROOT = findProjectRoot();
|
|
|
23
23
|
/**
|
|
24
24
|
* Files / basenames that should never become a prefix:
|
|
25
25
|
*
|
|
26
|
-
* - `types.ts`: 型定義のみで lib の役割を持たない
|
|
26
|
+
* - `types.ts` / `type.ts`: 型定義のみで lib の役割を持たない (単複どちらの命名でも除外)
|
|
27
27
|
* - `proxy.ts`: middleware adapter (Next.js の proxy.ts と意味が衝突するため queries から呼ばせない)
|
|
28
28
|
*/
|
|
29
|
-
const EXCLUDE_LIST = ["types.ts", "proxy.ts"];
|
|
29
|
+
const EXCLUDE_LIST = ["types.ts", "type.ts", "proxy.ts"];
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* Scan lib directory and build prefix-to-lib-relative-path mapping:
|
|
@@ -34,7 +34,7 @@ const EXCLUDE_LIST = ["types.ts", "proxy.ts"];
|
|
|
34
34
|
* - single-client lib (`lib/<dir>/index.ts`): prefix = dir 名、entry のみ登録 — 同 dir 内の他ファイル (parser 等 sub-module) は自動除外
|
|
35
35
|
* - multi-client lib (index.ts なし): dir 内の全 `<role>.ts` を登録 (e.g., supabase の admin / server / client)
|
|
36
36
|
* - 多重拡張子 (`.test.ts` 等) を持つファイルは sub-module / 非 lib として除外
|
|
37
|
-
* - types.ts / proxy.ts のような lib として queries から呼ばせたくないものは EXCLUDE_LIST で除外
|
|
37
|
+
* - types.ts / type.ts / proxy.ts のような lib として queries から呼ばせたくないものは EXCLUDE_LIST で除外
|
|
38
38
|
*/
|
|
39
39
|
export function generatePrefixLibMapping(featureRoot) {
|
|
40
40
|
const libRoot = featureRoot.replace(/features$/, "lib");
|
|
@@ -110,18 +110,16 @@ export const featureNameRule = {
|
|
|
110
110
|
// Prefer the Supabase types file adjacent to `featureRoot` (e.g. `src/lib/...`
|
|
111
111
|
// for `src/features`). Fall back to `src/lib/...` at the project root so that
|
|
112
112
|
// non-`src` feature roots (e.g. `scripts/features`) can reuse the same
|
|
113
|
-
// generated types without duplicating the file.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
featureRoot.replace(/features$/, "lib/supabase/types.ts"),
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
projectRoot,
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
? computedTypePath
|
|
124
|
-
: fallbackTypePath;
|
|
113
|
+
// generated types without duplicating the file. Both `types.ts` (plural) and
|
|
114
|
+
// `type.ts` (singular) are accepted to match either naming convention.
|
|
115
|
+
const candidateTypePaths = [
|
|
116
|
+
path.join(projectRoot, featureRoot.replace(/features$/, "lib/supabase/types.ts")),
|
|
117
|
+
path.join(projectRoot, featureRoot.replace(/features$/, "lib/supabase/type.ts")),
|
|
118
|
+
path.join(projectRoot, "src/lib/supabase/types.ts"),
|
|
119
|
+
path.join(projectRoot, "src/lib/supabase/type.ts"),
|
|
120
|
+
];
|
|
121
|
+
const supabaseTypePath =
|
|
122
|
+
candidateTypePaths.find((p) => fs.existsSync(p)) ?? candidateTypePaths[0];
|
|
125
123
|
|
|
126
124
|
const tableNames = extractTableNames(supabaseTypePath);
|
|
127
125
|
const allowedNames = ["shared", "auth", ...tableNames.map(toKebab)];
|