@yasainet/eslint 0.0.73 → 0.0.74

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.
Files changed (69) hide show
  1. package/README.md +17 -60
  2. package/package.json +1 -1
  3. package/src/common/{constants.mjs → _internal/constants.mjs} +0 -18
  4. package/src/common/_internal/import-patterns.mjs +16 -0
  5. package/src/common/{plugins.mjs → _internal/plugins.mjs} +0 -1
  6. package/src/common/_internal/selectors.mjs +10 -0
  7. package/src/common/{rules.mjs → base/typescript.mjs} +2 -29
  8. package/src/common/{entry-points.mjs → boundaries/entry-point.mjs} +0 -1
  9. package/src/common/cross-cutting/ban-alias.mjs +22 -0
  10. package/src/common/cross-cutting/feature-default-imports.mjs +26 -0
  11. package/src/common/cross-cutting/feature-name.mjs +15 -0
  12. package/src/common/cross-cutting/features-ts-only.mjs +20 -0
  13. package/src/common/cross-cutting/form-state.mjs +16 -0
  14. package/src/common/{jsdoc.mjs → cross-cutting/jsdoc.mjs} +2 -3
  15. package/src/common/cross-cutting/logger.mjs +21 -0
  16. package/src/common/cross-cutting/namespace-import.mjs +23 -0
  17. package/src/common/cross-cutting/no-any-return.mjs +18 -0
  18. package/src/common/cross-cutting/supabase-columns-satisfies.mjs +18 -0
  19. package/src/common/index.mjs +42 -24
  20. package/src/common/layers/constants.mjs +36 -0
  21. package/src/common/layers/entries.mjs +168 -0
  22. package/src/common/layers/lib.mjs +18 -0
  23. package/src/common/layers/queries.mjs +183 -0
  24. package/src/common/layers/schemas.mjs +45 -0
  25. package/src/common/layers/services.mjs +115 -0
  26. package/src/common/layers/top-level-utils.mjs +18 -0
  27. package/src/common/layers/types.mjs +44 -0
  28. package/src/common/layers/utils.mjs +50 -0
  29. package/src/common/local-plugins/entry-single-service-call.mjs +0 -30
  30. package/src/common/local-plugins/entry-template.mjs +33 -72
  31. package/src/common/local-plugins/feature-name.mjs +8 -22
  32. package/src/common/local-plugins/form-state-naming.mjs +0 -10
  33. package/src/common/local-plugins/form-state-shape.mjs +0 -34
  34. package/src/common/local-plugins/import-path-style.mjs +0 -7
  35. package/src/common/local-plugins/index.mjs +0 -1
  36. package/src/common/local-plugins/layout-main-structural-only.mjs +0 -21
  37. package/src/common/local-plugins/namespace-import-name.mjs +0 -26
  38. package/src/common/local-plugins/no-any-return.mjs +0 -8
  39. package/src/common/local-plugins/queries-export.mjs +0 -8
  40. package/src/common/local-plugins/queries-namespace-import.mjs +0 -10
  41. package/src/common/local-plugins/schema-naming.mjs +0 -6
  42. package/src/common/local-plugins/supabase-columns-satisfies.mjs +0 -24
  43. package/src/common/local-plugins/supabase-select-typed-columns.mjs +0 -32
  44. package/src/deno/boundaries/entry-point.mjs +44 -0
  45. package/src/deno/boundaries/lib.mjs +28 -0
  46. package/src/deno/boundaries/utils.mjs +25 -0
  47. package/src/deno/index.mjs +9 -13
  48. package/src/deno/local-plugins/flat-entry-point.mjs +0 -5
  49. package/src/deno/local-plugins/index.mjs +0 -1
  50. package/src/next/boundaries/components.mjs +36 -0
  51. package/src/next/boundaries/hooks.mjs +36 -0
  52. package/src/next/boundaries/lib.mjs +23 -0
  53. package/src/next/boundaries/page.mjs +36 -0
  54. package/src/next/boundaries/route.mjs +36 -0
  55. package/src/next/boundaries/sitemap.mjs +36 -0
  56. package/src/next/directives.mjs +0 -1
  57. package/src/next/imports.mjs +0 -1
  58. package/src/next/index.mjs +12 -15
  59. package/src/next/layers/components.mjs +30 -0
  60. package/src/next/layers/hooks.mjs +31 -0
  61. package/src/next/layers/layouts.mjs +12 -0
  62. package/src/next/tailwindcss.mjs +0 -21
  63. package/src/node/index.mjs +1 -2
  64. package/src/common/imports.mjs +0 -457
  65. package/src/common/layers.mjs +0 -158
  66. package/src/common/naming.mjs +0 -347
  67. package/src/deno/imports.mjs +0 -90
  68. package/src/next/layouts.mjs +0 -18
  69. package/src/next/naming.mjs +0 -60
@@ -1,347 +0,0 @@
1
- import { featuresGlob } from "./constants.mjs";
2
- import { localPlugin } from "./local-plugins/index.mjs";
3
- import { checkFile } from "./plugins.mjs";
4
-
5
- /**
6
- * Scope lib naming rules to the lib root derived from the given feature root:
7
- *
8
- * - basename は suffix なしの単一トークン (`*` パターン) を強制する
9
- * - 多重拡張子 (`<name>.lib.ts` / `<name>.parser.ts` 等) は禁止 → 役割はディレクトリで宣言する
10
- * - types.ts は対象外 (型のみで lib の役割を持たないため check 不要)
11
- */
12
- export function createLibNamingConfigs(featureRoot) {
13
- const libRoot = featureRoot.replace(/features$/, "lib");
14
- return [
15
- {
16
- name: "naming/lib",
17
- files: [`${libRoot}/**/*.ts`],
18
- plugins: { "check-file": checkFile },
19
- rules: {
20
- "check-file/filename-naming-convention": [
21
- "error",
22
- { "**/*.ts": "*" },
23
- ],
24
- },
25
- },
26
- ];
27
- }
28
-
29
- /**
30
- * Scope utils naming rules to the utils root derived from the given feature root:
31
- *
32
- * - basename は suffix なしの単一トークン (`*` パターン) を強制する
33
- * - 多重拡張子は禁止
34
- */
35
- export function createUtilsNamingConfigs(featureRoot) {
36
- const utilsRoot = featureRoot.replace(/features$/, "utils");
37
- return [
38
- {
39
- name: "naming/top-level-utils",
40
- files: [`${utilsRoot}/**/*.ts`],
41
- plugins: { "check-file": checkFile },
42
- rules: {
43
- "check-file/filename-naming-convention": [
44
- "error",
45
- { "**/*.ts": "*" },
46
- ],
47
- },
48
- },
49
- ];
50
- }
51
-
52
- /**
53
- * Scope naming rules to the given feature root:
54
- *
55
- * - 全 layer (services / queries / entries / utils / types / schemas / constants) で suffix を廃止
56
- * - ファイル名 (basename) は単一トークン (`*` パターン) を強制し、role はディレクトリで宣言する
57
- * - queries / services / entries のファイル名は prefixLibMapping のキー (lib name) と一致させ、どの lib を呼ぶか明示する
58
- * - shared/ 配下では feature 名でなく `shared` または lib name を allowed prefix として許可する
59
- */
60
- export function createNamingConfigs(featureRoot, prefixLibMapping) {
61
- const prefixes = Object.keys(prefixLibMapping);
62
- const hasPrefixes = prefixes.length > 0;
63
- const prefixPattern = hasPrefixes ? `@(${prefixes.join("|")})` : "*";
64
- const sharedPrefixPattern = hasPrefixes
65
- ? `@(shared|${prefixes.join("|")})`
66
- : "shared";
67
-
68
- const configs = [];
69
-
70
- configs.push({
71
- name: "naming/feature-name",
72
- files: featuresGlob(featureRoot, "**/*.ts"),
73
- plugins: { local: localPlugin },
74
- rules: {
75
- "local/feature-name": ["error", { featureRoot }],
76
- },
77
- });
78
-
79
- configs.push({
80
- name: "naming/namespace-import-name",
81
- files: featuresGlob(featureRoot, "**/*.ts"),
82
- plugins: { local: localPlugin },
83
- rules: {
84
- "local/namespace-import-name": ["error", { featureRoot }],
85
- },
86
- });
87
-
88
- configs.push(
89
- {
90
- name: "naming/services",
91
- files: featuresGlob(featureRoot, "**/services/*.ts"),
92
- ignores: featuresGlob(featureRoot, "shared/services/*.ts"),
93
- plugins: { "check-file": checkFile },
94
- rules: {
95
- "check-file/filename-naming-convention": [
96
- "error",
97
- { "**/*.ts": prefixPattern },
98
- ],
99
- },
100
- },
101
- {
102
- name: "naming/queries",
103
- files: featuresGlob(featureRoot, "**/queries/*.ts"),
104
- ignores: featuresGlob(featureRoot, "shared/queries/*.ts"),
105
- plugins: { "check-file": checkFile },
106
- rules: {
107
- "check-file/filename-naming-convention": [
108
- "error",
109
- { "**/*.ts": prefixPattern },
110
- ],
111
- },
112
- },
113
- {
114
- name: "naming/queries-export",
115
- files: featuresGlob(featureRoot, "**/queries/*.ts"),
116
- plugins: { local: localPlugin },
117
- rules: {
118
- "local/queries-export": "error",
119
- },
120
- },
121
- {
122
- name: "naming/queries-namespace-import",
123
- files: featuresGlob(featureRoot, "**/*.ts"),
124
- plugins: { local: localPlugin },
125
- rules: {
126
- "local/queries-namespace-import": "error",
127
- },
128
- },
129
- {
130
- name: "naming/supabase-select",
131
- files: featuresGlob(featureRoot, "**/queries/*.ts"),
132
- plugins: { local: localPlugin },
133
- rules: {
134
- "local/supabase-select-typed-columns": "error",
135
- },
136
- },
137
- {
138
- name: "naming/supabase-columns-satisfies",
139
- files: [
140
- ...featuresGlob(featureRoot, "**/queries/*.ts"),
141
- ...featuresGlob(featureRoot, "**/constants/*.ts"),
142
- ],
143
- plugins: { local: localPlugin },
144
- rules: {
145
- "local/supabase-columns-satisfies": "error",
146
- },
147
- },
148
- {
149
- name: "naming/form-state",
150
- files: featuresGlob(featureRoot, "**/*.ts"),
151
- plugins: { local: localPlugin },
152
- rules: {
153
- "local/form-state-naming": "error",
154
- "local/form-state-shape": "error",
155
- },
156
- },
157
- );
158
-
159
- configs.push(
160
- {
161
- name: "naming/services-shared",
162
- files: featuresGlob(featureRoot, "shared/services/*.ts"),
163
- plugins: { "check-file": checkFile },
164
- rules: {
165
- "check-file/filename-naming-convention": [
166
- "error",
167
- { "**/*.ts": sharedPrefixPattern },
168
- ],
169
- },
170
- },
171
- {
172
- name: "naming/queries-shared",
173
- files: featuresGlob(featureRoot, "shared/queries/*.ts"),
174
- plugins: { "check-file": checkFile },
175
- rules: {
176
- "check-file/filename-naming-convention": [
177
- "error",
178
- { "**/*.ts": sharedPrefixPattern },
179
- ],
180
- },
181
- },
182
- );
183
-
184
- configs.push(
185
- {
186
- name: "naming/types",
187
- files: featuresGlob(featureRoot, "*/types/*.ts"),
188
- ignores: featuresGlob(featureRoot, "shared/types/*.ts"),
189
- plugins: { "check-file": checkFile },
190
- rules: {
191
- "check-file/filename-naming-convention": [
192
- "error",
193
- { "**/*/types/*.ts": "<1>" },
194
- ],
195
- },
196
- },
197
- {
198
- name: "naming/types-shared",
199
- files: featuresGlob(featureRoot, "shared/types/*.ts"),
200
- plugins: { "check-file": checkFile },
201
- rules: {
202
- "check-file/filename-naming-convention": [
203
- "error",
204
- { "**/*.ts": sharedPrefixPattern },
205
- ],
206
- },
207
- },
208
- {
209
- name: "naming/schemas",
210
- files: featuresGlob(featureRoot, "*/schemas/*.ts"),
211
- ignores: featuresGlob(featureRoot, "shared/schemas/*.ts"),
212
- plugins: { "check-file": checkFile },
213
- rules: {
214
- "check-file/filename-naming-convention": [
215
- "error",
216
- { "**/*/schemas/*.ts": "<1>" },
217
- ],
218
- },
219
- },
220
- {
221
- name: "naming/schema-naming",
222
- files: featuresGlob(featureRoot, "**/schemas/*.ts"),
223
- plugins: { local: localPlugin },
224
- rules: {
225
- "local/schema-naming": "error",
226
- },
227
- },
228
- {
229
- name: "naming/schemas-shared",
230
- files: featuresGlob(featureRoot, "shared/schemas/*.ts"),
231
- plugins: { "check-file": checkFile },
232
- rules: {
233
- "check-file/filename-naming-convention": [
234
- "error",
235
- { "**/*.ts": sharedPrefixPattern },
236
- ],
237
- },
238
- },
239
- {
240
- name: "naming/utils",
241
- files: featuresGlob(featureRoot, "*/utils/*.ts"),
242
- ignores: featuresGlob(featureRoot, "shared/utils/*.ts"),
243
- plugins: { "check-file": checkFile },
244
- rules: {
245
- "check-file/filename-naming-convention": [
246
- "error",
247
- { "**/*/utils/*.ts": "<1>" },
248
- ],
249
- },
250
- },
251
- {
252
- name: "naming/utils-shared",
253
- files: featuresGlob(featureRoot, "shared/utils/*.ts"),
254
- plugins: { "check-file": checkFile },
255
- rules: {
256
- "check-file/filename-naming-convention": [
257
- "error",
258
- { "**/*.ts": sharedPrefixPattern },
259
- ],
260
- },
261
- },
262
- {
263
- name: "naming/constants",
264
- files: featuresGlob(featureRoot, "*/constants/*.ts"),
265
- ignores: featuresGlob(featureRoot, "shared/constants/*.ts"),
266
- plugins: { "check-file": checkFile },
267
- rules: {
268
- "check-file/filename-naming-convention": [
269
- "error",
270
- { "**/*/constants/*.ts": "<1>" },
271
- ],
272
- },
273
- },
274
- {
275
- name: "naming/constants-shared",
276
- files: featuresGlob(featureRoot, "shared/constants/*.ts"),
277
- plugins: { "check-file": checkFile },
278
- rules: {
279
- "check-file/filename-naming-convention": [
280
- "error",
281
- { "**/*.ts": sharedPrefixPattern },
282
- ],
283
- },
284
- },
285
- );
286
-
287
- configs.push({
288
- name: "naming/entries",
289
- files: featuresGlob(featureRoot, "**/entries/*.ts"),
290
- ignores: featuresGlob(featureRoot, "shared/entries/*.ts"),
291
- plugins: { "check-file": checkFile },
292
- rules: {
293
- "check-file/filename-naming-convention": [
294
- "error",
295
- { "**/*.ts": prefixPattern },
296
- ],
297
- },
298
- });
299
-
300
- configs.push({
301
- name: "naming/entry-template",
302
- files: featuresGlob(featureRoot, "**/entries/*.ts"),
303
- plugins: { local: localPlugin },
304
- rules: {
305
- "local/entry-template": "error",
306
- },
307
- });
308
-
309
- configs.push({
310
- name: "naming/entry-single-service-call",
311
- files: featuresGlob(featureRoot, "**/entries/*.ts"),
312
- plugins: { local: localPlugin },
313
- rules: {
314
- "local/entry-single-service-call": "error",
315
- },
316
- });
317
-
318
- configs.push(
319
- {
320
- name: "naming/entries-shared",
321
- files: featuresGlob(featureRoot, "shared/entries/*.ts"),
322
- plugins: { "check-file": checkFile },
323
- rules: {
324
- "check-file/filename-naming-convention": [
325
- "error",
326
- { "**/*.ts": sharedPrefixPattern },
327
- ],
328
- },
329
- },
330
- {
331
- name: "naming/features-ts-only",
332
- files: featuresGlob(featureRoot, "**/*.tsx"),
333
- rules: {
334
- "no-restricted-syntax": [
335
- "error",
336
- {
337
- selector: "Program",
338
- message:
339
- "features/ must only contain .ts files. Components belong in src/components/.",
340
- },
341
- ],
342
- },
343
- },
344
- );
345
-
346
- return configs;
347
- }
@@ -1,90 +0,0 @@
1
- import { denoLocalPlugin } from "./local-plugins/index.mjs";
2
-
3
- const FUNCTIONS_ROOT = "supabase/functions";
4
- const FEATURE_ROOT = "supabase/functions/_features";
5
-
6
- /** Deno-specific import restriction rules. */
7
- export const denoImportsConfigs = [
8
- {
9
- name: "deno/lib-boundary",
10
- files: [`${FUNCTIONS_ROOT}/**/*.ts`],
11
- ignores: [
12
- `${FUNCTIONS_ROOT}/_lib/**`,
13
- `${FEATURE_ROOT}/**/queries/**`,
14
- `${FEATURE_ROOT}/**/types/**`,
15
- ],
16
- rules: {
17
- "no-restricted-imports": [
18
- "error",
19
- {
20
- patterns: [
21
- {
22
- group: ["*/_lib/*", "*/_lib/**"],
23
- message:
24
- "_lib/ can only be imported from queries (lib-boundary violation)",
25
- },
26
- ],
27
- },
28
- ],
29
- },
30
- },
31
- {
32
- name: "deno/entry-point",
33
- files: [`${FUNCTIONS_ROOT}/**/*.ts`],
34
- ignores: [`${FUNCTIONS_ROOT}/_*/**`],
35
- rules: {
36
- "no-restricted-imports": [
37
- "error",
38
- {
39
- patterns: [
40
- {
41
- group: ["**/services/*", "**/services"],
42
- message:
43
- "Top-level files must not import services directly. Import from entries instead.",
44
- },
45
- {
46
- group: ["**/queries/*", "**/queries"],
47
- message:
48
- "Top-level files must not import queries directly. Import from entries instead.",
49
- },
50
- {
51
- group: ["*/_lib/*", "*/_lib/**"],
52
- message:
53
- "Top-level files must not import _lib/ directly. Import from entries instead.",
54
- },
55
- ],
56
- },
57
- ],
58
- },
59
- },
60
- {
61
- name: "deno/utils-boundary",
62
- files: [`${FUNCTIONS_ROOT}/_utils/**/*.ts`],
63
- rules: {
64
- "no-restricted-imports": [
65
- "error",
66
- {
67
- patterns: [
68
- {
69
- group: ["*/_features/*", "*/_features/**"],
70
- message: "_utils/ cannot import _features/",
71
- },
72
- {
73
- group: ["*/_lib/*", "*/_lib/**"],
74
- message: "_utils/ cannot import _lib/",
75
- },
76
- ],
77
- },
78
- ],
79
- },
80
- },
81
- {
82
- name: "deno/flat-entry-point",
83
- files: [`${FUNCTIONS_ROOT}/**/*.ts`],
84
- ignores: [`${FUNCTIONS_ROOT}/_*/**`],
85
- plugins: { "deno-local": denoLocalPlugin },
86
- rules: {
87
- "deno-local/flat-entry-point": "error",
88
- },
89
- },
90
- ];
@@ -1,18 +0,0 @@
1
- import { localPlugin } from "../common/local-plugins/index.mjs";
2
-
3
- /**
4
- * Enforce design rules on Next.js layout files.
5
- *
6
- * - `<main>` is a structural slot, not a styling surface. Spacing and
7
- * decoration belong in page.tsx (e.g. `<Container className="py-8">`).
8
- */
9
- export const layoutsConfigs = [
10
- {
11
- name: "layouts/main-structural-only",
12
- files: ["src/app/**/layout.tsx"],
13
- plugins: { local: localPlugin },
14
- rules: {
15
- "local/layout-main-structural-only": "error",
16
- },
17
- },
18
- ];
@@ -1,60 +0,0 @@
1
- import { checkFile } from "../common/plugins.mjs";
2
-
3
- /** Next.js-specific naming convention configs for hooks and components. */
4
- export const namingConfigs = [
5
- {
6
- name: "naming/hooks",
7
- files: ["src/features/**/hooks/*.ts"],
8
- plugins: { "check-file": checkFile },
9
- rules: {
10
- "check-file/filename-naming-convention": [
11
- "error",
12
- { "**/*.ts": "use-+([a-z0-9])*(-+([a-z0-9]))" },
13
- { ignoreMiddleExtensions: true },
14
- ],
15
- },
16
- },
17
- {
18
- name: "naming/hooks-export",
19
- files: ["src/features/**/hooks/*.ts"],
20
- rules: {
21
- "no-restricted-syntax": [
22
- "error",
23
- {
24
- selector:
25
- "ExportNamedDeclaration > FunctionDeclaration[id.name!=/^use[A-Z]/]",
26
- message:
27
- "Exported functions in hooks must start with 'use' (e.g., useAuth).",
28
- },
29
- ],
30
- },
31
- },
32
- {
33
- name: "naming/components-tsx-only",
34
- files: ["src/components/**/*.ts"],
35
- rules: {
36
- "no-restricted-syntax": [
37
- "error",
38
- {
39
- selector: "Program",
40
- message:
41
- "components/ must only contain .tsx files. Logic belongs in src/features/.",
42
- },
43
- ],
44
- },
45
- },
46
- {
47
- name: "naming/components-pascal-case",
48
- files: ["src/components/**/*.tsx"],
49
- // index.tsx は directory entry の慣例として PASCAL_CASE 強制から外す。
50
- // 例: components/shared/layouts/Header/index.tsx
51
- ignores: ["src/components/shared/ui/**", "src/components/**/index.tsx"],
52
- plugins: { "check-file": checkFile },
53
- rules: {
54
- "check-file/filename-naming-convention": [
55
- "error",
56
- { "**/*.tsx": "PASCAL_CASE" },
57
- ],
58
- },
59
- },
60
- ];