@webpieces/rules-config 0.4.818 → 0.4.819

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webpieces/rules-config",
3
- "version": "0.4.818",
3
+ "version": "0.4.819",
4
4
  "description": "Shared webpieces.config.json loader. Single source of truth for validation rule configuration consumed by @webpieces/ai-hook-rules, @webpieces/code-rules, and @webpieces/nx-webpieces-rules.",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -30,11 +30,13 @@ export declare class RequiredTypeSuffixEntry {
30
30
  * { "paths": ["libraries/browser-node/fs-*-model/**"], "suffixes": ["Fs"] }
31
31
  * ]
32
32
  *
33
- * OVERLAP — the MOST SPECIFIC entry wins; suffixes are never unioned. A file is governed by exactly one
34
- * entry: among the entries with a glob matching the file, the one whose matching glob has the longest
35
- * LITERAL PREFIX (the characters before its first `*`, `?`, `[` or `{`) wins; a tie goes to the glob with
36
- * more literal characters overall, then to the entry listed FIRST. So `libraries/apis/internal/**` beats
37
- * `libraries/apis/**` for `libraries/apis/internal/x/src/A.ts`, whatever order they are listed in.
33
+ * OVERLAP — the FIRST MATCH in `entries` order wins; suffixes are never unioned. A file is governed by
34
+ * exactly one entry: the entries are read top to bottom, and the first one with a glob matching the file
35
+ * decides its suffixes. ORDER MATTERS: a narrower entry must be listed BEFORE a broader one. With
36
+ * `libraries/apis/internal/**` listed above `libraries/apis/**`, the narrower entry governs
37
+ * `libraries/apis/internal/x/src/A.ts`; listed below it, the broader entry governs that file and the
38
+ * narrower one never applies there. A failure names the governing entry's glob, so a reader can see
39
+ * which entry won.
38
40
  *
39
41
  * `allowedPaths` exempts whole trees inside `paths`. The per-site escape hatch is
40
42
  * `// webpieces-disable required-type-suffix -- <reason>` on the declaration's line or the line above.
@@ -37,11 +37,13 @@ exports.RequiredTypeSuffixEntry = RequiredTypeSuffixEntry;
37
37
  * { "paths": ["libraries/browser-node/fs-*-model/**"], "suffixes": ["Fs"] }
38
38
  * ]
39
39
  *
40
- * OVERLAP — the MOST SPECIFIC entry wins; suffixes are never unioned. A file is governed by exactly one
41
- * entry: among the entries with a glob matching the file, the one whose matching glob has the longest
42
- * LITERAL PREFIX (the characters before its first `*`, `?`, `[` or `{`) wins; a tie goes to the glob with
43
- * more literal characters overall, then to the entry listed FIRST. So `libraries/apis/internal/**` beats
44
- * `libraries/apis/**` for `libraries/apis/internal/x/src/A.ts`, whatever order they are listed in.
40
+ * OVERLAP — the FIRST MATCH in `entries` order wins; suffixes are never unioned. A file is governed by
41
+ * exactly one entry: the entries are read top to bottom, and the first one with a glob matching the file
42
+ * decides its suffixes. ORDER MATTERS: a narrower entry must be listed BEFORE a broader one. With
43
+ * `libraries/apis/internal/**` listed above `libraries/apis/**`, the narrower entry governs
44
+ * `libraries/apis/internal/x/src/A.ts`; listed below it, the broader entry governs that file and the
45
+ * narrower one never applies there. A failure names the governing entry's glob, so a reader can see
46
+ * which entry won.
45
47
  *
46
48
  * `allowedPaths` exempts whole trees inside `paths`. The per-site escape hatch is
47
49
  * `// webpieces-disable required-type-suffix -- <reason>` on the declaration's line or the line above.
@@ -1 +1 @@
1
- {"version":3,"file":"required-type-suffix-config.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/required-type-suffix-config.ts"],"names":[],"mappings":";;;AAAA,2CAAoD;AACpD,iDAAyG;AAEzG;;;GAGG;AACH,MAAa,uBAAuB;IAChC,kFAAkF;IAClF,KAAK,CAAY;IACjB,sGAAsG;IACtG,QAAQ,CAAY;IAEpB,MAAM,CAAU,MAAM,GAAyC;QAC3D,KAAK,EAAE,oBAAQ,CAAC,eAAe,EAAE;QACjC,QAAQ,EAAE,oBAAQ,CAAC,eAAe,EAAE;KACvC,CAAC;;AATN,0DAUC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAa,wBAAyB,SAAQ,6BAAc;IAExD,OAAO,CAA6B;IACpC,YAAY,CAAY;IAExB,MAAM,CAAU,MAAM,GAA0C;QAC5D,IAAI,EAAE,IAAI,oBAAQ,CAAC,QAAQ,EAAE,kCAAmB,CAAC;QACjD,OAAO,EAAE,oBAAQ,CAAC,eAAe,CAAC,uBAAuB,CAAC,MAAM,CAAC;QACjE,YAAY,EAAE,oBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC3C,GAAG,+BAAgB;KACtB,CAAC;;AAVN,4DAWC","sourcesContent":["import { FieldDef, SchemaShape } from './field-def';\nimport { BaseRuleConfig, BASE_RULE_SCHEMA, ModifiedCodeMode, MODIFIED_CODE_MODES } from './rule-configs';\n\n/**\n * One `required-type-suffix` entry: the path globs it covers and the suffixes a type exported from a\n * file under them may end in. Data-only.\n */\nexport class RequiredTypeSuffixEntry {\n /** Workspace-relative globs, e.g. `[\"libraries/apis/internal/**\"]`. Non-empty. */\n paths!: string[];\n /** Case-sensitive name suffixes, e.g. `[\"Request\", \"Response\", \"Event\", \"Dto\", \"Api\"]`. Non-empty. */\n suffixes!: string[];\n\n static readonly SCHEMA: SchemaShape<RequiredTypeSuffixEntry> = {\n paths: FieldDef.nonEmptyStrings(),\n suffixes: FieldDef.nonEmptyStrings(),\n };\n}\n\n/**\n * `required-type-suffix` (#1037) — every EXPORTED `interface`, `class` (abstract too), `enum` and `type`\n * alias in a non-test `.ts` file under an entry's `paths` must end in one of that entry's `suffixes`\n * (plain, case-sensitive `endsWith`; the suffix alone is not a name). Why: the suffix tells a reader which\n * LAYER a type belongs to — a `…Dto` is on the wire, a `…Fs` is a Firestore document — where an\n * unsuffixed name reads the same as a server-internal or vendor type.\n *\n * Every field that decides behaviour is REQUIRED with no default (`.claude/rules/no-rule-defaults.md`):\n * - `mode` — OFF | NEW_AND_MODIFIED_CODE (only a type whose declaration line is new or changed — a new or\n * renamed type — so legacy names are grandfathered) | NEW_AND_MODIFIED_FILES (every exported type in a\n * changed file) | MODIFIED_PROJECTS / RUN_EVERY_TIME (every exported type in each touched project / the\n * whole repo — #1027).\n * - `entries` — non-empty; each entry has non-empty `paths` and `suffixes`. For example:\n *\n * \"entries\": [\n * { \"paths\": [\"libraries/apis/internal/**\"], \"suffixes\": [\"Request\", \"Response\", \"Event\", \"Dto\", \"Api\"] },\n * { \"paths\": [\"libraries/browser-node/fs-*-model/**\"], \"suffixes\": [\"Fs\"] }\n * ]\n *\n * OVERLAP — the MOST SPECIFIC entry wins; suffixes are never unioned. A file is governed by exactly one\n * entry: among the entries with a glob matching the file, the one whose matching glob has the longest\n * LITERAL PREFIX (the characters before its first `*`, `?`, `[` or `{`) wins; a tie goes to the glob with\n * more literal characters overall, then to the entry listed FIRST. So `libraries/apis/internal/**` beats\n * `libraries/apis/**` for `libraries/apis/internal/x/src/A.ts`, whatever order they are listed in.\n *\n * `allowedPaths` exempts whole trees inside `paths`. The per-site escape hatch is\n * `// webpieces-disable required-type-suffix -- <reason>` on the declaration's line or the line above.\n */\nexport class RequiredTypeSuffixConfig extends BaseRuleConfig {\n declare mode?: ModifiedCodeMode;\n entries!: RequiredTypeSuffixEntry[];\n allowedPaths?: string[];\n\n static readonly SCHEMA: SchemaShape<RequiredTypeSuffixConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n entries: FieldDef.nonEmptyObjects(RequiredTypeSuffixEntry.SCHEMA),\n allowedPaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n"]}
1
+ {"version":3,"file":"required-type-suffix-config.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/required-type-suffix-config.ts"],"names":[],"mappings":";;;AAAA,2CAAoD;AACpD,iDAAyG;AAEzG;;;GAGG;AACH,MAAa,uBAAuB;IAChC,kFAAkF;IAClF,KAAK,CAAY;IACjB,sGAAsG;IACtG,QAAQ,CAAY;IAEpB,MAAM,CAAU,MAAM,GAAyC;QAC3D,KAAK,EAAE,oBAAQ,CAAC,eAAe,EAAE;QACjC,QAAQ,EAAE,oBAAQ,CAAC,eAAe,EAAE;KACvC,CAAC;;AATN,0DAUC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAa,wBAAyB,SAAQ,6BAAc;IAExD,OAAO,CAA6B;IACpC,YAAY,CAAY;IAExB,MAAM,CAAU,MAAM,GAA0C;QAC5D,IAAI,EAAE,IAAI,oBAAQ,CAAC,QAAQ,EAAE,kCAAmB,CAAC;QACjD,OAAO,EAAE,oBAAQ,CAAC,eAAe,CAAC,uBAAuB,CAAC,MAAM,CAAC;QACjE,YAAY,EAAE,oBAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC3C,GAAG,+BAAgB;KACtB,CAAC;;AAVN,4DAWC","sourcesContent":["import { FieldDef, SchemaShape } from './field-def';\nimport { BaseRuleConfig, BASE_RULE_SCHEMA, ModifiedCodeMode, MODIFIED_CODE_MODES } from './rule-configs';\n\n/**\n * One `required-type-suffix` entry: the path globs it covers and the suffixes a type exported from a\n * file under them may end in. Data-only.\n */\nexport class RequiredTypeSuffixEntry {\n /** Workspace-relative globs, e.g. `[\"libraries/apis/internal/**\"]`. Non-empty. */\n paths!: string[];\n /** Case-sensitive name suffixes, e.g. `[\"Request\", \"Response\", \"Event\", \"Dto\", \"Api\"]`. Non-empty. */\n suffixes!: string[];\n\n static readonly SCHEMA: SchemaShape<RequiredTypeSuffixEntry> = {\n paths: FieldDef.nonEmptyStrings(),\n suffixes: FieldDef.nonEmptyStrings(),\n };\n}\n\n/**\n * `required-type-suffix` (#1037) — every EXPORTED `interface`, `class` (abstract too), `enum` and `type`\n * alias in a non-test `.ts` file under an entry's `paths` must end in one of that entry's `suffixes`\n * (plain, case-sensitive `endsWith`; the suffix alone is not a name). Why: the suffix tells a reader which\n * LAYER a type belongs to — a `…Dto` is on the wire, a `…Fs` is a Firestore document — where an\n * unsuffixed name reads the same as a server-internal or vendor type.\n *\n * Every field that decides behaviour is REQUIRED with no default (`.claude/rules/no-rule-defaults.md`):\n * - `mode` — OFF | NEW_AND_MODIFIED_CODE (only a type whose declaration line is new or changed — a new or\n * renamed type — so legacy names are grandfathered) | NEW_AND_MODIFIED_FILES (every exported type in a\n * changed file) | MODIFIED_PROJECTS / RUN_EVERY_TIME (every exported type in each touched project / the\n * whole repo — #1027).\n * - `entries` — non-empty; each entry has non-empty `paths` and `suffixes`. For example:\n *\n * \"entries\": [\n * { \"paths\": [\"libraries/apis/internal/**\"], \"suffixes\": [\"Request\", \"Response\", \"Event\", \"Dto\", \"Api\"] },\n * { \"paths\": [\"libraries/browser-node/fs-*-model/**\"], \"suffixes\": [\"Fs\"] }\n * ]\n *\n * OVERLAP — the FIRST MATCH in `entries` order wins; suffixes are never unioned. A file is governed by\n * exactly one entry: the entries are read top to bottom, and the first one with a glob matching the file\n * decides its suffixes. ORDER MATTERS: a narrower entry must be listed BEFORE a broader one. With\n * `libraries/apis/internal/**` listed above `libraries/apis/**`, the narrower entry governs\n * `libraries/apis/internal/x/src/A.ts`; listed below it, the broader entry governs that file and the\n * narrower one never applies there. A failure names the governing entry's glob, so a reader can see\n * which entry won.\n *\n * `allowedPaths` exempts whole trees inside `paths`. The per-site escape hatch is\n * `// webpieces-disable required-type-suffix -- <reason>` on the declaration's line or the line above.\n */\nexport class RequiredTypeSuffixConfig extends BaseRuleConfig {\n declare mode?: ModifiedCodeMode;\n entries!: RequiredTypeSuffixEntry[];\n allowedPaths?: string[];\n\n static readonly SCHEMA: SchemaShape<RequiredTypeSuffixConfig> = {\n mode: new FieldDef('string', MODIFIED_CODE_MODES),\n entries: FieldDef.nonEmptyObjects(RequiredTypeSuffixEntry.SCHEMA),\n allowedPaths: FieldDef.optional('string[]'),\n ...BASE_RULE_SCHEMA,\n };\n}\n"]}