@yasainet/eslint 0.0.44 → 0.0.46

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yasainet/eslint",
3
- "version": "0.0.44",
3
+ "version": "0.0.46",
4
4
  "description": "ESLint",
5
5
  "type": "module",
6
6
  "exports": {
@@ -18,7 +18,7 @@ export function createLayersConfigs(featureRoot) {
18
18
  ],
19
19
  },
20
20
  },
21
- // Repositories: try-catch + if + logger
21
+ // Repositories: try-catch + if + loops + logger
22
22
  {
23
23
  name: "layers/repositories",
24
24
  files: [`${featureRoot}/**/repositories/*.ts`],
@@ -35,6 +35,31 @@ export function createLayersConfigs(featureRoot) {
35
35
  message:
36
36
  "if statements are not allowed in repositories. Conditional logic belongs in services.",
37
37
  },
38
+ {
39
+ selector: "ForStatement",
40
+ message:
41
+ "Loops are not allowed in repositories. Repositories should be thin CRUD wrappers — iteration belongs in services.",
42
+ },
43
+ {
44
+ selector: "ForOfStatement",
45
+ message:
46
+ "Loops are not allowed in repositories. Repositories should be thin CRUD wrappers — iteration belongs in services.",
47
+ },
48
+ {
49
+ selector: "ForInStatement",
50
+ message:
51
+ "Loops are not allowed in repositories. Repositories should be thin CRUD wrappers — iteration belongs in services.",
52
+ },
53
+ {
54
+ selector: "WhileStatement",
55
+ message:
56
+ "Loops are not allowed in repositories. Repositories should be thin CRUD wrappers — iteration belongs in services.",
57
+ },
58
+ {
59
+ selector: "DoWhileStatement",
60
+ message:
61
+ "Loops are not allowed in repositories. Repositories should be thin CRUD wrappers — iteration belongs in services.",
62
+ },
38
63
  { selector: loggerSelector, message: loggerMessage },
39
64
  ],
40
65
  },
@@ -107,10 +107,21 @@ export const featureNameRule = {
107
107
  if (!featureName) return {};
108
108
 
109
109
  const projectRoot = filename.slice(0, rootIdx).replace(/\/src$/, "");
110
- const supabaseTypePath = path.join(
110
+ // Prefer the Supabase types file adjacent to `featureRoot` (e.g. `src/lib/...`
111
+ // for `src/features`). Fall back to `src/lib/...` at the project root so that
112
+ // non-`src` feature roots (e.g. `scripts/features`) can reuse the same
113
+ // generated types without duplicating the file.
114
+ const computedTypePath = path.join(
111
115
  projectRoot,
112
116
  featureRoot.replace(/features$/, "lib/supabase/supabase.type.ts"),
113
117
  );
118
+ const fallbackTypePath = path.join(
119
+ projectRoot,
120
+ "src/lib/supabase/supabase.type.ts",
121
+ );
122
+ const supabaseTypePath = fs.existsSync(computedTypePath)
123
+ ? computedTypePath
124
+ : fallbackTypePath;
114
125
 
115
126
  const tableNames = extractTableNames(supabaseTypePath);
116
127
  const allowedNames = ["shared", "auth", ...tableNames.map(toKebab)];