@yasainet/eslint 0.0.56 → 0.0.57

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.56",
3
+ "version": "0.0.57",
4
4
  "description": "ESLint",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,35 +1,35 @@
1
1
  const LAYER_PATTERNS = {
2
2
  queries: [
3
3
  {
4
- group: ["*/services/*", "*/services"],
4
+ group: ["**/services/*", "**/services"],
5
5
  message: "queries cannot import services (layer violation)",
6
6
  },
7
7
  {
8
- group: ["*/interactors/*", "*/interactors"],
8
+ group: ["**/interactors/*", "**/interactors"],
9
9
  message: "queries cannot import interactors (layer violation)",
10
10
  },
11
11
  {
12
- group: ["*/hooks/*", "*/hooks"],
12
+ group: ["**/hooks/*", "**/hooks"],
13
13
  message: "queries cannot import hooks (layer violation)",
14
14
  },
15
15
  ],
16
16
  services: [
17
17
  {
18
- group: ["*/interactors/*", "*/interactors"],
18
+ group: ["**/interactors/*", "**/interactors"],
19
19
  message: "services cannot import interactors (layer violation)",
20
20
  },
21
21
  {
22
- group: ["*/hooks/*", "*/hooks"],
22
+ group: ["**/hooks/*", "**/hooks"],
23
23
  message: "services cannot import hooks (layer violation)",
24
24
  },
25
25
  ],
26
26
  interactors: [
27
27
  {
28
- group: ["*/queries/*", "*/queries"],
28
+ group: ["**/queries/*", "**/queries"],
29
29
  message: "interactors cannot import queries (layer violation)",
30
30
  },
31
31
  {
32
- group: ["*/hooks/*", "*/hooks"],
32
+ group: ["**/hooks/*", "**/hooks"],
33
33
  message: "interactors cannot import hooks (layer violation)",
34
34
  },
35
35
  ],
@@ -113,25 +113,38 @@ const MAPPING_PATTERNS = [
113
113
 
114
114
  const PAGE_BOUNDARY_PATTERNS = [
115
115
  {
116
- group: ["*/queries/*", "*/queries"],
116
+ group: ["**/queries/*", "**/queries"],
117
117
  message:
118
118
  "page.tsx can only import interactors, not queries (page-boundary violation)",
119
119
  },
120
120
  {
121
- group: ["*/services/*", "*/services"],
121
+ group: ["**/services/*", "**/services"],
122
122
  message:
123
123
  "page.tsx can only import interactors, not services (page-boundary violation)",
124
124
  },
125
125
  ];
126
126
 
127
+ const ROUTE_BOUNDARY_PATTERNS = [
128
+ {
129
+ group: ["**/queries/*", "**/queries"],
130
+ message:
131
+ "route.ts can only import interactors, not queries (route-boundary violation)",
132
+ },
133
+ {
134
+ group: ["**/services/*", "**/services"],
135
+ message:
136
+ "route.ts can only import interactors, not services (route-boundary violation)",
137
+ },
138
+ ];
139
+
127
140
  const HOOKS_BOUNDARY_PATTERNS = [
128
141
  {
129
- group: ["*/queries/*", "*/queries"],
142
+ group: ["**/queries/*", "**/queries"],
130
143
  message:
131
144
  "hooks can only import interactors, not queries (hooks-boundary violation)",
132
145
  },
133
146
  {
134
- group: ["*/services/*", "*/services"],
147
+ group: ["**/services/*", "**/services"],
135
148
  message:
136
149
  "hooks can only import interactors, not services (hooks-boundary violation)",
137
150
  },
@@ -139,12 +152,12 @@ const HOOKS_BOUNDARY_PATTERNS = [
139
152
 
140
153
  const COMPONENTS_BOUNDARY_PATTERNS = [
141
154
  {
142
- group: ["*/queries/*", "*/queries"],
155
+ group: ["**/queries/*", "**/queries"],
143
156
  message:
144
157
  "components can only import interactors or hooks, not queries (components-boundary violation)",
145
158
  },
146
159
  {
147
- group: ["*/services/*", "*/services"],
160
+ group: ["**/services/*", "**/services"],
148
161
  message:
149
162
  "components can only import interactors or hooks, not services (components-boundary violation)",
150
163
  },
@@ -187,6 +200,26 @@ export const pageBoundaryConfigs = [
187
200
  },
188
201
  ];
189
202
 
203
+ /** Next.js-only: restrict route.ts to only import interactors. */
204
+ export const routeBoundaryConfigs = [
205
+ {
206
+ name: "imports/route-boundary",
207
+ files: ["src/app/**/route.ts"],
208
+ rules: {
209
+ "no-restricted-imports": [
210
+ "error",
211
+ {
212
+ patterns: [
213
+ ...ROUTE_BOUNDARY_PATTERNS,
214
+ ...LIB_BOUNDARY_PATTERNS,
215
+ ...MAPPING_PATTERNS,
216
+ ],
217
+ },
218
+ ],
219
+ },
220
+ },
221
+ ];
222
+
190
223
  /** Next.js-only: restrict hooks to only import interactors (not queries or services). */
191
224
  export const hooksBoundaryConfigs = [
192
225
  {
@@ -5,6 +5,7 @@ import {
5
5
  hooksBoundaryConfigs,
6
6
  libBoundaryConfigs,
7
7
  pageBoundaryConfigs,
8
+ routeBoundaryConfigs,
8
9
  } from "../common/imports.mjs";
9
10
 
10
11
  import { directivesConfigs } from "./directives.mjs";
@@ -26,6 +27,7 @@ export const eslintConfig = [
26
27
  ...createCommonConfigs("src/features"),
27
28
  ...libBoundaryConfigs,
28
29
  ...pageBoundaryConfigs,
30
+ ...routeBoundaryConfigs,
29
31
  ...hooksBoundaryConfigs,
30
32
  ...componentsBoundaryConfigs,
31
33
  ...namingConfigs,