@starci/eslint-canon-be 3.27.1 → 3.27.3

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,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.27.3 - 2026-11-18
4
+
5
+ - Fixed (`no-raw-sql`): the nivoos SDK's typed object read, `reach.objects(Type).query({ where, sort, limit })`, is no SQL: a `.query(` whose receiver is an `.objects(...)` call, in a file that imports `@starci/nivoos-sdk`, passes. Any other `.query(` in that file is still refused.
6
+ - Fixed (`schema-bounded`): a record keyed by a closed `z.enum` (`z.record`, `z.partialRecord`, `z.looseRecord`) is bounded by its keys. The nivoos package check refuses `.refine` as code, so the enum key is the bound a package schema can state; the `.refine` form stays accepted elsewhere.
7
+
8
+ ## 3.27.2 - 2026-11-18
9
+
10
+ - Changed (`lib/nivoos-profile.ts`): the nivoos authoring profile no longer applies `no-non-ascii-source` to a declared package (Vietnamese in literals, comments and identifiers); the literal-only narrowing inside the rule is removed and the rule is listed in `NIVOOS_RELAXED` with its reason. An undeclared package keeps the whole rule.
11
+
3
12
  ## 3.27.1 - 2026-11-18
4
13
 
5
14
  - Added (`lib/nivoos-profile.ts`): the lint profile of a declared nivoos business package (slot `app.nivoos-package`, `lintProfile: nivoos`, PROJECT-BUSINESS-1): `no-non-ascii-source` allows Vietnamese letters inside string and template literals (comments, identifiers and emoji stay refused); `no-default-export` allows the default export of `src/<name>.package.ts`, which the SDK loads; `explicit-export-surface`, `require-public-member-jsdoc`, `job-shape` and `throw-domain-error` do not apply to the package source (nothing imports it, the SDK interface owns its members, `.step.ts` is the SDK file kind, an SDK node fails with a coded `Error`). Every other rule, `schema-bounded` included, still applies.
package/README.md CHANGED
@@ -37,9 +37,8 @@ A package authored with the nivoos SDK (agents, workflows, cells, steps, brain,
37
37
  (`lintProfile: nivoos`), and `starciBePackagesConfig` judges `packages/<name>/src/**` with the same canon less what an SDK package cannot satisfy. The profile is chosen by the slot and takes no
38
38
  file comment; the same code in an undeclared package is judged by the whole canon (`src/lib/nivoos-profile.ts`, `src/nivoos-profile.spec.ts`):
39
39
 
40
- - `no-non-ascii-source` accepts Vietnamese letters inside string and template literals (the business's copy) and refuses them in comments and identifiers; an emoji or ornament is refused everywhere;
41
40
  - `no-default-export` accepts the default export of the entry `src/<name>.package.ts`, which the SDK loads;
42
- - `explicit-export-surface`, `require-public-member-jsdoc`, `job-shape` and `throw-domain-error` are not applied, each with its reason in `NIVOOS_RELAXED` (nothing imports a package's source and the SDK's
41
+ - `no-non-ascii-source` is not applied (Vietnamese copy and comments are expected; identifiers stay ASCII by the package convention), and `explicit-export-surface`, `require-public-member-jsdoc`, `job-shape` and `throw-domain-error` are not applied, each with its reason in `NIVOOS_RELAXED` (nothing imports a package's source and the SDK's
43
42
  interfaces type its members; a member is a field of the SDK interface; `.step.ts` is a workflow step, not a job step; an SDK node fails by a thrown coded `Error`).
44
43
 
45
44
  [contexts/project/business-repo.md](../../contexts/project/business-repo.md) owns the page; the findings each relaxation held are those of the first package, `nivo-web`.
@@ -67,7 +66,7 @@ A sample, not the list:
67
66
  | **Log safety** | A call on the `Logger` port (found by the receiver's type) passes no `Secret` or `Pii` value and no value named like a credential or a personal identifier (`no-secret-in-log`); a constructed error (its type derives from `Error`) carries no `Secret` value and no text value named like a credential (`no-secret-in-error`) |
68
67
  | **Async and types** | An `async` function awaits; handlers and public methods declare a return type; no `Function` type, no `eval`; an inline object type takes a name; no `const enum`. Casts, `x!` and `any` are refused in every file, specs included, by the typescript-eslint rules the factory turns on (`async-needs-await`, `explicit-handler-return-type`, `no-function-or-eval`, `no-inline-param-type`, `no-inline-object-type`, `no-const-enum`) |
69
68
  | **Migrations and input** | A migration's `down()` reverses its `up()`; every property of an input class has the `class-validator` decorators its type calls for (string `@MaxLength`, enum `@IsEnum`, array `@ArrayMaxSize`, nested `@ValidateNested()` and `@Type`); reads page by cursor, never by `skip`, `offset` or `OFFSET`; a door opened for `PublicReason.AuthHandshake` or `PublicReason.SignedWebhook` carries `RateTier.Strict` of `platform/http-security` on the method or its class (`migration-down-reversible`, `input-bounded`, `no-offset-pagination`, `auth-door-strict-rate-tier`) |
70
- | **Boundary schema** (R304, R305) | `zod` reads only boundary data that never reaches a DTO (a provider response, model output, a queue or outbox payload read back): it is imported only from a `<name>.schema.ts` of a domain, platform or integrations owner, or from any file of a root workspace package (tier `package`: `packages/<name>/`, whose node, block and vocabulary contracts are zod schemas), never in a feature, a transport door or a `dto/` folder, and a schema file imports no `class-validator`, `class-transformer` or `@nestjs/graphql` (`schema-place`) and holds only zod values and types (`schema-file-values-only`; its spec is exempt from the testing module of R281 only while this holds); every string, array, set, record and map of a schema has an upper bound and `z.any()`, `z.unknown()` and `z.json()` do not exist (`schema-bounded`) |
69
+ | **Boundary schema** (R304, R305) | `zod` reads only boundary data that never reaches a DTO (a provider response, model output, a queue or outbox payload read back): it is imported only from a `<name>.schema.ts` of a domain, platform or integrations owner, or from any file of a root workspace package (tier `package`: `packages/<name>/`, whose node, block and vocabulary contracts are zod schemas), never in a feature, a transport door or a `dto/` folder, and a schema file imports no `class-validator`, `class-transformer` or `@nestjs/graphql` (`schema-place`) and holds only zod values and types (`schema-file-values-only`; its spec is exempt from the testing module of R281 only while this holds); every string, array, set, record and map of a schema has an upper bound (a record by a refinement on its entry count or by a closed `z.enum` key set, the bound a nivoos package schema can state) and `z.any()`, `z.unknown()` and `z.json()` do not exist (`schema-bounded`) |
71
70
  | **Spec quality** | A spec does not read repository source with `fs` (`spec-no-source-read`); the borrowed `consistent-type-assertions` (`never`) and `no-non-null-assertion` leave no `as` and no `x!` in a spec, and `no-ambient-clock` and `no-direct-env-read` cover specs, so no `Date.now()`, argless `new Date()` or `process.env`. A unit spec is `<name>.service.spec.ts`: it builds its subject with `Test.createTestingModule({ providers })` from `@nestjs/testing`, `.compile()` and `moduleRef.get(...)` (`spec-builds-with-testing-module`), never `new` on the service (`spec-no-new-subject`), no `imports` key and no `override*` (`spec-module-definition-only-providers`), no `jest.mock`/`doMock`/`unstable_mockModule`/`requireMock` of an own module or a library (`spec-no-module-mock`), no cast-laundering helper in a spec or fixture: a return-only generic, an `unknown` handed back as another type, `JSON.parse(JSON.stringify(x))`, `Object.assign(new X(), y)` returned as another type (`no-return-only-generic`); a provider `{ provide: TOKEN, useValue: X }` takes X from the matching `@starci/jest-preset` double, the token table being `ruleParams.be.specDoubles` of the slot manifest (`spec-infra-double-from-kit`); a unit spec asserts exact values, never `expect.any(String)`, `expect.any(Number)` or `expect.any(Date)` (`expect` being the jest global or the `@jest/globals` import): ids come from `fakeIds()` and dates from `FakeClock` (`spec-exact-values`); the EntityManager double is the kit's `mockEntityManager()`/`fakeTransaction()`, never ad hoc (`spec-typed-entity-manager`); test data goes through builders, see the **Test data builders** row |
72
71
  | **Test data builders** (R98 to R101) | Builders live only in `src/tests/fixtures/builders/<area>.builder.ts`: a module of the test tree that exports a function creating persisted rows through an EntityManager, DataSource or QueryRunner is a builder wherever it sits (`persisting-builder-in-builders-slot`, R98); a spec never runs a raw INSERT/UPDATE/DELETE or a direct write (`save`, `insert`, `upsert`, `update`, `delete`, `remove`) on a typeorm receiver and never builds the same `@Entity` class as an object literal twice (`spec-no-raw-insert`, `spec-no-repeated-row-literal`, R99); a builder never asserts and has deterministic defaults (`builder-arranges-only`, R101); nothing under `src/tests` disables or drops a constraint (`tests-keep-constraints`, R100) |
73
72
  | **CQRS** | A message extends `Command<R>` / `Query<R>` from `@nestjs/cqrs`, carries one `readonly params: ExecuteParams<X>` (no entity reachable from `X`), a handler extends `ICQRSHandler` and overrides `process`; a handler is thin: it injects only `*Service` classes and the Logger, and `process` is one `return this.<service>.<method>(...)` with no branch, loop, EntityManager or second call (`handler-is-thin`); no `*.use-case.ts`, no forwarder service, no `EventBus`, `@nestjs/event-emitter`, `EventEmitter` or RxJS `Subject` constructed or extended, and no class that stores callbacks other code registers (`handler-overrides-process`, `message-carries-params-only`, `message-typed-result`, `execute-params-shape`, `no-use-case`, `no-event-bus`) |
@@ -12,7 +12,9 @@
12
12
  * (a transport door answers to `class-validator`), never in a `dto/` folder, and a schema file does not also carry
13
13
  * `class-validator` or a GraphQL type.
14
14
  * - `schema-bounded` (R305) holds the cost. Every string, array, set, map and record a schema builds has an upper bound
15
- * (`.max(n)`, `.length(n)`, `.size(n)`, or for a record and a map a `.refine`/`.check` on its entry count), and `z.any()`,
15
+ * (`.max(n)`, `.length(n)`, `.size(n)`; a map a `.refine`/`.check` on its entry count; a record either that or a closed key set,
16
+ * `z.record(z.enum([...]), value)`, whose size is its keys' count and which is pure data: the nivoos package check refuses a
17
+ * `.refine` as code, so the enum key is the bound a package schema can state), and `z.any()`,
16
18
  * `z.unknown()` and `z.json()` are refused: an unbounded array whose elements all fail validation allocates an issue each
17
19
  * (GHSA-mrhx-c7xc-m3w5), and an unbounded string is an unbounded cost whatever the zod version.
18
20
  */
@@ -34,6 +36,10 @@ const ISO_STRINGY = new Set(["datetime", "date", "time", "duration"]);
34
36
  const COUNTED = new Set(["array", "set"]);
35
37
  /** Constructors whose entry count only a refinement can bound. */
36
38
  const REFINED = new Set(["record", "looseRecord", "partialRecord", "map"]);
39
+ /** The record constructors: an enum key closes their entry count. */
40
+ const RECORDS = new Set(["record", "looseRecord", "partialRecord"]);
41
+ /** The key constructor that closes a record's entry count. */
42
+ const CLOSED_KEY = "enum";
37
43
  /** Constructors that accept anything: refused outright. */
38
44
  const OPEN = new Set(["any", "unknown", "json"]);
39
45
  /** The chain members that bound a string or a counted container. */
@@ -96,7 +102,7 @@ export const schemaBounded = {
96
102
  messages: {
97
103
  string: "`z.{{name}}()` has no `.max(n)` or `.length(n)`, so a string of any length is accepted. Bound it: `z.{{name}}().max(200)`.",
98
104
  counted: "`z.{{name}}(...)` has no `.max(n)`, `.length(n)` or `.size(n)`, so a collection of any count is accepted (and every failing element allocates an issue). Bound it: `z.{{name}}(item).max(100)`.",
99
- refined: "`z.{{name}}(...)` has no bound on its entry count. Add `.refine((entries) => Object.keys(entries).length <= N)` (a `Map`: `.size`), or key it by a `z.enum` so its size is closed.",
105
+ refined: "`z.{{name}}(...)` has no bound on its entry count. Key it by a `z.enum` so its size is closed (the one bound a nivoos package schema can state: its check refuses a `.refine` as code), or add `.refine((entries) => Object.keys(entries).length <= N)` outside a package (a `Map`: `.size`).",
100
106
  open: "`z.{{name}}()` accepts any value, so nothing is validated. Describe the shape: an object of bounded fields, or a bounded union.",
101
107
  bound: "`.{{name}}()` here is no bound (a missing, non-positive or infinite argument). Give a finite positive count.",
102
108
  },
@@ -135,6 +141,9 @@ export const schemaBounded = {
135
141
  return;
136
142
  const chain = chainOf(node);
137
143
  if (kind === "refined") {
144
+ const key = node.arguments.length > 1 ? node.arguments[0] : undefined;
145
+ if (RECORDS.has(name) && key?.type === "CallExpression" && constructorOf(key.callee, namespaces, named) === CLOSED_KEY)
146
+ return;
138
147
  if (!chain.some((entry) => REFINING.has(entry.name)))
139
148
  context.report({ node, messageId: "refined", data: { name } });
140
149
  return;
@@ -13,8 +13,8 @@
13
13
  * - `require-enum-member-jsdoc` checks an adjacent non-empty description, never whether it states a
14
14
  * consequence. That half is read by a person, and the rule says so rather than pretending.
15
15
  * - `no-non-ascii-source` takes no exemption marker, so text a program depends on
16
- * lives in a message catalog (slot be.domain.messages, of any module tier, or be.feature.messages), the only place Vietnamese may appear (and, in a declared
17
- * nivoos package, the string and template literals that hold its business copy, lib/nivoos-profile.ts). Specs
16
+ * lives in a message catalog (slot be.domain.messages, of any module tier, or be.feature.messages), the only place Vietnamese may appear (a declared nivoos package
17
+ * is not judged by this rule at all: its business copy, comments included, is Vietnamese, lib/nivoos-profile.ts NIVOOS_RELAXED). Specs
18
18
  * and fixtures get no exemption.
19
19
  * - `no-restated-name-jsdoc` (law 7) holds the decidable slice of law 3 - a doc block whose only
20
20
  * content is the declared name re-spelled in words teaches nothing beyond the import line, so it
package/dist/comments.js CHANGED
@@ -13,8 +13,8 @@
13
13
  * - `require-enum-member-jsdoc` checks an adjacent non-empty description, never whether it states a
14
14
  * consequence. That half is read by a person, and the rule says so rather than pretending.
15
15
  * - `no-non-ascii-source` takes no exemption marker, so text a program depends on
16
- * lives in a message catalog (slot be.domain.messages, of any module tier, or be.feature.messages), the only place Vietnamese may appear (and, in a declared
17
- * nivoos package, the string and template literals that hold its business copy, lib/nivoos-profile.ts). Specs
16
+ * lives in a message catalog (slot be.domain.messages, of any module tier, or be.feature.messages), the only place Vietnamese may appear (a declared nivoos package
17
+ * is not judged by this rule at all: its business copy, comments included, is Vietnamese, lib/nivoos-profile.ts NIVOOS_RELAXED). Specs
18
18
  * and fixtures get no exemption.
19
19
  * - `no-restated-name-jsdoc` (law 7) holds the decidable slice of law 3 - a doc block whose only
20
20
  * content is the declared name re-spelled in words teaches nothing beyond the import line, so it
@@ -25,7 +25,6 @@
25
25
  */
26
26
  import { nameOrValue } from "./lib/ast.js";
27
27
  import { hfsOf } from "./lib/hfs.js";
28
- import { nivoosAuthored } from "./lib/nivoos-profile.js";
29
28
  import { normalizePath } from "./lib/path.js";
30
29
  import { hasSecondLanguage } from "@starci/hfs/runtime/scripts/lib/language.mjs";
31
30
  import { jsdocBefore, jsdocDescription } from "../runtime/scripts/lib/jsdoc.mjs";
@@ -82,26 +81,6 @@ const offenceIn = (line) => {
82
81
  return "an ornamental symbol";
83
82
  return null;
84
83
  };
85
- /**
86
- * The source text with the Vietnamese letters inside string and template literals replaced by `a`, so a line of it offends only with what is
87
- * outside a literal (a comment, an identifier) or with an emoji or an ornament anywhere.
88
- *
89
- * @param sourceCode - The linted file.
90
- * @returns The text, line breaks kept.
91
- */
92
- const withoutLiteralText = (sourceCode) => {
93
- const text = sourceCode.text;
94
- let out = "";
95
- let at = 0;
96
- for (const token of sourceCode.ast.tokens) {
97
- if (token.type !== "String" && token.type !== "Template")
98
- continue;
99
- out += text.slice(at, token.range[0]);
100
- out += Array.from(text.slice(token.range[0], token.range[1]).normalize("NFC"), (char) => (hasSecondLanguage(char) ? "a" : char)).join("");
101
- at = token.range[1];
102
- }
103
- return out + text.slice(at);
104
- };
105
84
  /**
106
85
  * Whether an exported declaration has a surface a caller documents: a data constant is already described by its name,
107
86
  * and a kind outside DOCUMENTED_KINDS has no surface at all.
@@ -305,12 +284,9 @@ export const noNonAsciiSource = {
305
284
  const slot = hfsOf(context).slotOf(context.filename);
306
285
  if (CATALOG_SLOTS.has(slot) || FIXTURE_SLOTS.has(slot))
307
286
  return {};
308
- // A declared nivoos package carries its business copy (titles, labels, prompts, guidance) in string and template literals: Vietnamese is accepted there and
309
- // nowhere else (a comment, an identifier), and an emoji or an ornament stays refused everywhere (lib/nivoos-profile.ts).
310
- const copyInLiterals = nivoosAuthored(context);
311
287
  return {
312
288
  "Program:exit"(node) {
313
- const lines = (copyInLiterals ? withoutLiteralText(sourceCode) : sourceCode.text).split(/\r\n|[\r\n\u2028\u2029]/u);
289
+ const lines = sourceCode.text.split(/\r\n|[\r\n\u2028\u2029]/u);
314
290
  for (const [index, line] of lines.entries()) {
315
291
  const offence = offenceIn(line);
316
292
  if (offence === null)
@@ -4,8 +4,8 @@
4
4
  * and the slot's `lintProfile: nivoos` is what puts its source under this profile: the profile is applied by the slot, never by a disable in the file.
5
5
  *
6
6
  * The profile keeps the whole canon and relaxes exactly what an SDK package cannot satisfy, each for a reason the real findings of a package showed (the
7
- * `nivo-web` package: 508 findings, of which these relaxations account for 412 and 96 are source to fix). Two rules narrow inside their own file
8
- * (`no-non-ascii-source` for string literals, `no-default-export` for the package entry); the rest is a rule the profile does not enable, in `NIVOOS_RELAXED`.
7
+ * `nivo-web` package: 508 findings, of which these relaxations account for 412 and 96 are source to fix). One rule narrows inside its own file
8
+ * (`no-default-export` for the package entry); the rest is a rule the profile does not enable, in `NIVOOS_RELAXED`.
9
9
  */
10
10
  import { normalizePath } from "./path.js";
11
11
  import { hfsOf } from "./hfs.js";
@@ -40,6 +40,7 @@ export const isNivoosEntry = (filename) => /\/packages\/[^/]+\/src\/[^/]+\.packa
40
40
  * reason is the finding: what the real package showed and why the rule's own purpose does not hold for SDK code.
41
41
  */
42
42
  export const NIVOOS_RELAXED = Object.freeze({
43
+ "starci-be/no-non-ascii-source": "A business package is written for a Vietnamese business: its titles, labels, prompts, guidance and brain documents are Vietnamese, and so are the comments that explain them to the people who own the business. The rule exists so source prose is English for a reader who does not share the author's language; the readers of this package do share it, so the rule is not applied to the package at all, comments included. Identifiers stay ASCII by the package convention (one class per node, named for its key) and the canon has no other rule to hold them to it. Owner direction 2026-11-18.",
43
44
  "starci-be/explicit-export-surface": "Its purpose is that importers read a file's declared types without inferring them and are not re-linted when it changes. Nothing imports a business package's source: the nivoos CLI loads the entry and writes the seed document, and the SDK's own interfaces (Node, NodeIf, NodeRun, Workspace, Package) type every member. The SDK idioms it refuses cannot be annotated at all: `export class X extends NodeRun(Cell)<typeof State>` (an extends clause with a call), an exported `z.strictObject(...)` schema the next line's `typeof` reads, `export default {...} satisfies Package`. 186 of 508 findings.",
44
45
  "starci-be/require-public-member-jsdoc": "The public members of a cell, step, agent or workspace class are the fields of the SDK interface it implements (key, version, title, input, output, reads, mutation, run, when, yes, no, next, into, label): the SDK documents them, and the class JSDoc (`require-export-jsdoc`, kept) says what this node is for. A sentence on each restates the interface. 152 of 508 findings.",
45
46
  "starci-be/job-shape": "The canon's `<step>.step.ts` is the jobs capability's file kind (`features/jobs/<job>/steps/`); the SDK's `.step.ts` is a workflow step (NodeRun, NodeIf) of the same suffix, and an SDK package has no jobs capability. 17 of 508 findings, all false positives of the shared suffix.",
@@ -8,6 +8,8 @@
8
8
  * the one composer, whose statements are the templates R68 checks; (3) a file `ruleParams.be.sqlPassThrough` or hfs.json
9
9
  * `sides.be.sqlPassThrough` lists with a reason, while its first argument is not a template literal or a `+` expression;
10
10
  * (4) the `*.spec.ts` beside such a file. `platform/database` has no blanket exemption.
11
+ * The nivoos SDK's typed object read is not SQL: `reach.objects(Type).query({ where, sort, limit })` is a call on the result of an
12
+ * `.objects(...)` call in a file that imports `@starci/nivoos-sdk`; it passes, and any other `.query(` in that file is still refused.
11
13
  * - `template`: a `sql` tagged template outside the world. `sqlFile`: a `*.sql.ts` file outside the world. `sqlTagImport`: an import
12
14
  * of `sql`, `ident`, `SqlText` or `SqlIdent` outside the world. The tag's own module (`platform/database/database.sql.ts`) is exempt.
13
15
  * - `worldCallHelper`, `worldTableWrite`: a `sql` template inside the world that only calls a listed function (it is
@@ -34,12 +36,19 @@ const COMPOSER_FILE = "database.client.ts";
34
36
  const TAG_FILE = "database.sql.ts";
35
37
  /** The names that carry SQL text: the tag, its identifier check and their brands. */
36
38
  const SQL_TEXT_NAMES = new Set(["sql", "ident", "SqlText", "SqlIdent"]);
39
+ /** The package of the nivoos SDK, whose `reach.objects(Type).query(...)` is a typed object read and runs no SQL. */
40
+ const NIVOOS_SDK = "@starci/nivoos-sdk";
41
+ /** The SDK door that hands out a typed object handle. */
42
+ const OBJECTS_DOOR = "objects";
37
43
  /** The suffix of a spec file. */
38
44
  const SPEC_SUFFIX = ".spec.ts";
39
45
  /** A statement that writes an application table: it goes through the entity or the area's builder. */
40
46
  const TABLE_WRITE = /^\s*(?:INSERT\s+INTO|UPDATE|DELETE\s+FROM)\s+(?:public|be_access)\./i;
41
47
  /** True when a builder's first argument can be an entity class: neither absent nor a string. */
42
48
  const namesEntity = (argument) => argument !== undefined && argument.type !== "TemplateLiteral" && !(argument.type === "Literal" && typeof argument.value === "string");
49
+ /** True when a `.query(` receiver is `<reach>.objects(Type)`, the SDK's typed object handle. */
50
+ const isObjectHandle = (receiver) => receiver.type === "CallExpression" && receiver.callee.type === "MemberExpression" && !receiver.callee.computed &&
51
+ receiver.callee.property.type === "Identifier" && receiver.callee.property.name === OBJECTS_DOOR;
43
52
  /** The text of a template literal, each substitution standing as `?`. */
44
53
  const templateText = (template) => template.quasis.map((quasi) => quasi.value.cooked ?? quasi.value.raw).join("?");
45
54
  /** The pattern of a statement that is only a call of one listed function: `SELECT [* FROM] <fn>(...) [AS x]`. */
@@ -78,12 +87,15 @@ export const noRawSql = {
78
87
  const passThrough = new Set((hfs.ruleParams.sqlPassThrough ?? []).map((entry) => entry.file));
79
88
  const passThroughSpec = relative.endsWith(SPEC_SUFFIX) && passThrough.has(`${relative.slice(0, -SPEC_SUFFIX.length)}.ts`);
80
89
  const callOnly = callPattern([...listed]);
90
+ let importsSdk = false;
81
91
  return {
82
92
  Program(node) {
83
93
  if (!inWorld && !isTagModule && relative.endsWith(".sql.ts"))
84
94
  context.report({ node, messageId: "sqlFile" });
85
95
  },
86
96
  ImportDeclaration(node) {
97
+ if (node.source.value === NIVOOS_SDK || node.source.value.startsWith(`${NIVOOS_SDK}/`))
98
+ importsSdk = true;
87
99
  if (inWorld || isTagModule)
88
100
  return;
89
101
  for (const specifier of node.specifiers) {
@@ -108,6 +120,8 @@ export const noRawSql = {
108
120
  if (method === "query") {
109
121
  if (inWorld || passThroughSpec)
110
122
  return;
123
+ if (importsSdk && isObjectHandle(callee.object))
124
+ return;
111
125
  const first = node.arguments[0];
112
126
  if (isComposer && first?.type === "TemplateLiteral")
113
127
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@starci/eslint-canon-be",
3
- "version": "3.27.1",
3
+ "version": "3.27.3",
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",
@@ -74,6 +74,6 @@
74
74
  "typescript": "^6.0.3"
75
75
  },
76
76
  "types": "./dist/index.d.ts",
77
- "gitHead": "49d93772597ef22ea73bece30b6258a1c94384cc",
78
- "starciSource": "edc86f0ddfffc6deb46654e3b5ed116d79173f9f98df54867d2ae7c1f530187f"
77
+ "gitHead": "5fb94d30387948cb258ca1742c533a14421f3bdc",
78
+ "starciSource": "96812461e9b9cfc4c1963daba1f85195ff48c2a6f108b871b4fc15f2aac37825"
79
79
  }