@starci/eslint-canon-be 3.27.0 → 3.27.1
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 +4 -0
- package/README.md +13 -0
- package/dist/comments.d.ts +2 -1
- package/dist/comments.js +27 -2
- package/dist/lib/config.d.ts +2 -1
- package/dist/lib/config.js +13 -3
- package/dist/lib/hfs-view.d.ts +4 -0
- package/dist/lib/nivoos-profile.d.ts +40 -0
- package/dist/lib/nivoos-profile.js +54 -0
- package/dist/naming.js +6 -3
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.27.1 - 2026-11-18
|
|
4
|
+
|
|
5
|
+
- 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.
|
|
6
|
+
|
|
3
7
|
## 3.27.0 - 2026-11-14
|
|
4
8
|
|
|
5
9
|
- Changed: cut with `@starci/hfs` 6.13.0 (peer line); requires `@starci/hfs` `~6.13.0`. No rule changes.
|
package/README.md
CHANGED
|
@@ -31,6 +31,19 @@ longer holds is deleted from the plugin; every rule that ships is on.
|
|
|
31
31
|
|
|
32
32
|
Also exported: `rules`, `ruleOwners`, `lawOwners`, `ruleDeclarations`, `recommended`, `linterOptions`.
|
|
33
33
|
|
|
34
|
+
## A business package: the SDK authoring profile
|
|
35
|
+
|
|
36
|
+
A package authored with the nivoos SDK (agents, workflows, cells, steps, brain, accounts, seed) is declared in `hfs.json` `sides.nivoos.packages`; its folder is then the slot `app.nivoos-package`
|
|
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
|
+
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
|
+
|
|
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
|
+
- `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
|
|
43
|
+
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
|
+
|
|
45
|
+
[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`.
|
|
46
|
+
|
|
34
47
|
## What it actually catches
|
|
35
48
|
|
|
36
49
|
A sample, not the list:
|
package/dist/comments.d.ts
CHANGED
|
@@ -13,7 +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
|
|
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
|
|
17
18
|
* and fixtures get no exemption.
|
|
18
19
|
* - `no-restated-name-jsdoc` (law 7) holds the decidable slice of law 3 - a doc block whose only
|
|
19
20
|
* content is the declared name re-spelled in words teaches nothing beyond the import line, so it
|
package/dist/comments.js
CHANGED
|
@@ -13,7 +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
|
|
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
|
|
17
18
|
* and fixtures get no exemption.
|
|
18
19
|
* - `no-restated-name-jsdoc` (law 7) holds the decidable slice of law 3 - a doc block whose only
|
|
19
20
|
* content is the declared name re-spelled in words teaches nothing beyond the import line, so it
|
|
@@ -24,6 +25,7 @@
|
|
|
24
25
|
*/
|
|
25
26
|
import { nameOrValue } from "./lib/ast.js";
|
|
26
27
|
import { hfsOf } from "./lib/hfs.js";
|
|
28
|
+
import { nivoosAuthored } from "./lib/nivoos-profile.js";
|
|
27
29
|
import { normalizePath } from "./lib/path.js";
|
|
28
30
|
import { hasSecondLanguage } from "@starci/hfs/runtime/scripts/lib/language.mjs";
|
|
29
31
|
import { jsdocBefore, jsdocDescription } from "../runtime/scripts/lib/jsdoc.mjs";
|
|
@@ -80,6 +82,26 @@ const offenceIn = (line) => {
|
|
|
80
82
|
return "an ornamental symbol";
|
|
81
83
|
return null;
|
|
82
84
|
};
|
|
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
|
+
};
|
|
83
105
|
/**
|
|
84
106
|
* Whether an exported declaration has a surface a caller documents: a data constant is already described by its name,
|
|
85
107
|
* and a kind outside DOCUMENTED_KINDS has no surface at all.
|
|
@@ -283,9 +305,12 @@ export const noNonAsciiSource = {
|
|
|
283
305
|
const slot = hfsOf(context).slotOf(context.filename);
|
|
284
306
|
if (CATALOG_SLOTS.has(slot) || FIXTURE_SLOTS.has(slot))
|
|
285
307
|
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);
|
|
286
311
|
return {
|
|
287
312
|
"Program:exit"(node) {
|
|
288
|
-
const lines = sourceCode.
|
|
313
|
+
const lines = (copyInLiterals ? withoutLiteralText(sourceCode) : sourceCode.text).split(/\r\n|[\r\n\u2028\u2029]/u);
|
|
289
314
|
for (const [index, line] of lines.entries()) {
|
|
290
315
|
const offence = offenceIn(line);
|
|
291
316
|
if (offence === null)
|
package/dist/lib/config.d.ts
CHANGED
|
@@ -47,7 +47,8 @@ export declare const PACKAGE_IGNORED: readonly string[];
|
|
|
47
47
|
* `packages/<pkg>/src/**`. Which files are the front end's is the project's declaration, never a folder name this canon knows: a slot of
|
|
48
48
|
* `ext/manifest.json` `packages` with `lint: "fe"` is left to the front-end canon, and the first slot that holds a file decides
|
|
49
49
|
* (`hfs.packageLint`, PROJECT-LINT-3), so a back-end slot declared before a front-end slot it lies in stays back end. A package the project
|
|
50
|
-
* does not declare is back end whole. It is the very rule set of the be side, over the package view of the app root (`loadPackagesHfs`).
|
|
50
|
+
* does not declare is back end whole. It is the very rule set of the be side, over the package view of the app root (`loadPackagesHfs`). A nivoos package the project
|
|
51
|
+
* declares (`hfs.packageLint.nivoos`) is judged by the SDK authoring profile, which keeps the rule set but the rules lib/nivoos-profile.ts relaxes, each with its reason.
|
|
51
52
|
*
|
|
52
53
|
* @param {object} input - The attachment options of `buildBeConfig`.
|
|
53
54
|
* @returns {Promise<Array<object>>} The flat config: one ignore block and the rule and Sonar way blocks over the package files.
|
package/dist/lib/config.js
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
import tsParser from "@typescript-eslint/parser";
|
|
20
20
|
import { OUTSIDE_THE_SCAN_FILES } from "../../runtime/scripts/lib/sonar-syntax-rules.mjs";
|
|
21
21
|
import { sonarWayRules, sonarWayTestRules } from "../../runtime/scripts/lib/sonar-way.mjs";
|
|
22
|
+
import { withoutRelaxed } from "./nivoos-profile.js";
|
|
22
23
|
/** A disable directive is a weakening of lint, and one that suppresses nothing is dead weight. */
|
|
23
24
|
export const linterOptions = Object.freeze({ noInlineConfig: true, reportUnusedDisableDirectives: "error" });
|
|
24
25
|
/** Every tracked source a back end holds; the factory lints them all. */
|
|
@@ -113,23 +114,32 @@ export const PACKAGE_IGNORED = Object.freeze(["**/dist/**", "**/coverage/**", "*
|
|
|
113
114
|
* `packages/<pkg>/src/**`. Which files are the front end's is the project's declaration, never a folder name this canon knows: a slot of
|
|
114
115
|
* `ext/manifest.json` `packages` with `lint: "fe"` is left to the front-end canon, and the first slot that holds a file decides
|
|
115
116
|
* (`hfs.packageLint`, PROJECT-LINT-3), so a back-end slot declared before a front-end slot it lies in stays back end. A package the project
|
|
116
|
-
* does not declare is back end whole. It is the very rule set of the be side, over the package view of the app root (`loadPackagesHfs`).
|
|
117
|
+
* does not declare is back end whole. It is the very rule set of the be side, over the package view of the app root (`loadPackagesHfs`). A nivoos package the project
|
|
118
|
+
* declares (`hfs.packageLint.nivoos`) is judged by the SDK authoring profile, which keeps the rule set but the rules lib/nivoos-profile.ts relaxes, each with its reason.
|
|
117
119
|
*
|
|
118
120
|
* @param {object} input - The attachment options of `buildBeConfig`.
|
|
119
121
|
* @returns {Promise<Array<object>>} The flat config: one ignore block and the rule and Sonar way blocks over the package files.
|
|
120
122
|
*/
|
|
121
123
|
export const buildBePackagesConfig = async (input) => {
|
|
122
124
|
const [, ...blocks] = await buildBeConfig(input);
|
|
123
|
-
const lint = input.hfs?.packageLint ?? { frontEnd: [], fe: [], be: [] };
|
|
125
|
+
const lint = input.hfs?.packageLint ?? { frontEnd: [], fe: [], be: [], nivoos: [] };
|
|
126
|
+
const nivoos = lint.nivoos ?? [];
|
|
127
|
+
// The nivoos packages the project declares (slot app.nivoos-package, `lintProfile: nivoos`) are judged by the SDK authoring profile instead: the same blocks over their source with the
|
|
128
|
+
// recommendation less the rules the profile relaxes (lib/nivoos-profile.ts). Every other package file keeps the back end's canon, and the nivoos source is left out of it.
|
|
129
|
+
const profiled = nivoos.length === 0 ? [] : (await buildBeConfig({ ...input, recommended: withoutRelaxed(input.recommended ?? {}) })).slice(1);
|
|
124
130
|
return [
|
|
125
131
|
{ ignores: [...PACKAGE_IGNORED] },
|
|
126
132
|
...blocks.flatMap((block) => {
|
|
127
133
|
const tests = block.name === TEST_SCOPE_BLOCK;
|
|
128
134
|
return [
|
|
129
|
-
{ ...block, files: [...(tests ? PACKAGE_SPEC_FILES : PACKAGE_SOURCE_FILES)], ignores: [...(block.ignores ?? []), ...lint.frontEnd] },
|
|
135
|
+
{ ...block, files: [...(tests ? PACKAGE_SPEC_FILES : PACKAGE_SOURCE_FILES)], ignores: [...(block.ignores ?? []), ...lint.frontEnd, ...nivoos] },
|
|
130
136
|
// A back-end slot declared before a front-end slot that reaches it: its files, less the front-end slots declared before it.
|
|
131
137
|
...lint.be.map((scope) => ({ ...block, files: [[scope.files, tests ? SCRIPT_SPEC : SCRIPT]], ignores: [...(block.ignores ?? []), ...scope.ignores] })),
|
|
132
138
|
];
|
|
133
139
|
}),
|
|
140
|
+
...profiled.flatMap((block) => {
|
|
141
|
+
const tests = block.name === TEST_SCOPE_BLOCK;
|
|
142
|
+
return nivoos.map((glob) => ({ ...block, files: [[glob, tests ? SCRIPT_SPEC : SCRIPT]] }));
|
|
143
|
+
}),
|
|
134
144
|
];
|
|
135
145
|
};
|
package/dist/lib/hfs-view.d.ts
CHANGED
|
@@ -63,6 +63,8 @@ export interface HfsSlot {
|
|
|
63
63
|
readonly role?: string;
|
|
64
64
|
/** The side-relative path patterns of the only files that may import this file by deep path. */
|
|
65
65
|
readonly importedBy?: readonly string[];
|
|
66
|
+
/** The lint profile the slot hands the canon (`nivoos`: the SDK authoring profile of a declared nivoos package). */
|
|
67
|
+
readonly lintProfile?: string;
|
|
66
68
|
}
|
|
67
69
|
/** A unit-tested role (`ruleParams.be.unitRoles`). */
|
|
68
70
|
export interface HfsUnitRole {
|
|
@@ -184,6 +186,8 @@ export interface HfsPackageLint {
|
|
|
184
186
|
readonly frontEnd: readonly string[];
|
|
185
187
|
readonly fe: readonly HfsPackageLintScope[];
|
|
186
188
|
readonly be: readonly HfsPackageLintScope[];
|
|
189
|
+
/** The source globs (`packages/<name>/src/**`) of the nivoos packages the project declares, judged by the SDK authoring profile. */
|
|
190
|
+
readonly nivoos?: readonly string[];
|
|
187
191
|
}
|
|
188
192
|
/** A type a root package declares: its name and the app-root relative file that declares it. */
|
|
189
193
|
export interface HfsPackageDeclaredType {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { HfsView } from "./hfs-view.js";
|
|
2
|
+
import type { Context } from "./rule.js";
|
|
3
|
+
/** The slot of a declared nivoos package folder. */
|
|
4
|
+
export declare const NIVOOS_SLOT = "app.nivoos-package";
|
|
5
|
+
/** The profile name the slot's `lintProfile` carries. */
|
|
6
|
+
export declare const NIVOOS_PROFILE = "nivoos";
|
|
7
|
+
/**
|
|
8
|
+
* Whether `filename` is source of a declared nivoos package: the slot owns it and hands it the SDK authoring profile.
|
|
9
|
+
*
|
|
10
|
+
* @param hfs - The HFS view of the root packages.
|
|
11
|
+
* @param filename - The linted file.
|
|
12
|
+
* @returns True when the profile applies.
|
|
13
|
+
*/
|
|
14
|
+
export declare const isNivoosAuthored: (hfs: HfsView, filename: string) => boolean;
|
|
15
|
+
/**
|
|
16
|
+
* The same question from inside a rule: is the file being linted source of a declared nivoos package.
|
|
17
|
+
*
|
|
18
|
+
* @param context - The rule context.
|
|
19
|
+
* @returns True when the profile applies.
|
|
20
|
+
*/
|
|
21
|
+
export declare const nivoosAuthored: (context: Context) => boolean;
|
|
22
|
+
/**
|
|
23
|
+
* The package entry the SDK loads by its default export: `packages/<name>/src/<name>.package.ts` (`export default { package, cells, workspaces } satisfies Package`).
|
|
24
|
+
*
|
|
25
|
+
* @param filename - The linted file.
|
|
26
|
+
* @returns True for an entry file.
|
|
27
|
+
*/
|
|
28
|
+
export declare const isNivoosEntry: (filename: string) => boolean;
|
|
29
|
+
/**
|
|
30
|
+
* The rules a nivoos package is not judged by, each with the reason. A rule is dropped for the slot's files only (the same rule stays on everywhere else), and the
|
|
31
|
+
* reason is the finding: what the real package showed and why the rule's own purpose does not hold for SDK code.
|
|
32
|
+
*/
|
|
33
|
+
export declare const NIVOOS_RELAXED: Readonly<Record<string, string>>;
|
|
34
|
+
/**
|
|
35
|
+
* The rule levels of a nivoos package: the recommendation less the relaxed rules.
|
|
36
|
+
*
|
|
37
|
+
* @param recommended - The canon levels of the root packages.
|
|
38
|
+
* @returns The same levels without the rules of `NIVOOS_RELAXED`.
|
|
39
|
+
*/
|
|
40
|
+
export declare const withoutRelaxed: <Level>(recommended: Readonly<Record<string, Level>>) => Record<string, Level>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The SDK authoring lint profile: what the canon judges differently in a nivoos package, a business package authored with the nivoos SDK (agents, workflows,
|
|
3
|
+
* cells, steps, brain, accounts, seed). The project declares the package in `hfs.json` `sides.nivoos.packages`; its folder is then the slot `app.nivoos-package`,
|
|
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
|
+
*
|
|
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`.
|
|
9
|
+
*/
|
|
10
|
+
import { normalizePath } from "./path.js";
|
|
11
|
+
import { hfsOf } from "./hfs.js";
|
|
12
|
+
/** The slot of a declared nivoos package folder. */
|
|
13
|
+
export const NIVOOS_SLOT = "app.nivoos-package";
|
|
14
|
+
/** The profile name the slot's `lintProfile` carries. */
|
|
15
|
+
export const NIVOOS_PROFILE = "nivoos";
|
|
16
|
+
/**
|
|
17
|
+
* Whether `filename` is source of a declared nivoos package: the slot owns it and hands it the SDK authoring profile.
|
|
18
|
+
*
|
|
19
|
+
* @param hfs - The HFS view of the root packages.
|
|
20
|
+
* @param filename - The linted file.
|
|
21
|
+
* @returns True when the profile applies.
|
|
22
|
+
*/
|
|
23
|
+
export const isNivoosAuthored = (hfs, filename) => hfs.slotOf(filename) === NIVOOS_SLOT && hfs.slot(NIVOOS_SLOT)?.lintProfile === NIVOOS_PROFILE;
|
|
24
|
+
/**
|
|
25
|
+
* The same question from inside a rule: is the file being linted source of a declared nivoos package.
|
|
26
|
+
*
|
|
27
|
+
* @param context - The rule context.
|
|
28
|
+
* @returns True when the profile applies.
|
|
29
|
+
*/
|
|
30
|
+
export const nivoosAuthored = (context) => isNivoosAuthored(hfsOf(context), context.filename);
|
|
31
|
+
/**
|
|
32
|
+
* The package entry the SDK loads by its default export: `packages/<name>/src/<name>.package.ts` (`export default { package, cells, workspaces } satisfies Package`).
|
|
33
|
+
*
|
|
34
|
+
* @param filename - The linted file.
|
|
35
|
+
* @returns True for an entry file.
|
|
36
|
+
*/
|
|
37
|
+
export const isNivoosEntry = (filename) => /\/packages\/[^/]+\/src\/[^/]+\.package\.ts$/.test(`/${normalizePath(filename).replace(/^\//, "")}`);
|
|
38
|
+
/**
|
|
39
|
+
* The rules a nivoos package is not judged by, each with the reason. A rule is dropped for the slot's files only (the same rule stays on everywhere else), and the
|
|
40
|
+
* reason is the finding: what the real package showed and why the rule's own purpose does not hold for SDK code.
|
|
41
|
+
*/
|
|
42
|
+
export const NIVOOS_RELAXED = Object.freeze({
|
|
43
|
+
"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
|
+
"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
|
+
"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.",
|
|
46
|
+
"starci-be/throw-domain-error": "The failure contract of an SDK node is a thrown Error whose message starts with a snake_case code (`front_door_cannot_answer: ...`) that the platform records on the run; `DomainError` of @starci/common is not a dependency of an SDK package, which authors against the SDK alone. 10 of 508 findings.",
|
|
47
|
+
});
|
|
48
|
+
/**
|
|
49
|
+
* The rule levels of a nivoos package: the recommendation less the relaxed rules.
|
|
50
|
+
*
|
|
51
|
+
* @param recommended - The canon levels of the root packages.
|
|
52
|
+
* @returns The same levels without the rules of `NIVOOS_RELAXED`.
|
|
53
|
+
*/
|
|
54
|
+
export const withoutRelaxed = (recommended) => Object.fromEntries(Object.entries(recommended).filter(([name]) => !(name in NIVOOS_RELAXED)));
|
package/dist/naming.js
CHANGED
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
* that. Those are read by a person, which is why the law states them with the scars attached.
|
|
31
31
|
*/
|
|
32
32
|
import { hfsOf, inTestWorld } from "./lib/hfs.js";
|
|
33
|
+
import { isNivoosEntry, nivoosAuthored } from "./lib/nivoos-profile.js";
|
|
33
34
|
import { normalizePath } from "./lib/path.js";
|
|
34
35
|
/** A schema generation baked into an identifier. */
|
|
35
36
|
const VERSIONED_NAME = /(?:^|[a-z])V[0-9]+(?:$|[A-Z_])|_V[0-9]+/;
|
|
@@ -198,8 +199,10 @@ export const noBareVerbExport = {
|
|
|
198
199
|
},
|
|
199
200
|
};
|
|
200
201
|
// -- no-default-export -------------------------------------------------------------------------------------------
|
|
201
|
-
/**
|
|
202
|
+
/** A file kind that may default-export: a Jest global setup, whose API is a default function. */
|
|
202
203
|
const isGlobalSetup = (context) => inTestWorld(hfsOf(context), context.filename) && /\/global-(?:setup|teardown)\.ts$/.test(normalizePath(context.filename));
|
|
204
|
+
/** The other file kind that may default-export: the entry of a declared nivoos package (`src/<name>.package.ts`), which the SDK loads by its default export (lib/nivoos-profile.ts). */
|
|
205
|
+
const isNivoosPackageEntry = (context) => nivoosAuthored(context) && isNivoosEntry(context.filename);
|
|
203
206
|
/** Named exports only: a default export has no name to grep, rename or import-check. */
|
|
204
207
|
export const noDefaultExport = {
|
|
205
208
|
meta: {
|
|
@@ -207,13 +210,13 @@ export const noDefaultExport = {
|
|
|
207
210
|
docs: { description: "TypeScript source uses named exports only; the Jest global setup is the one exception." },
|
|
208
211
|
schema: [],
|
|
209
212
|
messages: {
|
|
210
|
-
default: "A default export has no name of its own: every importer picks one, renames and greps stop working, and the file cannot be found by what it exports. Use a named export. (The only default
|
|
213
|
+
default: "A default export has no name of its own: every importer picks one, renames and greps stop working, and the file cannot be found by what it exports. Use a named export. (The only default exports are the Jest `global-setup.ts`/`global-teardown.ts` of the e2e world and the entry of a nivoos package, whose APIs require it.)",
|
|
211
214
|
},
|
|
212
215
|
},
|
|
213
216
|
create(context) {
|
|
214
217
|
if (!/\.[cm]?ts$/.test(normalizePath(context.filename)))
|
|
215
218
|
return {};
|
|
216
|
-
if (isGlobalSetup(context))
|
|
219
|
+
if (isGlobalSetup(context) || isNivoosPackageEntry(context))
|
|
217
220
|
return {};
|
|
218
221
|
const isDefault = (name) => name && ((name.type === "Identifier" && name.name === "default") || (name.type === "Literal" && name.value === "default"));
|
|
219
222
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@starci/eslint-canon-be",
|
|
3
|
-
"version": "3.27.
|
|
3
|
+
"version": "3.27.1",
|
|
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": "
|
|
78
|
-
"starciSource": "
|
|
77
|
+
"gitHead": "49d93772597ef22ea73bece30b6258a1c94384cc",
|
|
78
|
+
"starciSource": "edc86f0ddfffc6deb46654e3b5ed116d79173f9f98df54867d2ae7c1f530187f"
|
|
79
79
|
}
|