@starci/eslint-canon-be 3.19.2 → 3.19.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.19.4 - 2026-11-07
4
+
5
+ - Fixed: the `@starci/hfs` peer is `~6.1.0` (it was `~6.0.0`), the range of the hfs the canon pins name, so an app on hfs 6.1 installs with `npm ci`.
6
+
7
+ ## 3.19.3 - 2026-11-07
8
+
9
+ - Added (R235 `SCAN_SMELL`, `no-line-separator-literal`): a raw U+2028, U+2029 or U+0085 anywhere in a file, specs included, is an error that names the escape to write (`
`, `
`, `…`) in a string, template or regular expression, or says to delete the character elsewhere. The Sonar scanner splits lines at these characters and TypeScript does not, so its analysis aborts with "Line n is out of range ... File has m lines".
10
+
3
11
  ## 3.19.2 - 2026-11-07
4
12
 
5
13
  - A patch: peers `@starci/hfs` ~6.0.0. Comments, rule docs and messages cite rules by their ids and carry no ruling history.
package/README.md CHANGED
@@ -43,7 +43,7 @@ A sample, not the list:
43
43
  | **Model calls** (R326, R327, R344) | Every model call goes through the `@starci/ai-router` gateway: an upstream provider key variable (`PROVIDER_KEY_VARIABLES` of `src/ai-gateway.ts`, with its `_FILE` twin) is named only in the gateway's custody owner `integrations/ai-gateway`, specs and the test world included; code builds only `ChatOpenAI` and `OpenAIEmbeddings` of `@langchain/openai`, each from an inline options object whose `configuration.baseURL` is read from a `<c>.options.ts` type and whose `apiKey` is a `platform/config` `Secret` revealed; `integrations/ai` reads exactly `STARCI_AI_KEY`, the one virtual key of every client, and the custody owner passes the gateway no `adminToken`. Which owner may import LangChain, `openai`, a provider SDK or an agent framework is the infrastructure table (`provider-key-custody`, `ai-client-through-gateway`, `ai-virtual-key-name`, `infra-import-owner`) |
44
44
  | **Ambient ids** (R142) | `randomUUID` of Node's crypto (named, namespace or global), the `v1`, `v4`, `v6` and `v7` generators of `uuid`, `nanoid` and `ulid` are used only inside `platform/ids`, specs included: code asks the injected `Ids` port and a spec provides `fakeIds()`; the generators are found by the module they are imported from, never by a local name (`no-ambient-id`) |
45
45
  | **App composition** (R245, R246) | `apps/<app>/src/<app>.env.ts` exports an explicit typed `<App>Env` interface and `read<App>Env(env: EnvSource): <App>Env` (for example `ApiEnv` and `readApiEnv`). The interface declares its own readonly parsed members, such as `readonly server: ReturnType<typeof parseServerConfig>`, structurally compatible with the app's options. The role name stays `<app>.env.ts`, never `env.ts`; capability `<capability>.config.ts` files stay unchanged. `main.ts` creates `EnvSource` once, imports and calls the reader, builds options and boots. The env file holds fail-fast parsing only, with no localhost or default host fallback, logic, module composition, business code or feature imports; `<app>.options.ts` holds env-derived options and port bindings only, with no parsing. Both refuse an array listing `*Module` classes, module or queue registrations (`register`, `forRoot`, `registerQueue`) or scheduler entries, and an `imports`, `modules`, `schedulers` or `processors` list; the env file also refuses standalone module or queue registration calls. Composition belongs in a `compose/<area>.ts` group that `app.module.ts` spreads (`app-options-composition-free`, `BE_APP_OPTIONS_COMPOSITION`). Each app file stays within its slot's line budget: `main.ts` 80, env 150, options 200, group 120, root 250 (`app-file-budget`, `BE_APP_COMPOSITION_BUDGET`). The interface and reader exports are a documented scaffold contract; they need no new lint rule |
46
- | **Sonar parity** (R235) | The smells SonarCloud measures that a lint rule can decide: no `await` inside a loop (`no-await-in-loop`, S9382; `for (;;)` and `while (true)` are spared), no `charCodeAt`/`fromCharCode` (`prefer-code-point`), no string that only escapes backslashes (`prefer-string-raw`), no nested conditional (`no-nested-conditional`), `void` only on a call (`no-void-operator`), no unused import (`no-unused-import`), `export ... from` for an import that is only handed on (`prefer-export-from`); the factory also turns on typescript-eslint `no-deprecated`, `no-base-to-string` and `require-await`. The files `*.spec.ts` and `*.e2e-spec.ts` are outside the scan, so outside these rules |
46
+ | **Sonar parity** (R235) | The smells SonarCloud measures that a lint rule can decide: no `await` inside a loop (`no-await-in-loop`, S9382; `for (;;)` and `while (true)` are spared), no `charCodeAt`/`fromCharCode` (`prefer-code-point`), no string that only escapes backslashes (`prefer-string-raw`), no nested conditional (`no-nested-conditional`), `void` only on a call (`no-void-operator`), no unused import (`no-unused-import`), `export ... from` for an import that is only handed on (`prefer-export-from`), no raw U+2028, U+2029 or U+0085 in any file, specs included (`no-line-separator-literal`: the scanner counts them as line breaks and aborts; the finding names the escape); the factory also turns on typescript-eslint `no-deprecated`, `no-base-to-string` and `require-await`. The files `*.spec.ts` and `*.e2e-spec.ts` are outside the scan, so outside these rules |
47
47
  | **Cookies** (R141) | A cookie a door writes through the response of Express or Fastify (`cookie`, `setCookie`) states `httpOnly: true`, `secure: true` and `sameSite` `lax` or `strict` in options typed with those literals, and `Set-Cookie` is never written as a header; the call is recognised by where its signature is declared (`response-cookie-attributes`). A secret-derived value is compared with `timingSafeEqual`: a `Secret` of `platform/config` and the `.digest()` of a `Hash` or `Hmac` of Node's crypto are recognised by type (`secret-compare-timing-safe`) |
48
48
  | **Default deny** | Typed bodies and arguments, no `GraphQLJSON` tunnel, no `switch (operation)`, `@Public` carries a `PublicReason` member of `domain/identity`, no `@UseGuards` (the global `APP_GUARD` chain decides) and no guard injected into another guard (`no-untyped-body`, `public-needs-reason`, `no-auth-use-guards`, `no-guard-injects-guard`) |
49
49
  | **Module shape** | No `@Global()`; `isGlobal: true` only in an app's `app.module.ts`; no import of another owner's module; typed `ConfigurableModuleBuilder`; `static register` is the only factory; every module (capability, sub-module, feature, transport, cli group) has a sibling `<x>.module-definition.ts` and `<x>.options.ts`, extends its own `ConfigurableModuleClass` and is listed only as `X.register(...)` (`module-definition-required`); only a capability's representative module keeps `.setExtras({ isGlobal: false })` and the `register` override (`capability-module-shape`); one module per file; no `new` of a provider; no module-level `let` (`no-global-decorator`, `is-global-only-in-app`, `no-cross-owner-module-import`, `static-module-register`) |
@@ -10,7 +10,7 @@
10
10
  * `require-await` the factory turns on.
11
11
  */
12
12
  import { SONAR_SYNTAX_RULES } from "../runtime/scripts/lib/sonar-syntax-rules.mjs";
13
- const NAMES = ["no-await-in-loop", "prefer-code-point", "prefer-string-raw", "no-nested-conditional", "no-void-operator", "no-unused-import", "prefer-export-from", "max-params"];
13
+ const NAMES = ["no-await-in-loop", "prefer-code-point", "prefer-string-raw", "no-nested-conditional", "no-void-operator", "no-unused-import", "prefer-export-from", "max-params", "no-line-separator-literal"];
14
14
  /** The rules this law contributes to the plugin. */
15
15
  export const rules = Object.fromEntries(NAMES.flatMap((name) => {
16
16
  const rule = SONAR_SYNTAX_RULES[name];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@starci/eslint-canon-be",
3
- "version": "3.19.2",
3
+ "version": "3.19.4",
4
4
  "description": "The StarCi back-end lint canon: every rule its laws publish, gathered as one flat-config plugin.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -40,7 +40,7 @@
40
40
  "node": ">=22.13.0"
41
41
  },
42
42
  "peerDependencies": {
43
- "@starci/hfs": "~6.0.0",
43
+ "@starci/hfs": "~6.1.0",
44
44
  "eslint": ">=9",
45
45
  "typescript": ">=5.9"
46
46
  },
@@ -247,6 +247,23 @@ const mediaHasCaption = {
247
247
  },
248
248
  };
249
249
 
250
+ /** The line breaks the scanner counts and the language does not: a raw U+2028 or U+2029 inside a string, template, regular expression or comment is legal source, and U+0085 is no line terminator in it. */
251
+ const SCANNER_LINE_BREAKS = /[\u2028\u2029\u0085]/gu;
252
+ const LINE_BREAK_NAMES = Object.freeze({ '\u2028': ['U+2028', 'LINE SEPARATOR', '\\u2028'], '\u2029': ['U+2029', 'PARAGRAPH SEPARATOR', '\\u2029'], '\u0085': ['U+0085', 'NEXT LINE', '\\u0085'] });
253
+ /** Sonar scanner crash ("Line n is out of range ... File has m lines"): the scanner splits a file at U+2028, U+2029 and U+0085, the language service does not, so their line numbers disagree and the analysis aborts. Applies to every file the scan reads, specs included. */
254
+ const noLineSeparatorLiteral = {
255
+ meta: { type: 'problem', schema: [], messages: { raw: 'The scanner splits lines at a raw {{ code }} ({{ name }}) and TypeScript does not, so its analysis aborts with "Line n is out of range". Write the escape `{{ escape }}` in a string, template or regular expression, or delete the character anywhere else.' } },
256
+ create: (context) => ({
257
+ Program: () => {
258
+ const { text } = context.sourceCode;
259
+ for (const found of text.matchAll(SCANNER_LINE_BREAKS)) {
260
+ const [code, name, escape] = LINE_BREAK_NAMES[found[0]];
261
+ context.report({ loc: context.sourceCode.getLocFromIndex(found.index), messageId: 'raw', data: { code, name, escape } });
262
+ }
263
+ },
264
+ }),
265
+ };
266
+
250
267
  /** The files the example scans leave out: a unit spec and an end-to-end spec (the regex, and the flat-config globs of the same set). */
251
268
  const OUTSIDE_THE_SCAN = /\.(?:e2e-)?spec\.[cm]?[jt]sx?$/;
252
269
  export const OUTSIDE_THE_SCAN_FILES = Object.freeze(['**/*.spec.{js,mjs,cjs,ts,mts,cts,jsx,tsx}', '**/*.e2e-spec.{js,mjs,cjs,ts,mts,cts,jsx,tsx}']);
@@ -266,4 +283,5 @@ export const SONAR_SYNTAX_RULES = Object.freeze({
266
283
  'no-unused-prop-types': scanned(noUnusedPropTypes),
267
284
  'media-has-caption': scanned(mediaHasCaption),
268
285
  'max-params': scanned(maxParams),
286
+ 'no-line-separator-literal': noLineSeparatorLiteral,
269
287
  });