@cbrl/eslint-config 0.2.1 → 0.3.0
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/configs/layering.mjs +21 -12
- package/package.json +5 -3
package/configs/layering.mjs
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
// A component may call an adapter; an adapter may call core; never the
|
|
13
13
|
// reverse. core importing an adapter (or ui) is the classic leak that makes
|
|
14
14
|
// the "pure" core impure by transitivity. Enforced with eslint-plugin-
|
|
15
|
-
// boundaries'
|
|
15
|
+
// boundaries' `dependencies` policies.
|
|
16
16
|
//
|
|
17
17
|
// Scoped entirely to the `features/<slice>/<ring>/` convention — an app that
|
|
18
18
|
// hasn't adopted feature slices has no matching files, so this layer is a no-op
|
|
@@ -177,34 +177,43 @@ export const layering = [
|
|
|
177
177
|
},
|
|
178
178
|
},
|
|
179
179
|
// ── Wall 2: ring direction ─────────────────────────────────────────────
|
|
180
|
+
// Element descriptors match the ring folder anywhere in the path (partial
|
|
181
|
+
// match is the default), so `src/features/…` and `apps/web/src/features/…`
|
|
182
|
+
// both classify. The node resolver needs the TS extensions to resolve
|
|
183
|
+
// extensionless relative imports; without them every target is unknown and
|
|
184
|
+
// the wall never fires. Path aliases (`@/features/…`) are not resolved here:
|
|
185
|
+
// wall 1 covers them for core/ through `no-restricted-imports`.
|
|
180
186
|
{
|
|
181
187
|
files: [GLOB_SRC],
|
|
182
188
|
plugins: { boundaries },
|
|
183
189
|
settings: {
|
|
184
190
|
'boundaries/include': ['**/features/**'],
|
|
185
191
|
'boundaries/elements': [
|
|
186
|
-
{ type: 'feat-core', pattern: 'features/*/core
|
|
187
|
-
{ type: 'feat-adapters', pattern: 'features/*/adapters
|
|
188
|
-
{ type: 'feat-ui', pattern: 'features/*/ui
|
|
192
|
+
{ type: 'feat-core', pattern: 'features/*/core', capture: ['slice'] },
|
|
193
|
+
{ type: 'feat-adapters', pattern: 'features/*/adapters', capture: ['slice'] },
|
|
194
|
+
{ type: 'feat-ui', pattern: 'features/*/ui', capture: ['slice'] },
|
|
189
195
|
],
|
|
196
|
+
'import/resolver': {
|
|
197
|
+
node: { extensions: ['.ts', '.tsx', '.mts', '.cts', '.js', '.mjs', '.cjs', '.jsx'] },
|
|
198
|
+
},
|
|
190
199
|
},
|
|
191
200
|
rules: {
|
|
192
|
-
'boundaries/
|
|
201
|
+
'boundaries/dependencies': [
|
|
193
202
|
'error',
|
|
194
203
|
{
|
|
195
204
|
default: 'allow',
|
|
196
|
-
|
|
205
|
+
policies: [
|
|
197
206
|
{
|
|
198
|
-
from:
|
|
199
|
-
disallow: ['feat-adapters', 'feat-ui'],
|
|
207
|
+
from: { element: { type: 'feat-core' } },
|
|
208
|
+
disallow: { to: { element: { type: ['feat-adapters', 'feat-ui'] } } },
|
|
200
209
|
message:
|
|
201
|
-
'core ({{from}}) must not import {{
|
|
210
|
+
'core ({{from.element.captured.slice}}) must not import {{to.element.type}}: dependencies only point down (ui→adapters→core).',
|
|
202
211
|
},
|
|
203
212
|
{
|
|
204
|
-
from:
|
|
205
|
-
disallow:
|
|
213
|
+
from: { element: { type: 'feat-adapters' } },
|
|
214
|
+
disallow: { to: { element: { type: 'feat-ui' } } },
|
|
206
215
|
message:
|
|
207
|
-
'adapters ({{from}}) must not import ui: the flow is ui→adapters, never the reverse.',
|
|
216
|
+
'adapters ({{from.element.captured.slice}}) must not import ui: the flow is ui→adapters, never the reverse.',
|
|
208
217
|
},
|
|
209
218
|
],
|
|
210
219
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cbrl/eslint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Strict ESLint flat config for TypeScript, React and Next.js apps, with custom fail-fast rules (no eslint-disable, no env fallbacks).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Kayron Cabral",
|
|
@@ -31,12 +31,14 @@
|
|
|
31
31
|
"globs.mjs",
|
|
32
32
|
"plugin.mjs",
|
|
33
33
|
"configs/",
|
|
34
|
+
"!configs/*.test.mjs",
|
|
35
|
+
"!configs/fixtures/",
|
|
34
36
|
"rules/*.mjs",
|
|
35
37
|
"!rules/*.test.mjs"
|
|
36
38
|
],
|
|
37
39
|
"dependencies": {
|
|
38
40
|
"@eslint/js": "^9.39.4",
|
|
39
|
-
"eslint-plugin-boundaries": "^
|
|
41
|
+
"eslint-plugin-boundaries": "^7.4.4",
|
|
40
42
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
41
43
|
"eslint-plugin-playwright": "^2.2.2",
|
|
42
44
|
"eslint-plugin-sonarjs": "^4.0.3",
|
|
@@ -58,7 +60,7 @@
|
|
|
58
60
|
},
|
|
59
61
|
"scripts": {
|
|
60
62
|
"lint": "eslint .",
|
|
61
|
-
"test": "node --test rules/*.test.mjs",
|
|
63
|
+
"test": "node --test rules/*.test.mjs configs/*.test.mjs",
|
|
62
64
|
"check:package": "node ../../scripts/check-package.mjs"
|
|
63
65
|
}
|
|
64
66
|
}
|