@starci/eslint-canon-fe 8.3.0 → 8.4.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.
Files changed (69) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/callback-shape.mjs +344 -0
  3. package/client-boundary.mjs +1 -1
  4. package/docs/hooks-folder.md +1 -1
  5. package/env-owner.mjs +120 -9
  6. package/function-budget.mjs +49 -0
  7. package/hooks-folder.mjs +149 -18
  8. package/icon.mjs +67 -0
  9. package/index.mjs +47 -0
  10. package/lib/own-hook-origin.mjs +53 -0
  11. package/lib/program-for.mjs +22 -0
  12. package/lib/pure-owner-helper.mjs +148 -0
  13. package/lib/redux-hook-origin.mjs +44 -0
  14. package/next-conventions.mjs +38 -35
  15. package/package.json +1 -1
  16. package/runtime/knowledge/hfs/canon-pins.yaml +11 -11
  17. package/runtime/knowledge/hfs/fe-stack.yaml +22 -1
  18. package/runtime/knowledge/hfs/slots.yaml +344 -62
  19. package/runtime/knowledge/patterns/fe/folder.yaml +1 -0
  20. package/runtime/knowledge/sonar-gate.yaml +1 -1
  21. package/runtime/modules/models/runtimes.yaml +1 -1
  22. package/runtime/packages/hfs/templates/app/package-scripts/package.json +1 -0
  23. package/runtime/scripts/api/git/lib.mjs +3 -0
  24. package/runtime/scripts/api/git/merge-base.mjs +9 -0
  25. package/runtime/scripts/api/git/recorded-lines.mjs +54 -8
  26. package/runtime/scripts/hfs/architecture/backend-app-files.mjs +1 -8
  27. package/runtime/scripts/hfs/architecture/backend.mjs +2 -7
  28. package/runtime/scripts/hfs/architecture/client-reaches-server.mjs +6 -3
  29. package/runtime/scripts/hfs/architecture/dead-exports-bindings.mjs +149 -0
  30. package/runtime/scripts/hfs/architecture/dead-exports.mjs +9 -41
  31. package/runtime/scripts/hfs/architecture/default-deny.mjs +8 -6
  32. package/runtime/scripts/hfs/architecture/frontend-world.mjs +1 -1
  33. package/runtime/scripts/hfs/architecture/function-spec-providers.mjs +153 -0
  34. package/runtime/scripts/hfs/architecture/hfs.mjs +3 -3
  35. package/runtime/scripts/hfs/architecture/module-per-transport.mjs +28 -13
  36. package/runtime/scripts/hfs/architecture/next-data-inference.mjs +176 -0
  37. package/runtime/scripts/hfs/architecture/next-data-symbols.mjs +26 -0
  38. package/runtime/scripts/hfs/architecture/next-data.mjs +31 -23
  39. package/runtime/scripts/hfs/architecture/reachability.mjs +14 -0
  40. package/runtime/scripts/hfs/architecture/register-once.mjs +2 -2
  41. package/runtime/scripts/hfs/architecture/source-names.mjs +48 -3
  42. package/runtime/scripts/hfs/architecture/supabase-ast.mjs +211 -11
  43. package/runtime/scripts/hfs/architecture/supabase-be.mjs +1 -1
  44. package/runtime/scripts/hfs/architecture/supabase.mjs +59 -21
  45. package/runtime/scripts/hfs/architecture/surface.mjs +2 -1
  46. package/runtime/scripts/hfs/architecture/tiers.mjs +3 -3
  47. package/runtime/scripts/hfs/architecture/unit-spec-providers.mjs +8 -2
  48. package/runtime/scripts/hfs/declaration-shape.mjs +39 -3
  49. package/runtime/scripts/hfs/edition-slots.mjs +2 -2
  50. package/runtime/scripts/hfs/manifest-shape.mjs +67 -7
  51. package/runtime/scripts/hfs/project-rule.mjs +3 -1
  52. package/runtime/scripts/hfs/rule-catalog.mjs +156 -11
  53. package/runtime/scripts/hfs/rule-params-shape.mjs +22 -10
  54. package/runtime/scripts/hfs/rules/secrets.mjs +13 -0
  55. package/runtime/scripts/hfs/slot-imports.mjs +18 -5
  56. package/runtime/scripts/hfs/slots.mjs +1 -0
  57. package/runtime/scripts/lib/env.mjs +20 -0
  58. package/runtime/scripts/lib/event-contract.mjs +107 -0
  59. package/runtime/scripts/lib/json-clone.mjs +61 -0
  60. package/runtime/scripts/lib/list.mjs +4 -0
  61. package/runtime/scripts/lib/secret-patterns.mjs +60 -5
  62. package/runtime/scripts/lib/stack-services.mjs +1 -1
  63. package/runtime/scripts/lib/ts-analysis.mjs +5 -2
  64. package/runtime/scripts/lib/ts-ast.mjs +27 -2
  65. package/served-locale.mjs +80 -9
  66. package/size-growth.mjs +10 -6
  67. package/swr-family.mjs +197 -0
  68. package/translation.mjs +135 -7
  69. package/transport.mjs +126 -59
@@ -12,12 +12,13 @@
12
12
  */
13
13
 
14
14
  import { attribute, attributeValue, calleeName, leadingTextOf, stringOf } from "./lib/ast.mjs"
15
+ import { variableOf } from "./lib/bindings.mjs"
15
16
  import { forbiddingConcern } from "./lib/fe-stack.mjs"
16
17
  import { hfsOf } from "./lib/hfs.mjs"
17
- import { baseName, classOf, fileOf, inSlot, roleOfFile, slotOfFile, stem } from "./lib/scope.mjs"
18
+ import { baseName, classOf, fileOf, inSlot, roleOfFile, slotOfFile } from "./lib/scope.mjs"
18
19
 
19
20
  /** Another i18n stack: a second place that decides which language a reader sees (one the fe-stack catalog forbids by name is fe-stack-import's finding). */
20
- const OTHER_I18N = /^(?:react-i18next|i18next|next-i18next|react-intl|next-translate|@lingui\/.+|typesafe-i18n|rosetta)(?:\/.*)?$/
21
+ const OTHER_I18N = /^(?:react-i18next|i18next|next-i18next|react-intl|next-translate|typesafe-i18n|rosetta)(?:\/.*)?$|^@lingui\/.+$/
21
22
 
22
23
  // -- FE-NEXT-1 -------------------------------------------------------------------------------------
23
24
 
@@ -137,21 +138,23 @@ export const htmlLangFromLocale = {
137
138
 
138
139
  // -- FE-NEXT-5 -------------------------------------------------------------------------------------
139
140
 
140
- /** The names a module exports, from declarations and specifiers. */
141
- const exportedNames = (program) => {
142
- const names = new Set()
143
- for (const statement of program.body) {
144
- if (statement.type !== "ExportNamedDeclaration") continue
145
- const declaration = statement.declaration
146
- if (declaration && declaration.id) names.add(declaration.id.name)
147
- if (declaration && declaration.type === "VariableDeclaration") {
148
- for (const entry of declaration.declarations) if (entry.id.type === "Identifier") names.add(entry.id.name)
141
+ /** The names one named-export statement introduces. */
142
+ const statementExportNames = (statement) => {
143
+ if (statement.type !== "ExportNamedDeclaration") return []
144
+ const declaration = statement.declaration
145
+ const names = (statement.specifiers ?? []).map((specifier) => specifier.exported.name)
146
+ if (declaration?.id) names.push(declaration.id.name)
147
+ if (declaration?.type === "VariableDeclaration") {
148
+ for (const entry of declaration.declarations) {
149
+ if (entry.id.type === "Identifier") names.push(entry.id.name)
149
150
  }
150
- for (const specifier of statement.specifiers ?? []) names.add(specifier.exported.name)
151
151
  }
152
152
  return names
153
153
  }
154
154
 
155
+ /** The names a module exports, from declarations and specifiers. */
156
+ const exportedNames = (program) => new Set(program.body.flatMap(statementExportNames))
157
+
155
158
  /** Every page names itself: `metadata` or `generateMetadata`. */
156
159
  export const pageExportsMetadata = {
157
160
  meta: {
@@ -338,34 +341,34 @@ const STACK_FACTORIES = new Map([
338
341
  ["next-intl/middleware", new Set(["default"])],
339
342
  ])
340
343
 
341
- /** The variable a name binds to, walking up from the scope of a node. */
342
- const bindingOf = (context, identifier) => {
343
- let scope = (context.sourceCode ?? context.getSourceCode()).getScope(identifier)
344
- while (scope) {
345
- const variable = scope.set.get(identifier.name)
346
- if (variable) return variable.defs[0] ?? null
347
- scope = scope.upper
348
- }
344
+ /** The public name selected by a named or default import. */
345
+ const importedName = (specifier) => {
346
+ if (specifier.type === "ImportSpecifier") return specifier.imported.name ?? specifier.imported.value
347
+ if (specifier.type === "ImportDefaultSpecifier") return "default"
349
348
  return null
350
349
  }
351
350
 
351
+ /** The known next-intl factory selected from an import. */
352
+ const stackFactory = (definition, exported) => {
353
+ const source = String(definition.parent.source.value)
354
+ if (!STACK_FACTORIES.get(source)?.has(exported)) return null
355
+ return { source, name: exported === "default" ? "createMiddleware" : exported }
356
+ }
357
+
358
+ /** A factory called through a namespace import, else null. */
359
+ const namespaceFactory = (context, callee) => {
360
+ if (callee.type !== "MemberExpression" || callee.computed || callee.object.type !== "Identifier" || callee.property.type !== "Identifier") return null
361
+ const definition = variableOf(context, callee.object)?.defs[0] ?? null
362
+ if (definition?.type !== "ImportBinding" || definition.node.type !== "ImportNamespaceSpecifier") return null
363
+ return stackFactory(definition, callee.property.name)
364
+ }
365
+
352
366
  /** The name a stack factory has where the call reads it: "defineRouting" (next-intl/routing), else null. */
353
367
  const stackFactoryOf = (context, callee) => {
354
- if (callee.type === "Identifier") {
355
- const definition = bindingOf(context, callee)
356
- if (definition?.type !== "ImportBinding") return null
357
- const source = String(definition.parent.source.value)
358
- const specifier = definition.node
359
- const exported = specifier.type === "ImportSpecifier" ? specifier.imported.name ?? specifier.imported.value : specifier.type === "ImportDefaultSpecifier" ? "default" : null
360
- return exported !== null && STACK_FACTORIES.get(source)?.has(exported) ? { source, name: exported === "default" ? "createMiddleware" : exported } : null
361
- }
362
- if (callee.type === "MemberExpression" && !callee.computed && callee.object.type === "Identifier" && callee.property.type === "Identifier") {
363
- const definition = bindingOf(context, callee.object)
364
- if (definition?.type !== "ImportBinding" || definition.node.type !== "ImportNamespaceSpecifier") return null
365
- const source = String(definition.parent.source.value)
366
- return STACK_FACTORIES.get(source)?.has(callee.property.name) ? { source, name: callee.property.name } : null
367
- }
368
- return null
368
+ if (callee.type !== "Identifier") return namespaceFactory(context, callee)
369
+ const definition = variableOf(context, callee)?.defs[0] ?? null
370
+ if (definition?.type !== "ImportBinding") return null
371
+ return stackFactory(definition, importedName(definition.node))
369
372
  }
370
373
 
371
374
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@starci/eslint-canon-fe",
3
- "version": "8.3.0",
3
+ "version": "8.4.0",
4
4
  "description": "The StarCi front-end lint canon: every rule its laws publish, gathered as one flat-config plugin and attached by one factory.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -29,14 +29,14 @@ pins:
29
29
  source: packages/grammar/package.json
30
30
  why: 'the grammar front ends read: the brand layer sets `--font-sans` and `--font-mono` and the grammar reads them; it carries the Input tel kind, the copyable and read-only Input, the IconButton disclosure props and count badge, ChatBubble, FillViewport, Textarea mentions and Enter-to-send, the leading PrimaryRailLayout rail, the plate-less Image, ListRow, the soft Alert, Progress steps, the floating primary IconButton, FlowGraph, the STATE-8 loading views and the bordered selectable TagGroup chips. The runtime source version wins for a @starci package.'
31
31
  '@starci/eslint-canon-be':
32
- version: 3.3.1
32
+ version: 3.4.0
33
33
  group: starci
34
34
  install: registry
35
35
  side: be
36
36
  source: packages/eslint/be/package.json
37
37
  why: 'the back-end ESLint canon: `loadHfs(import.meta.url)` of be/eslint.config.mjs finds the app-root hfs.json (kind app) and gives every linted file the view of the be side, and the project graph is built per side; its bundled runtime copies (slots, canon-pins, failure codes, the architecture machine) put .starcistacks and .sops.yaml at the app root; `starciBeConfig({ hfs: loadHfs(import.meta.url) })` is the typed factory and the BE-CONVENTION laws are its rules.'
38
38
  '@starci/eslint-canon-fe':
39
- version: 8.3.0
39
+ version: 8.4.0
40
40
  group: starci
41
41
  install: registry
42
42
  side: fe
@@ -62,28 +62,28 @@ pins:
62
62
  side: both
63
63
  source: packages/prettier-config/package.json
64
64
  '@starci/jest-preset':
65
- version: 2.2.7
65
+ version: 2.3.0
66
66
  group: starci
67
67
  install: registry
68
68
  side: be
69
69
  source: packages/jest-preset/package.json
70
70
  why: 'the Jest preset of a back end: the world runner runs up to min(--maxWorkers, slots) world files at once, each in its own process bound to one data slot of the test world (STARCI_TEST_WORLD_SLOT), and reads test-world state protocol 2 only: it pairs exactly with @starci/test-world, and any other state file is JEST_PRESET_WORLD_PAIR_MISMATCH. The unit run writes the lcov Sonar and Codecov import (services only); the integration, e2e and contract projects run every spec file in a worker process of its own (world-runner.cjs), so a process-global framework registry (@nestjs/graphql type metadata) never leaks between e2e files; it ships the unit kit (mockEntityManager, fakeTransaction, fakeIds, FakeClock, Outcome matchers) and the recordingOutbox claim side.'
71
71
  '@starci/test-world':
72
- version: 1.2.1
72
+ version: 1.2.2
73
73
  group: starci
74
74
  install: registry
75
75
  side: be
76
76
  source: packages/test-world/package.json
77
77
  why: 'the shared e2e library of every back end (R47, R48), a devDependency of every back end: the warm stack behind toxiproxy, the network-edge fakes, the Nest boot, the typed useTestWorld handle, useSandbox for contract specs and the outage lock. Kafka is real own infra (the one digest-pinned apache/kafka KRaft image, a broker listener and proxy per slot, slot-prefixed topics, consumer groups and client ids) and Postgres is schema-per-context (a schema and a login role per context in a shared database). Each worker has its own data slot (<ns>_w<k>) with its own databases, Keycloak realm, leased Redis DB, bucket/collection/topic prefixes, fakes host, toxiproxy proxies and outage lock; a run provisions min(jest workers, workers cap, default 2) slots, and state file protocol 2 pairs exactly with @starci/jest-preset (TEST_WORLD_PAIR_MISMATCH otherwise). A modules world boots real peer apps beside its modules, world.apps.<name>.during(fn) is the outage of a peer app, w.keycloak.clientSecret(client) answers the run-generated secret of a confidential realm client, world.keycloak.events/sessions read the realm user events and live sessions, world.infra.postgresql.connection(name) takes one database connection down while the others serve, and world.resolve and scope.resolve take any Nest token. Every path a declaration names (`stack`, seeds, the realm, Dockerfiles) resolves from the app root (the directory of hfs.json); the globalSetup registers the path aliases as TypeScript resolves them. Its CLI main is exported at ./cli for starci app stack.'
78
78
  '@starci/cli':
79
- version: 1.3.0
79
+ version: 1.4.0
80
80
  group: starci
81
81
  install: registry
82
82
  side: both
83
83
  source: packages/cli/package.json
84
84
  why: 'the only StarCi command package; product repositories install it for starci app, while @starci/hfs remains its pinned transitive implementation.'
85
85
  '@starci/hfs':
86
- version: 4.3.0
86
+ version: 4.4.0
87
87
  group: starci
88
88
  install: registry
89
89
  side: both
@@ -180,7 +180,7 @@ pins:
180
180
  side: be
181
181
  # --- framework
182
182
  next:
183
- version: 16.1.6
183
+ version: 16.4.2
184
184
  group: framework
185
185
  side: fe
186
186
  react:
@@ -206,7 +206,7 @@ pins:
206
206
  group: framework
207
207
  side: be
208
208
  '@nestjs/platform-express':
209
- version: 11.2.5
209
+ version: 11.2.7
210
210
  group: framework
211
211
  side: be
212
212
  '@nestjs/testing':
@@ -316,7 +316,7 @@ pins:
316
316
  side: fe
317
317
  why: 'the codegen preset of the front-end wire types (fe-stack codegen); the latest registry version on 2026-10-13.'
318
318
  'axios':
319
- version: 1.15.2
319
+ version: 1.20.0
320
320
  group: framework
321
321
  side: fe
322
322
  why: 'the REST client of the front end for uploads, presigned URLs and auth endpoints (fe-stack rest); version read from the starci-academy package-lock on 2026-10-13.'
@@ -465,12 +465,12 @@ pins:
465
465
  version: 13.4.5
466
466
  group: framework
467
467
  side: be
468
- why: 'the GraphQL transport of every back end (be.transport.graphql) that the front end calls; the ecommerce-app resolution on 2026-10-13.'
468
+ why: 'the GraphQL transport of every back end (be.transport.graphql) that the front end calls; the ecommerce-app resolution on 2026-10-13. Stays on 13.x for alpha.18: the npm-audit advisory fixed by 14.0.3 (semver major) is a documented accepted exception, upgrade deferred to alpha.19 (owner ruling graphql-13-advisory-accepted-until-a19, 2026-10-16).'
469
469
  '@nestjs/apollo':
470
470
  version: 13.4.5
471
471
  group: framework
472
472
  side: be
473
- why: 'the Apollo driver of @nestjs/graphql; the ecommerce-app resolution on 2026-10-13.'
473
+ why: 'the Apollo driver of @nestjs/graphql; the ecommerce-app resolution on 2026-10-13. Stays on 13.x with @nestjs/graphql (accepted advisory, major deferred to alpha.19).'
474
474
  '@apollo/server':
475
475
  version: 5.5.1
476
476
  group: framework
@@ -1,6 +1,6 @@
1
1
  schema: starci/fe-stack@1
2
2
  purpose: >-
3
- The front-end stack of every app, lite and full alike (owner ruling 2026-10-13, R212 case-2): for each common front-end concern the
3
+ The front-end stack of every app, lite and full alike (owner ruling 2026-10-13, R212 case-2 (owner:lite-production-swarm), with the Work boundary amended by ruling:R212/case-4): for each common front-end concern the
4
4
  ONE canonical library, its HFS home (slot ids of knowledge/hfs/slots.yaml), the pattern id that teaches it
5
5
  (knowledge/patterns/fe/*.yaml) and the alternatives a front end never depends on or imports. Versions live in
6
6
  knowledge/hfs/canon-pins.yaml only. `tier: core` packages are installed by every scaffold; `opt` packages are added when a feature
@@ -219,3 +219,24 @@ concerns:
219
219
  pattern: FE-LINT
220
220
  forbids: []
221
221
  why: the canon lint and format configuration.
222
+ - id: auth-supabase
223
+ tier: opt
224
+ packages: ['@supabase/supabase-js', '@supabase/ssr']
225
+ home: [fe.modules.auth]
226
+ pattern: FE-AUTH
227
+ forbids: []
228
+ why: the lite auth provider client and PKCE server cookie adapter, confined to modules/auth; data still goes through the back end.
229
+ - id: framework-support
230
+ tier: opt
231
+ packages: [server-only, rxjs]
232
+ home: [fe.source-root-pinned]
233
+ pattern: FE-ROUTE
234
+ forbids: []
235
+ why: the Next server boundary marker and Apollo peer support used by canonical workspaces.
236
+ - id: tool-support
237
+ tier: opt
238
+ packages: ['@types/node', '@types/react', '@types/react-dom', '@starci/tsconfig', '@starci/stylelint-canon', '@tailwindcss/postcss', postcss-value-parser, stylelint, eslint-plugin-react-hooks]
239
+ home: [fe.tool-config]
240
+ pattern: FE-LINT
241
+ forbids: []
242
+ why: the compiler, CSS and lint support packages of the canonical front-end configs.