@yahoo/uds-create-config 5.86.0 → 5.87.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.
@@ -62,11 +62,15 @@ declare const ReactNativeSystemDefinition: ConfigClass<{
62
62
  port: _$zod.ZodOptional<_$zod.ZodNumber>;
63
63
  }, _$zod_v4_core0.$strict>>;
64
64
  lint: _$zod.ZodOptional<_$zod.ZodObject<{
65
- rules: _$zod.ZodOptional<_$zod.ZodRecord<_$zod.ZodString, _$zod.ZodEnum<{
65
+ rules: _$zod.ZodOptional<_$zod.ZodRecord<_$zod.ZodString, _$zod.ZodUnion<readonly [_$zod.ZodEnum<{
66
66
  error: "error";
67
67
  off: "off";
68
68
  warn: "warn";
69
- }>>>;
69
+ }>, _$zod.ZodRecord<_$zod.ZodString, _$zod.ZodEnum<{
70
+ error: "error";
71
+ off: "off";
72
+ warn: "warn";
73
+ }>>]>>>;
70
74
  ignore: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodObject<{
71
75
  rule: _$zod.ZodString;
72
76
  component: _$zod.ZodOptional<_$zod.ZodString>;
@@ -44,6 +44,7 @@ import { sourcesStoredMigration } from "../migrations/20261105185042_sources_sto
44
44
  import { modifierClassPrefixMigration } from "../migrations/20261106185419_modifier_class_prefix.js";
45
45
  import { componentGetDetailMigration } from "../migrations/20261107213031_component_get_detail.js";
46
46
  import { tokenGetDetailMigration } from "../migrations/20261108042210_token_get_detail.js";
47
+ import { lintRulesByGroupMigration } from "../migrations/20261109144822_lint_rules_by_group.js";
47
48
  import { CanvasRole } from "../entities/system/CanvasRole.js";
48
49
  import { GlobalStyle } from "../entities/system/GlobalStyle.js";
49
50
  import { Guidance } from "../entities/system/Guidance.js";
@@ -224,5 +225,6 @@ if (!registeredSchemaMigrations().has(20261105185042)) registerSchemaMigrations(
224
225
  if (!registeredSchemaMigrations().has(20261106185419)) registerSchemaMigrations(modifierClassPrefixMigration);
225
226
  if (!registeredSchemaMigrations().has(20261107213031)) registerSchemaMigrations(componentGetDetailMigration);
226
227
  if (!registeredSchemaMigrations().has(20261108042210)) registerSchemaMigrations(tokenGetDetailMigration);
228
+ if (!registeredSchemaMigrations().has(20261109144822)) registerSchemaMigrations(lintRulesByGroupMigration);
227
229
  //#endregion
228
230
  export { System };
@@ -51,11 +51,15 @@ declare const NativeSettings: EntityClass<z.ZodObject<Omit<{
51
51
  port: z.ZodOptional<z.ZodNumber>;
52
52
  }, z.core.$strict>>;
53
53
  lint: z.ZodOptional<z.ZodObject<{
54
- rules: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
54
+ rules: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodEnum<{
55
55
  error: "error";
56
56
  off: "off";
57
57
  warn: "warn";
58
- }>>>;
58
+ }>, z.ZodRecord<z.ZodString, z.ZodEnum<{
59
+ error: "error";
60
+ off: "off";
61
+ warn: "warn";
62
+ }>>]>>>;
59
63
  ignore: z.ZodOptional<z.ZodArray<z.ZodObject<{
60
64
  rule: z.ZodString;
61
65
  component: z.ZodOptional<z.ZodString>;
@@ -105,11 +105,15 @@ interface PlaygroundSectionClass extends Named<typeof PlaygroundSectionDefinitio
105
105
  declare const PlaygroundSection: PlaygroundSectionClass;
106
106
  /** The `lint` section — the authoring lint `uds lint` runs. */
107
107
  declare const LintSectionDefinition: SubEntityClass<z.ZodObject<{
108
- rules: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
108
+ rules: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodEnum<{
109
109
  error: "error";
110
110
  off: "off";
111
111
  warn: "warn";
112
- }>>>;
112
+ }>, z.ZodRecord<z.ZodString, z.ZodEnum<{
113
+ error: "error";
114
+ off: "off";
115
+ warn: "warn";
116
+ }>>]>>>;
113
117
  ignore: z.ZodOptional<z.ZodArray<z.ZodObject<{
114
118
  rule: z.ZodString;
115
119
  component: z.ZodOptional<z.ZodString>;
@@ -215,11 +219,15 @@ declare const SettingsDefinition: EntityClass<z.ZodObject<{
215
219
  port: z.ZodOptional<z.ZodNumber>;
216
220
  }, z.core.$strict>>;
217
221
  lint: z.ZodOptional<z.ZodObject<{
218
- rules: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
222
+ rules: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodEnum<{
223
+ error: "error";
224
+ off: "off";
225
+ warn: "warn";
226
+ }>, z.ZodRecord<z.ZodString, z.ZodEnum<{
219
227
  error: "error";
220
228
  off: "off";
221
229
  warn: "warn";
222
- }>>>;
230
+ }>>]>>>;
223
231
  ignore: z.ZodOptional<z.ZodArray<z.ZodObject<{
224
232
  rule: z.ZodString;
225
233
  component: z.ZodOptional<z.ZodString>;
@@ -182,21 +182,24 @@ const PlaygroundSection = defineSubEntity({
182
182
  singleton: true,
183
183
  fields: playgroundFields
184
184
  });
185
+ const lintSeverity = z.enum([
186
+ "off",
187
+ "warn",
188
+ "error"
189
+ ]);
185
190
  const lintFields = z.strictObject({
186
191
  /**
187
- * How loud each authoring lint rule is, by rule or by group — `{ editability: 'off',
188
- * 'inline-style-on-layer': 'error' }`. A rule's own entry wins over its group's; a rule named
189
- * neither way takes its default, a warning for most. A group never turns on a rule that is off by
190
- * default. Keyed by name rather than an enum, so a rule the build adds later needs no new schema; a
191
- * name that is no rule or group is reported, not refused.
192
+ * How loud each authoring lint rule is, by group and by rule inside it, the way Biome nests rules:
193
+ * `{ editability: 'off', portability: { all: 'error', 'inline-style-on-layer': 'warn' } }`. A
194
+ * rule's own entry wins over its group's; a rule named neither way takes its default, a warning
195
+ * for most. A group never turns on a rule that is off by default. A rule's flat name at the top
196
+ * level (`'inline-style-on-layer': 'warn'`) is read too. Keyed by name rather than an enum, so a
197
+ * rule the build adds later needs no new schema; a name that is no rule or group is reported, not
198
+ * refused.
192
199
  */
193
- rules: z.record(z.string(), z.enum([
194
- "off",
195
- "warn",
196
- "error"
197
- ])).meta({
200
+ rules: z.record(z.string(), z.union([lintSeverity, z.record(z.string(), lintSeverity)])).meta({
198
201
  title: "Rules",
199
- description: "A severity — `'off'`, `'warn'` or `'error'` — per authoring lint rule or per group of them (`portability`, `editability`, `maintainability`, `compatibility`, `nursery`): `{ editability: 'off' }` for a system only edited in its source, never through Create or the MCP tools. A `nursery` rule runs only when named on its own. A rule's own entry wins over its group's. Unset, most rules warn. An `'error'` makes `uds lint` exit with status 1, so a CI step that runs it fails. One site is quieted with `// uds-lint-ignore <rule>: <why>` on its line or the line above."
202
+ description: "A severity — `'off'`, `'warn'` or `'error'` — per group of authoring lint rules (`portability`, `editability`, `maintainability`, `design`, `compatibility`, `nursery`), or an object per group with `all` for the group and an entry per rule in it: `{ editability: 'off', portability: { all: 'error', 'inline-style-on-layer': 'warn' } }`. A rule's own entry wins over its group's, and a rule's flat name at the top level is read too. A `nursery` rule runs only when named on its own. Unset, most rules warn. An `'error'` makes `uds lint` exit with status 1, so a CI step that runs it fails. One site is quieted with `// uds-lint-ignore <rule>: <why>` on its line or the line above."
200
203
  }).optional(),
201
204
  /**
202
205
  * Findings the system has decided to keep, each with why: Create's "Ignore", and the config-side
@@ -74,7 +74,7 @@ interface RecordedSource {
74
74
  * The dense-counter `2` a short-lived scheme stamped before the chain existed reads as the mint
75
75
  * that replaced it (see `detectedWireVersion`).
76
76
  */
77
- declare const SERIALIZED_CONFIG_VERSION = 20261108042210;
77
+ declare const SERIALIZED_CONFIG_VERSION = 20261109144822;
78
78
  interface SerializedConfig {
79
79
  /** See {@link SERIALIZED_CONFIG_VERSION}. Always written; a stored artifact may lack it. */
80
80
  readonly version: number;
@@ -6535,7 +6535,7 @@ var Config = class Config {
6535
6535
  * links from the provided sources. A declared `linkedKind` with no provided source throws. */
6536
6536
  hydrateFrom(stored, options) {
6537
6537
  const claimed = schemaVersionOf(stored);
6538
- if (claimed > 20261108042210) throw new SchemaVersionTooNew(claimed);
6538
+ if (claimed > 20261109144822) throw new SchemaVersionTooNew(claimed);
6539
6539
  const wire = upgradeSerializedConfig(stored);
6540
6540
  if (!Array.isArray(wire.ownedKinds) || typeof wire.items !== "object" || wire.items === null) throw new ConfigFormatError(`Config "${stored.name ?? "system-config"}" cannot be hydrated: this is not a serialized config-v2 config (no "ownedKinds"/"items"). A pre-cutover build artifact converts through the registered cutover migration — import the config type's module (e.g. \`configs/system\`) before hydrating.`);
6541
6541
  const leftover = wire.options;
@@ -15,7 +15,7 @@ import { Patch, SerializedConfig } from "./Config.js";
15
15
  * sets this constant to its own older timestamp; the merge ref then carries a registered migration
16
16
  * newer than the constant, and the assertion fails until the author re-mints.
17
17
  */
18
- declare const CURRENT_SCHEMA_VERSION = 20261108042210;
18
+ declare const CURRENT_SCHEMA_VERSION = 20261109144822;
19
19
  /** What the walkers need to see of an envelope — loose on purpose, so a typed `SerializedConfig`
20
20
  * and a raw old-shape record both flow in without casts. */
21
21
  interface VersionStamped {
@@ -13,7 +13,7 @@ import { ConfigFormatError } from "./rejection.js";
13
13
  * sets this constant to its own older timestamp; the merge ref then carries a registered migration
14
14
  * newer than the constant, and the assertion fails until the author re-mints.
15
15
  */
16
- const CURRENT_SCHEMA_VERSION = 20261108042210;
16
+ const CURRENT_SCHEMA_VERSION = 20261109144822;
17
17
  /** The mint that moved `options` into the `settings` kind — restated here, rather than imported
18
18
  * from the migration that owns it, because that migration imports this module. */
19
19
  const SETTINGS_AS_KIND_VERSION = 20260908171448;
@@ -45,7 +45,7 @@ function registerSchemaMigrations(...migrations) {
45
45
  for (const migration of migrations) {
46
46
  if (migration.version !== 1 && !isMintTimestamp(migration.version)) throw new Error(`Schema migration version ${migration.version} is not a mint timestamp — mint one with \`date +%Y%m%d%H%M%S\`, like a supabase migration.`);
47
47
  if (REGISTERED.has(migration.version)) throw new Error(`A schema migration at version ${migration.version} is already registered.`);
48
- if (migration.version > 20261108042210) throw new Error(`Schema migration ${migration.version} is newer than CURRENT_SCHEMA_VERSION (${CURRENT_SCHEMA_VERSION}) — a stale branch merged, or the mint forgot to bump the constant. Re-mint: set CURRENT_SCHEMA_VERSION to the newest migration version.`);
48
+ if (migration.version > 20261109144822) throw new Error(`Schema migration ${migration.version} is newer than CURRENT_SCHEMA_VERSION (${CURRENT_SCHEMA_VERSION}) — a stale branch merged, or the mint forgot to bump the constant. Re-mint: set CURRENT_SCHEMA_VERSION to the newest migration version.`);
49
49
  REGISTERED.set(migration.version, migration);
50
50
  }
51
51
  }
@@ -102,7 +102,7 @@ function pendingFor(version, target, options) {
102
102
  * Already-current input passes through untouched — same reference, so hot paths pay nothing.
103
103
  */
104
104
  function upgradeSerializedConfig(json, options) {
105
- const target = options?.target ?? 20261108042210;
105
+ const target = options?.target ?? 20261109144822;
106
106
  const version = detectedWireVersion(json);
107
107
  if (version > target) throw new SchemaVersionTooNew(version, target);
108
108
  const raw = json;
@@ -160,7 +160,7 @@ function upgradedSources(json, options) {
160
160
  * meaning under the current schema and replay skips it — reported by the caller, not swallowed here.
161
161
  */
162
162
  function upgradePatch(patch, writtenAt, options) {
163
- const target = options?.target ?? 20261108042210;
163
+ const target = options?.target ?? 20261109144822;
164
164
  if (writtenAt > target) throw new SchemaVersionTooNew(writtenAt, target);
165
165
  let current = patch;
166
166
  for (const migration of pendingFor(writtenAt, target, options)) {
@@ -179,7 +179,7 @@ function upgradePatch(patch, writtenAt, options) {
179
179
  * stamp would cause.
180
180
  */
181
181
  function upgradeDraftEntries(draft, options) {
182
- const target = options?.target ?? 20261108042210;
182
+ const target = options?.target ?? 20261109144822;
183
183
  const entries = [];
184
184
  const held = [];
185
185
  const retired = [];
@@ -20,7 +20,7 @@ interface LintFixSite {
20
20
  /** The linked system the component or token comes from, which changes it there. */
21
21
  readonly source?: string;
22
22
  }
23
- /** The system's `settings.lint.rules`. */
23
+ /** The system's `settings.lint.rules`, one severity per rule or group name. */
24
24
  declare const lintSeverities: (config: Config | null) => Readonly<Record<string, AuthoringLintSeverity>>;
25
25
  /** The system's `settings.lint.ignore`. */
26
26
  declare const lintIgnores: (config: Config | null) => readonly LintIgnore[];
@@ -1,15 +1,15 @@
1
1
  import { Settings } from "../entities/system/Settings.js";
2
2
  import { styleSetEdits } from "../entities/system/component-style-set.js";
3
3
  import "../index.js";
4
- import { AUTHORING_LINT_GROUPS, AUTHORING_LINT_RULES, ruleSeverity } from "./rules.js";
4
+ import { AUTHORING_LINT_GROUPS, AUTHORING_LINT_RULES, flatLintSeverities, nestLintSeverities, ruleSeverity } from "./rules.js";
5
5
  //#region src/lint/edits.ts
6
6
  /**
7
7
  * The lint's settings and fixes as config edits: how loud a rule is, a finding kept on purpose, and
8
8
  * the one value a finding suggests, written where the finding's was. Create's Lint page and the
9
9
  * sidebars write these; `uds lint` reads the settings they leave.
10
10
  */
11
- /** The system's `settings.lint.rules`. */
12
- const lintSeverities = (config) => (config ? Settings.get(config)?.lint?.rules : void 0) ?? {};
11
+ /** The system's `settings.lint.rules`, one severity per rule or group name. */
12
+ const lintSeverities = (config) => flatLintSeverities(config ? Settings.get(config)?.lint?.rules : void 0);
13
13
  /** The system's `settings.lint.ignore`. */
14
14
  const lintIgnores = (config) => (config ? Settings.get(config)?.lint?.ignore : void 0) ?? [];
15
15
  const rulesOf = (group) => Object.keys(AUTHORING_LINT_RULES).filter((rule) => AUTHORING_LINT_RULES[rule].group === group);
@@ -51,7 +51,7 @@ function severityEdits({ config, name, severity }) {
51
51
  delete severities[rule];
52
52
  if (ruleSeverity(rule, severities) !== severity) severities[rule] = severity;
53
53
  }
54
- return settingsUpdate(config, { "lint.rules": Object.keys(severities).length > 0 ? severities : null });
54
+ return settingsUpdate(config, { "lint.rules": Object.keys(severities).length > 0 ? nestLintSeverities(severities) : null });
55
55
  }
56
56
  /** A finding's entry in `settings.lint.ignore`: as narrow as the finding says where it is. */
57
57
  function ignoreEntry(site, reason) {
@@ -1,5 +1,5 @@
1
- import { AUTHORING_LINT_GROUPS, AUTHORING_LINT_RULES, AuthoringLintFix, AuthoringLintGroup, AuthoringLintRule, AuthoringLintSeverity, CONFIG_LINT_RULES, ConfigLintCheck, ConfigReadLintRule, LintReads, lintReads, ruleSeverity } from "./rules.js";
1
+ import { AUTHORING_LINT_GROUPS, AUTHORING_LINT_RULES, AuthoringLintFix, AuthoringLintGroup, AuthoringLintRule, AuthoringLintRuleSettings, AuthoringLintSeverity, CONFIG_LINT_RULES, ConfigLintCheck, ConfigReadLintRule, LintReads, flatLintSeverities, lintReads, nestLintSeverities, ruleSeverity } from "./rules.js";
2
2
  import { ConfigLintFinding, ConfigLintOptions, LintIgnore, ignoredBy } from "./context.js";
3
3
  import { LintFixSite, fixEdits, groupSeverity, hasFix, ignoreEdits, ignoreEntry, lintIgnores, lintSeverities, restoreEdits, rulesOf, severityEdits } from "./edits.js";
4
4
  import { AuthoringLintEdit, AuthoringLintFinding, AuthoringLintResult, LintIgnoreProblem, LintRun, LintSources, lint, lintConfig } from "./lint.js";
5
- export { AUTHORING_LINT_GROUPS, AUTHORING_LINT_RULES, AuthoringLintEdit, AuthoringLintFinding, AuthoringLintFix, AuthoringLintGroup, AuthoringLintResult, AuthoringLintRule, AuthoringLintSeverity, CONFIG_LINT_RULES, ConfigLintCheck, type ConfigLintFinding, type ConfigLintOptions, ConfigReadLintRule, LintFixSite, type LintIgnore, LintIgnoreProblem, LintReads, LintRun, LintSources, fixEdits, groupSeverity, hasFix, ignoreEdits, ignoreEntry, ignoredBy, lint, lintConfig, lintIgnores, lintReads, lintSeverities, restoreEdits, ruleSeverity, rulesOf, severityEdits };
5
+ export { AUTHORING_LINT_GROUPS, AUTHORING_LINT_RULES, AuthoringLintEdit, AuthoringLintFinding, AuthoringLintFix, AuthoringLintGroup, AuthoringLintResult, AuthoringLintRule, AuthoringLintRuleSettings, AuthoringLintSeverity, CONFIG_LINT_RULES, ConfigLintCheck, type ConfigLintFinding, type ConfigLintOptions, ConfigReadLintRule, LintFixSite, type LintIgnore, LintIgnoreProblem, LintReads, LintRun, LintSources, fixEdits, flatLintSeverities, groupSeverity, hasFix, ignoreEdits, ignoreEntry, ignoredBy, lint, lintConfig, lintIgnores, lintReads, lintSeverities, nestLintSeverities, restoreEdits, ruleSeverity, rulesOf, severityEdits };
@@ -1,5 +1,5 @@
1
1
  import { ignoredBy } from "./context.js";
2
- import { AUTHORING_LINT_GROUPS, AUTHORING_LINT_RULES, CONFIG_LINT_RULES, lintReads, ruleSeverity } from "./rules.js";
2
+ import { AUTHORING_LINT_GROUPS, AUTHORING_LINT_RULES, CONFIG_LINT_RULES, flatLintSeverities, lintReads, nestLintSeverities, ruleSeverity } from "./rules.js";
3
3
  import { fixEdits, groupSeverity, hasFix, ignoreEdits, ignoreEntry, lintIgnores, lintSeverities, restoreEdits, rulesOf, severityEdits } from "./edits.js";
4
4
  import { lint, lintConfig } from "./lint.js";
5
- export { AUTHORING_LINT_GROUPS, AUTHORING_LINT_RULES, CONFIG_LINT_RULES, fixEdits, groupSeverity, hasFix, ignoreEdits, ignoreEntry, ignoredBy, lint, lintConfig, lintIgnores, lintReads, lintSeverities, restoreEdits, ruleSeverity, rulesOf, severityEdits };
5
+ export { AUTHORING_LINT_GROUPS, AUTHORING_LINT_RULES, CONFIG_LINT_RULES, fixEdits, flatLintSeverities, groupSeverity, hasFix, ignoreEdits, ignoreEntry, ignoredBy, lint, lintConfig, lintIgnores, lintReads, lintSeverities, nestLintSeverities, restoreEdits, ruleSeverity, rulesOf, severityEdits };
@@ -325,6 +325,23 @@ type AuthoringLintFix = 'auto' | 'agent' | 'blocked';
325
325
  /** A rule's severity as `settings.lint.rules` sets it: its own entry, else its group's, else the
326
326
  * group's default. */
327
327
  declare function ruleSeverity(rule: AuthoringLintRule, severities: Readonly<Record<string, AuthoringLintSeverity>>): AuthoringLintSeverity;
328
+ /**
329
+ * `settings.lint.rules` as written: a severity per group, or a group's object holding `all` for the
330
+ * group and an entry per rule in it. A rule's flat name at the top level is read too.
331
+ */
332
+ type AuthoringLintRuleSettings = Readonly<Record<string, AuthoringLintSeverity | Readonly<Record<string, AuthoringLintSeverity>>>>;
333
+ /**
334
+ * `settings.lint.rules` as one severity per rule or group name, which {@link ruleSeverity} reads. A
335
+ * rule nested under a group it isn't in keeps its `group/rule` spelling, so it is reported as
336
+ * naming nothing.
337
+ */
338
+ declare function flatLintSeverities(rules: AuthoringLintRuleSettings | undefined): Record<string, AuthoringLintSeverity>;
339
+ /**
340
+ * Flat severities written the way `settings.lint.rules` spells them: each group's own severity and
341
+ * its rules' entries under the group, in the order the groups and rules are declared. A group with
342
+ * no rule entries is its severity alone. A name that is no rule or group stays at the top level.
343
+ */
344
+ declare function nestLintSeverities(flat: Readonly<Record<string, AuthoringLintSeverity>>): AuthoringLintRuleSettings;
328
345
  /** literal-matches-token: the same text a token holds. */
329
346
  declare function literalMatchesToken(ctx: ConfigLintContext, value: LintValue, report: ConfigLintReport): void;
330
347
  /** number-in-brackets: a property that reads bare numbers, written in brackets. */
@@ -340,4 +357,4 @@ declare function smallTapTarget(ctx: ConfigLintContext, layer: LintLayer, report
340
357
  /** duplicate-token: two tokens a property offers, written with one value in every mode. */
341
358
  declare function duplicateToken(ctx: ConfigLintContext, report: ConfigLintReport): void;
342
359
  //#endregion
343
- export { AUTHORING_LINT_GROUPS, AUTHORING_LINT_RULES, AuthoringLintFix, AuthoringLintGroup, AuthoringLintRule, AuthoringLintSeverity, CONFIG_LINT_RULES, ConfigLintCheck, ConfigReadLintRule, LintReads, lintReads, ruleSeverity };
360
+ export { AUTHORING_LINT_GROUPS, AUTHORING_LINT_RULES, AuthoringLintFix, AuthoringLintGroup, AuthoringLintRule, AuthoringLintRuleSettings, AuthoringLintSeverity, CONFIG_LINT_RULES, ConfigLintCheck, ConfigReadLintRule, LintReads, flatLintSeverities, lintReads, nestLintSeverities, ruleSeverity };
@@ -305,6 +305,48 @@ function ruleSeverity(rule, severities) {
305
305
  const fallback = "defaultSeverity" in groupAbout ? groupAbout.defaultSeverity : "warn";
306
306
  return severities[rule] ?? (fallback === "off" ? "off" : severities[group]) ?? fallback;
307
307
  }
308
+ /** The key in a group's object that sets the whole group. */
309
+ const GROUP_ALL = "all";
310
+ /**
311
+ * `settings.lint.rules` as one severity per rule or group name, which {@link ruleSeverity} reads. A
312
+ * rule nested under a group it isn't in keeps its `group/rule` spelling, so it is reported as
313
+ * naming nothing.
314
+ */
315
+ function flatLintSeverities(rules) {
316
+ const flat = {};
317
+ for (const [name, entry] of Object.entries(rules ?? {})) {
318
+ if (typeof entry === "string") {
319
+ flat[name] = entry;
320
+ continue;
321
+ }
322
+ for (const [key, severity] of Object.entries(entry)) if (key === GROUP_ALL) flat[name] = severity;
323
+ else if (AUTHORING_LINT_RULES[key]?.group === name) flat[key] = severity;
324
+ else flat[`${name}/${key}`] = severity;
325
+ }
326
+ return flat;
327
+ }
328
+ /**
329
+ * Flat severities written the way `settings.lint.rules` spells them: each group's own severity and
330
+ * its rules' entries under the group, in the order the groups and rules are declared. A group with
331
+ * no rule entries is its severity alone. A name that is no rule or group stays at the top level.
332
+ */
333
+ function nestLintSeverities(flat) {
334
+ const nested = {};
335
+ for (const group of Object.keys(AUTHORING_LINT_GROUPS)) {
336
+ const rules = Object.keys(AUTHORING_LINT_RULES).filter((rule) => AUTHORING_LINT_RULES[rule].group === group && flat[rule] !== void 0).map((rule) => [rule, flat[rule]]);
337
+ const own = flat[group];
338
+ if (rules.length === 0) {
339
+ if (own) nested[group] = own;
340
+ continue;
341
+ }
342
+ nested[group] = {
343
+ ...own ? { [GROUP_ALL]: own } : {},
344
+ ...Object.fromEntries(rules)
345
+ };
346
+ }
347
+ for (const [name, severity] of Object.entries(flat)) if (!(name in AUTHORING_LINT_RULES) && !(name in AUTHORING_LINT_GROUPS)) nested[name] = severity;
348
+ return nested;
349
+ }
308
350
  /** literal-matches-token: the same text a token holds. */
309
351
  function literalMatchesToken(ctx, value, report) {
310
352
  const match = ctx.tokenSpelled(value.site);
@@ -469,4 +511,4 @@ function duplicateToken(ctx, report) {
469
511
  }
470
512
  }
471
513
  //#endregion
472
- export { AUTHORING_LINT_GROUPS, AUTHORING_LINT_RULES, CONFIG_LINT_RULES, lintReads, ruleSeverity };
514
+ export { AUTHORING_LINT_GROUPS, AUTHORING_LINT_RULES, CONFIG_LINT_RULES, flatLintSeverities, lintReads, nestLintSeverities, ruleSeverity };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Additions only, so the envelope passes through as it is:
3
+ *
4
+ * - `settings.lint.rules` takes an object per group as well as a severity, the way Biome nests its
5
+ * rules: `{ portability: { all: 'error', 'inline-style-on-layer': 'warn' } }`. A flat rule name at
6
+ * the top level still reads as it did, so no stored setting moves.
7
+ */
8
+ import type { SchemaMigration } from '../framework/schema-version';
9
+ export declare const LINT_RULES_BY_GROUP_VERSION = 20261109144822;
10
+ export declare const lintRulesByGroupMigration: SchemaMigration;
@@ -0,0 +1,10 @@
1
+ //#region src/migrations/20261109144822_lint_rules_by_group.ts
2
+ const LINT_RULES_BY_GROUP_VERSION = 20261109144822;
3
+ const lintRulesByGroupMigration = {
4
+ version: LINT_RULES_BY_GROUP_VERSION,
5
+ up(json) {
6
+ return json;
7
+ }
8
+ };
9
+ //#endregion
10
+ export { LINT_RULES_BY_GROUP_VERSION, lintRulesByGroupMigration };