@shivaedev/quality 0.21.1 → 0.22.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.
- package/CHANGELOG.md +16 -0
- package/README.md +24 -8
- package/dist/biome/exceptionConfig.d.ts +7 -0
- package/dist/biome/exceptionConfig.d.ts.map +1 -0
- package/dist/biome/exceptionConfig.js +54 -0
- package/dist/biome/exceptionConfig.js.map +1 -0
- package/dist/biome/report.d.ts +2 -1
- package/dist/biome/report.d.ts.map +1 -1
- package/dist/biome/report.js +5 -5
- package/dist/biome/report.js.map +1 -1
- package/dist/biome/run.d.ts +2 -1
- package/dist/biome/run.d.ts.map +1 -1
- package/dist/biome/run.js +5 -4
- package/dist/biome/run.js.map +1 -1
- package/dist/cli/args.d.ts +5 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +6 -27
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/fix.d.ts.map +1 -1
- package/dist/cli/fix.js +9 -9
- package/dist/cli/fix.js.map +1 -1
- package/dist/cli/lint.d.ts.map +1 -1
- package/dist/cli/lint.js +2 -1
- package/dist/cli/lint.js.map +1 -1
- package/dist/cli/messages.d.ts +3 -0
- package/dist/cli/messages.d.ts.map +1 -0
- package/dist/cli/messages.js +30 -0
- package/dist/cli/messages.js.map +1 -0
- package/dist/cli/migrateExceptions.d.ts +4 -0
- package/dist/cli/migrateExceptions.d.ts.map +1 -0
- package/dist/cli/migrateExceptions.js +78 -0
- package/dist/cli/migrateExceptions.js.map +1 -0
- package/dist/cli.js +3 -0
- package/dist/cli.js.map +1 -1
- package/dist/config/decode.d.ts +6 -0
- package/dist/config/decode.d.ts.map +1 -1
- package/dist/config/decode.js +2 -0
- package/dist/config/decode.js.map +1 -1
- package/dist/config/load.d.ts +4 -0
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +10 -1
- package/dist/config/load.js.map +1 -1
- package/dist/config/resolve.d.ts.map +1 -1
- package/dist/config/resolve.js +11 -1
- package/dist/config/resolve.js.map +1 -1
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/engine/run-rules.d.ts +1 -0
- package/dist/engine/run-rules.d.ts.map +1 -1
- package/dist/engine/run-rules.js +19 -4
- package/dist/engine/run-rules.js.map +1 -1
- package/dist/engine/session.d.ts.map +1 -1
- package/dist/engine/session.js +11 -3
- package/dist/engine/session.js.map +1 -1
- package/dist/exceptions/biomeFindings.d.ts +4 -0
- package/dist/exceptions/biomeFindings.d.ts.map +1 -0
- package/dist/exceptions/biomeFindings.js +14 -0
- package/dist/exceptions/biomeFindings.js.map +1 -0
- package/dist/exceptions/declaration.d.ts +11 -0
- package/dist/exceptions/declaration.d.ts.map +1 -0
- package/dist/exceptions/declaration.js +24 -0
- package/dist/exceptions/declaration.js.map +1 -0
- package/dist/exceptions/migrateBiome.d.ts +3 -0
- package/dist/exceptions/migrateBiome.d.ts.map +1 -0
- package/dist/exceptions/migrateBiome.js +62 -0
- package/dist/exceptions/migrateBiome.js.map +1 -0
- package/dist/exceptions/migrateConfig.d.ts +3 -0
- package/dist/exceptions/migrateConfig.d.ts.map +1 -0
- package/dist/exceptions/migrateConfig.js +57 -0
- package/dist/exceptions/migrateConfig.js.map +1 -0
- package/dist/exceptions/registryEntries.d.ts +4 -0
- package/dist/exceptions/registryEntries.d.ts.map +1 -0
- package/dist/exceptions/registryEntries.js +6 -0
- package/dist/exceptions/registryEntries.js.map +1 -0
- package/dist/rule.d.ts +3 -0
- package/dist/rule.d.ts.map +1 -1
- package/dist/rule.js.map +1 -1
- package/dist/rules/biome.js +2 -2
- package/dist/rules/biome.js.map +1 -1
- package/dist/rules/suppressions/biome/ConsumerDeclaration.d.ts +7 -0
- package/dist/rules/suppressions/biome/ConsumerDeclaration.d.ts.map +1 -0
- package/dist/rules/suppressions/biome/ConsumerDeclaration.js +15 -0
- package/dist/rules/suppressions/biome/ConsumerDeclaration.js.map +1 -0
- package/dist/rules/suppressions/biome-overrides.d.ts.map +1 -1
- package/dist/rules/suppressions/biome-overrides.js +7 -16
- package/dist/rules/suppressions/biome-overrides.js.map +1 -1
- package/docs/debt-and-hooks.md +31 -11
- package/docs/modules.md +2 -0
- package/docs/north-star.md +4 -4
- package/docs/roadmap.md +1 -1
- package/docs/rules.md +12 -33
- package/docs/tooling.md +2 -2
- package/package.json +1 -1
- package/src/biome/exceptionConfig.ts +70 -0
- package/src/biome/report.ts +11 -5
- package/src/biome/run.ts +17 -10
- package/src/cli/args.ts +7 -29
- package/src/cli/fix.ts +14 -9
- package/src/cli/lint.ts +3 -1
- package/src/cli/messages.ts +31 -0
- package/src/cli/migrateExceptions.ts +87 -0
- package/src/cli.ts +3 -0
- package/src/config/decode.ts +2 -0
- package/src/config/load.ts +15 -1
- package/src/config/resolve.ts +12 -1
- package/src/config.ts +2 -0
- package/src/engine/run-rules.ts +21 -4
- package/src/engine/session.ts +11 -3
- package/src/exceptions/biomeFindings.ts +20 -0
- package/src/exceptions/declaration.ts +38 -0
- package/src/exceptions/migrateBiome.ts +78 -0
- package/src/exceptions/migrateConfig.ts +64 -0
- package/src/exceptions/registryEntries.ts +10 -0
- package/src/rule.ts +3 -0
- package/src/rules/biome.ts +2 -2
- package/src/rules/suppressions/biome/ConsumerDeclaration.ts +24 -0
- package/src/rules/suppressions/biome-overrides.ts +7 -26
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrateBiome.js","sourceRoot":"","sources":["../../src/exceptions/migrateBiome.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAG5B,SAAS,MAAM,CAAC,QAAqC;IACpD,OAAO,EAAE,CAAC,oBAAoB,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AAChH,CAAC;AAED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ions/migrateConfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AA4B7D,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,oBAAoB,EAAE,EAAE,eAAe,EAAE,OAAO,GAAG,MAAM,CAkCnJ"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
function objectOf(expression) {
|
|
3
|
+
if (ts.isObjectLiteralExpression(expression)) {
|
|
4
|
+
return expression;
|
|
5
|
+
}
|
|
6
|
+
if (ts.isCallExpression(expression) && expression.arguments[0] !== undefined) {
|
|
7
|
+
return objectOf(expression.arguments[0]);
|
|
8
|
+
}
|
|
9
|
+
return ts.isSatisfiesExpression(expression) || ts.isAsExpression(expression) || ts.isParenthesizedExpression(expression)
|
|
10
|
+
? objectOf(expression.expression)
|
|
11
|
+
: undefined;
|
|
12
|
+
}
|
|
13
|
+
function nameOf(property) {
|
|
14
|
+
const name = property.name;
|
|
15
|
+
if (name === undefined) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
if (ts.isComputedPropertyName(name)) {
|
|
19
|
+
if (ts.isStringLiteral(name.expression) || ts.isNoSubstitutionTemplateLiteral(name.expression) || ts.isNumericLiteral(name.expression)) {
|
|
20
|
+
return name.expression.text;
|
|
21
|
+
}
|
|
22
|
+
throw new Error("Cannot migrate a computed property automatically. Use literal property keys, then run quality exceptions migrate again.");
|
|
23
|
+
}
|
|
24
|
+
return ts.isStringLiteral(name) || ts.isIdentifier(name) || ts.isNumericLiteral(name) ? name.text : undefined;
|
|
25
|
+
}
|
|
26
|
+
export function migrateConfig(text, file, exceptions, hasDeclarations) {
|
|
27
|
+
if (text === undefined) {
|
|
28
|
+
return `export default { exceptions: ${JSON.stringify(exceptions, null, "\t")} };\n`;
|
|
29
|
+
}
|
|
30
|
+
const source = ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
31
|
+
const exported = source.statements.find(ts.isExportAssignment);
|
|
32
|
+
const object = exported === undefined ? undefined : objectOf(exported.expression);
|
|
33
|
+
if (object === undefined || object.properties.some(ts.isSpreadAssignment)) {
|
|
34
|
+
throw new Error(`Cannot migrate ${file} automatically. Export an object or defineConfig({ ... }) without spreads, then run quality exceptions migrate again.`);
|
|
35
|
+
}
|
|
36
|
+
const properties = object.properties.flatMap((property) => {
|
|
37
|
+
const name = nameOf(property);
|
|
38
|
+
if (name === "registry" || name === "exceptions") {
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
41
|
+
if (name !== "rules" || !hasDeclarations) {
|
|
42
|
+
return [{ name: name ?? "", text: property.getFullText(source).trim() }];
|
|
43
|
+
}
|
|
44
|
+
if (!(ts.isPropertyAssignment(property) && ts.isObjectLiteralExpression(property.initializer))
|
|
45
|
+
|| property.initializer.properties.some(ts.isSpreadAssignment)) {
|
|
46
|
+
throw new Error(`Inline the rules object in ${file}, then run quality exceptions migrate again.`);
|
|
47
|
+
}
|
|
48
|
+
const rules = property.initializer.properties.filter((rule) => nameOf(rule) !== "suppressions/biome-overrides");
|
|
49
|
+
return rules.length === 0 ? [] : [{ name: "rules", text: `rules: {\n${rules.map((rule) => rule.getFullText(source).trim()).join(",\n")}\n}` }];
|
|
50
|
+
});
|
|
51
|
+
const next = properties.map((property) => property.text);
|
|
52
|
+
const index = properties.findIndex((property) => property.name > "exceptions");
|
|
53
|
+
next.splice(index < 0 ? next.length : index, 0, `exceptions: ${JSON.stringify(exceptions, null, "\t")}`);
|
|
54
|
+
const replacement = `{\n${next.join(",\n")}\n}`;
|
|
55
|
+
return text.slice(0, object.getStart(source)) + replacement + text.slice(object.end);
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=migrateConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrateConfig.js","sourceRoot":"","sources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AK,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,eAAe,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IACzG,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;IAChD,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AACtF,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ExceptionDeclaration } from "./declaration.ts";
|
|
2
|
+
import type { RegistryEntry } from "./registry.ts";
|
|
3
|
+
export declare function registryEntries(declarations: readonly ExceptionDeclaration[]): readonly RegistryEntry[];
|
|
4
|
+
//# sourceMappingURL=registryEntries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registryEntries.d.ts","sourceRoot":"","sources":["../../src/exceptions/registryEntries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,wBAAgB,eAAe,CAAC,YAAY,EAAE,SAAS,oBAAoB,EAAE,GAAG,SAAS,aAAa,EAAE,CAMvG"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export function registryEntries(declarations) {
|
|
2
|
+
return declarations.flatMap(({ files, reason, rules, subject }) => rules
|
|
3
|
+
.filter((rule) => !rule.startsWith("biome/"))
|
|
4
|
+
.flatMap((rule) => files.map((file) => ({ file, reason, rule, ...(subject === undefined ? {} : { subject }) }))));
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=registryEntries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registryEntries.js","sourceRoot":"","sources":["../../src/exceptions/registryEntries.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,eAAe,CAAC,YAA6C;IAC5E,OAAO,YAAY,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,CACjE,KAAK;SACH,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;SAC5C,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CACjH,CAAC;AACH,CAAC"}
|
package/dist/rule.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Bivariant } from "@shivaedev/types/bivariant.ts";
|
|
2
|
+
import type { ExceptionDeclaration } from "#exceptions/declaration.ts";
|
|
2
3
|
import { type StandardSchemaV1 } from "./standard-schema.ts";
|
|
3
4
|
export interface Finding {
|
|
4
5
|
readonly count?: number | undefined;
|
|
@@ -15,6 +16,8 @@ export interface SourceFile {
|
|
|
15
16
|
readonly text: string;
|
|
16
17
|
}
|
|
17
18
|
export interface RuleInputs {
|
|
19
|
+
readonly configFile?: string;
|
|
20
|
+
readonly exceptions?: readonly ExceptionDeclaration[];
|
|
18
21
|
readonly files: readonly string[];
|
|
19
22
|
readonly readText: (path: string) => Promise<string | undefined>;
|
|
20
23
|
readonly root: string;
|
package/dist/rule.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule.d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AO;IAClD,QAAQ,CAAC,KAAK,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,KAAK,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;IACpF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC;IAChB,QAAQ,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC;CAC7B;AAED,UAAU,yBAAyB,CAAC,EAAE,SAAS,MAAM,EAAE,KAAK,EAAE,OAAO,CAAE,SAAQ,cAAc,CAAC,EAAE,EAAE,OAAO,CAAC;IACzG,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;CACnD;AAED,UAAU,4BAA4B,CAAC,EAAE,SAAS,MAAM,CAAE,SAAQ,cAAc,CAAC,EAAE,EAAE,SAAS,CAAC;IAC9F,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;CAC7B;AAqBD,wBAAgB,UAAU,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,yBAAyB,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AAChJ,wBAAgB,UAAU,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,UAAU,EAAE,4BAA4B,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC"}
|
package/dist/rule.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule.js","sourceRoot":"","sources":["../src/rule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rule.js","sourceRoot":"","sources":["../src/rule.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAyB,MAAM,sBAAsB,CAAC;AA4D5E,MAAM,SAAS,G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S,EAAE,WAAW,EAAE,UAAU,CAAC,WAAW,EAAE,EAAE,EAAE,UAAU,CAAC,EAAE,EAAE,WAAW,EAAE,UAAU,CAAC,WAAW,IAAI,IAAI,EAAE,CAAC;AAC3H,CAAC"}
|
package/dist/rules/biome.js
CHANGED
|
@@ -30,8 +30,8 @@ async function presetFinding(readText) {
|
|
|
30
30
|
return extendsPreset ? [] : [{ file: path, message: `Extend "${PRESET}" from the root Biome config.`, subject: "preset" }];
|
|
31
31
|
}
|
|
32
32
|
const bridge = defineRule({
|
|
33
|
-
check: async ({ readText, root }) => {
|
|
34
|
-
const [preset, report] = await Promise.all([presetFinding(readText), biomeReport(root, ["check"])]);
|
|
33
|
+
check: async ({ exceptions, readText, root }) => {
|
|
34
|
+
const [preset, report] = await Promise.all([presetFinding(readText), biomeReport(root, ["check"], exceptions)]);
|
|
35
35
|
return [...preset, ...report.diagnostics.filter((diagnostic) => FAILING.has(diagnostic.severity)).map(findingOf)];
|
|
36
36
|
},
|
|
37
37
|
description: "Biome's lint, format and assist findings under the shared preset. `quality fix` applies Biome's lint fixes, unsafe ones included, its assist actions and formatting.",
|
package/dist/rules/biome.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"biome.js","sourceRoot":"","sources":["../../src/rules/biome.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAmB,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,UAAU,EAA4C,MAAM,UAAU,CAAC;AAChF,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAExF,MAAM,CAAC,MAAM,MAAM,GAAG,0BAA0B,CAAC;AAEjD,MAAM,YAAY,GAAsB,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;AAEtE,MAAM,OAAO,GAAwB,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAEjE,SAAS,SAAS,CAAC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
export declare const ConsumerDeclaration: Schema.Struct<{
|
|
3
|
+
readonly includes: Schema.NonEmptyArray<Schema.NonEmptyString>;
|
|
4
|
+
readonly reason: Schema.String;
|
|
5
|
+
readonly rule: Schema.NonEmptyString;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=ConsumerDeclaration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConsumerDeclaration.d.ts","sourceRoot":"","sources":["../../../../src/rules/suppressions/biome/ConsumerDeclaration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAYhC,eAAO,MAAM,mBAAmB;;;;EAW/B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { Declaration } from "./declarations.js";
|
|
3
|
+
const GLOB = /[*!?[\]{}]/u;
|
|
4
|
+
const DIRECTORY = /^\.?[^./\\*!?[\]{}]+$/u;
|
|
5
|
+
const INDIVIDUAL = /^(?:lint|assist)\/(?!domains\/)[a-zA-Z]+\/[a-zA-Z]+$/u;
|
|
6
|
+
function namedExclusion(pattern) {
|
|
7
|
+
const segments = pattern.slice(pattern.startsWith("!**/") ? 4 : 1).split("/");
|
|
8
|
+
return pattern.startsWith("!") && DIRECTORY.test(segments.at(-1) ?? "") && segments.every((segment) => segment === "*" || DIRECTORY.test(segment));
|
|
9
|
+
}
|
|
10
|
+
export const ConsumerDeclaration = Declaration.check(Schema.makeFilter(({ includes, rule }) => rule === "files/includes"
|
|
11
|
+
? includes.includes("**") && includes.length > 1 && includes.every((pattern) => pattern === "**" || namedExclusion(pattern))
|
|
12
|
+
: INDIVIDUAL.test(rule) && includes.every((path) => !GLOB.test(path) && /[^/]+\.[^/]+$/u.test(path)), {
|
|
13
|
+
message: "Declare one lint rule or assist action for explicit files, or files/includes with ** and named directory exclusions. Whole checks, groups and blanket scopes cannot be weakened.",
|
|
14
|
+
}));
|
|
15
|
+
//# sourceMappingURL=ConsumerDeclaration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConsumerDeclaration.js","sourceRoot":"","sources":["../../../../src/rules/suppressions/biome/ConsumerDeclaration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,IAAI,GAAG,aAAa,CAAC;AAC3B,MAAM,SAAS,GAAG,wBAAwB,CAAC;AAC3C,MAAM,UAAU,GAAG,uDAAuD,CAAC;AAE3E,SAAS,cAAc,CAAC,OAAe;IACtC,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC9E,OAAO,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,KAAK,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;AACpJ,CAAC;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,WAAW,CAAC,KAAK,CACnD,MAAM,CAAC,UAAU,CAChB,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAE,CACtB,IAAI,KAAK,gBAAgB;IACxB,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,KAAK,IAAI,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;IAC5H,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EACtG;IACC,OAAO,EACN,kLAAkL;CACnL,CACD,CACD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"biome-overrides.d.ts","sourceRoot":"","sources":["../../../src/rules/suppressions/biome-overrides.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"biome-overrides.d.ts","sourceRoot":"","sources":["../../../src/rules/suppressions/biome-overrides.ts"],"names":[],"mappings":"AA0DA,eAAO,MAAM,cAAc;;;;;;EAmBzB,CAAC"}
|
|
@@ -1,31 +1,21 @@
|
|
|
1
1
|
import { Effect, Schema } from "effect";
|
|
2
|
+
import { biomeExceptionHint, missingBiomeFiles } from "#exceptions/biomeFindings.ts";
|
|
2
3
|
import { defineRule } from "#rule.ts";
|
|
4
|
+
import { ConsumerDeclaration } from "#rules/suppressions/biome/ConsumerDeclaration.ts";
|
|
3
5
|
import { biomeConfigs } from "#rules/suppressions/biome/configs.ts";
|
|
4
|
-
import {
|
|
6
|
+
import { matches, scoped, scopeText } from "#rules/suppressions/biome/declarations.ts";
|
|
5
7
|
import { weakeningsOf } from "#rules/suppressions/biome/weakenings.ts";
|
|
6
|
-
const GLOB = /[*!?[\]{}]/u;
|
|
7
|
-
const DIRECTORY = /^\.?[^./\\*!?[\]{}]+$/u;
|
|
8
|
-
const INDIVIDUAL = /^(?:lint|assist)\/(?!domains\/)[a-zA-Z]+\/[a-zA-Z]+$/u;
|
|
9
|
-
function namedExclusion(pattern) {
|
|
10
|
-
const segments = pattern.slice(pattern.startsWith("!**/") ? 4 : 1).split("/");
|
|
11
|
-
return pattern.startsWith("!") && DIRECTORY.test(segments.at(-1) ?? "") && segments.every((segment) => segment === "*" || DIRECTORY.test(segment));
|
|
12
|
-
}
|
|
13
|
-
const ConsumerDeclaration = Declaration.check(Schema.makeFilter(({ includes, rule }) => rule === "files/includes"
|
|
14
|
-
? includes.includes("**") && includes.length > 1 && includes.every((pattern) => pattern === "**" || namedExclusion(pattern))
|
|
15
|
-
: INDIVIDUAL.test(rule) && includes.every((path) => !GLOB.test(path) && /[^/]+\.[^/]+$/u.test(path)), {
|
|
16
|
-
message: "Declare one lint rule or assist action for explicit files, or files/includes with ** and named directory exclusions. Whole checks, groups and blanket scopes cannot be weakened.",
|
|
17
|
-
}));
|
|
18
8
|
const BiomeOverridesOptions = Schema.Struct({
|
|
19
9
|
declared: Schema.Array(ConsumerDeclaration).pipe(Schema.withDecodingDefaultKey(Effect.succeed([]))),
|
|
20
10
|
});
|
|
21
11
|
const shippedBy = ({ base, layers }) => layers.flatMap(({ preset }) => preset === undefined
|
|
22
12
|
? []
|
|
23
13
|
: preset.declared.map(({ includes, rule }) => ({ includes: includes.map((glob) => scoped(base, glob)), rule, specifier: preset.specifier })));
|
|
24
|
-
const undeclared = ({ includes, layer, line, rule }) => layer.preset === undefined
|
|
14
|
+
const undeclared = ({ includes, layer, line, rule }, configFile) => layer.preset === undefined
|
|
25
15
|
? {
|
|
26
16
|
file: layer.path,
|
|
27
17
|
line,
|
|
28
|
-
message: `Weakens "${rule}" for ${scopeText(includes)} without a declaration. Repair the code and remove the weakening setting
|
|
18
|
+
message: `Weakens "${rule}" for ${scopeText(includes)} without a declaration. Repair the code and remove the weakening setting.${Schema.is(ConsumerDeclaration)({ includes, reason: "Permanent exception.", rule }) ? biomeExceptionHint(includes, rule, configFile) : ""}`,
|
|
29
19
|
subject: rule,
|
|
30
20
|
}
|
|
31
21
|
: {
|
|
@@ -60,7 +50,8 @@ export const biomeOverrides = defineRule({
|
|
|
60
50
|
const covered = (weakening) => [...declared, ...shipped].some((declaration) => matches(declaration, weakening));
|
|
61
51
|
return [
|
|
62
52
|
...problems,
|
|
63
|
-
...
|
|
53
|
+
...(await missingBiomeFiles(inputs)),
|
|
54
|
+
...weakenings.filter((weakening) => !covered(weakening)).map((weakening) => undeclared(weakening, inputs.configFile ?? "quality.config.ts")),
|
|
64
55
|
...declared.flatMap(staleOrRepeated(root, weakenings, shipped)),
|
|
65
56
|
];
|
|
66
57
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"biome-overrides.js","sourceRoot":"","sources":["../../../src/rules/suppressions/biome-overrides.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"biome-overrides.js","sourceRoot":"","sources":["../../../src/rules/suppressions/biome-overrides.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,UAAU,EAAgB,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kDAAkD,CAAC;AACvF,OAAO,EAAE,YAAY,EAAc,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,OAAO,EAAe,MAAM,EAAE,SAAS,EAAE,MAAM,2CAA2C,CAAC;AACpG,OAAO,EAAkB,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAEvF,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC3C,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,sBAAsB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;CACnG,CAAC,CAAC;AAMH,MAAM,SAAS,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,EAAS,EAAsB,EAAE,CACjE,MAAM,CAA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CAAC,MAAM,CAAC,CAAC;QAC9D,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC;QACpC,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAChD,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC1C,MAAM,OAAO,GAAG,CAAC,SAAoB,EAAW,EAAE,CAAC,CAAC,GAAG,QAAQ,EAAE,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC;QACpI,OAAO;YACN,GAAG,QAAQ;YACX,GAAG,CAAC,MAAM,iBAAiB,CAAC,MAAM,CAAC,CAAC;YACpC,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,UAAU,CAAC,SAAS,EAAE,MAAM,CAAC,UAAU,IAAI,mBAAmB,CAAC,CAAC;YAC5I,GAAG,QAAQ,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;SAC/D,CAAC;IACH,CAAC;IACD,WAAW,EACV,sKAAsK;IACvK,EAAE,EAAE,8BAA8B;IAClC,OAAO,EAAE,MAAM,CAAC,kBAAkB,CAAC,qBAAqB,EAAE,EAAE,YAAY,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,EAAE,CAAC;IACzH,WAAW,EAAE,KAAK;CAClB,CAAC,CAAC"}
|
package/docs/debt-and-hooks.md
CHANGED
|
@@ -33,7 +33,7 @@ quality lint
|
|
|
33
33
|
|
|
34
34
|
### Baseline growth
|
|
35
35
|
|
|
36
|
-
An error-level finding that neither the
|
|
36
|
+
An error-level finding that neither the config exceptions nor the baseline covers fails `quality lint`; that is how new debt gets noticed. The baseline itself may grow: a reviewer sees each new or raised entry in the diff and judges it. When the failing findings are debt the baseline should keep, such as the debt of a file that moved or was renamed, record the rule again with `quality baseline write --rule <id>`. The report ends with that command for the rules that failed. Then call out the baseline growth in the pull request description.
|
|
37
37
|
|
|
38
38
|
When an upgrade adds a shared check, keep its default error level, inspect its findings and record retained debt with `quality baseline write --rule <id>`. Review any new counts in the commit.
|
|
39
39
|
|
|
@@ -41,19 +41,39 @@ When an upgrade adds a shared check, keep its default error level, inspect its f
|
|
|
41
41
|
|
|
42
42
|
A count depends on the rule's limit, so a Quality policy change that adjusts a limit shifts every count of that rule. The public API also exposes numeric overrides; that does not make tuning thresholds an adoption step. Prefer the shared defaults. A looser limit leaves entries that allow more than is left: they pass, and `tighten` and `prune` lower them. A stricter limit can make an error-level rule's files fail `quality lint`, since each is now further over the limit. Inspect the findings under the new policy before recording retained debt again with `quality baseline write --rule <id>`. Commit the counts with the policy upgrade. The raised entries show in the diff, and the pull request calls them out.
|
|
43
43
|
|
|
44
|
-
##
|
|
44
|
+
## Exceptions
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
Declare permanent exceptions in `quality.config.ts`, in `exceptions`. One entry names `files`, `rules` and one `reason`; it can cover both Quality and Biome rules on the same file:
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
export default defineConfig({
|
|
50
|
+
exceptions: [
|
|
51
|
+
{
|
|
52
|
+
files: ["src/parse.ts"],
|
|
53
|
+
reason: "This parser documents and returns the external format unchanged.",
|
|
54
|
+
rules: ["comments/no-jsdoc", "biome/lint/suspicious/noExplicitAny"],
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
});
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Paths are explicit, relative to the config folder. A Quality exception can add `subject` to cover only that finding's subject. Rules that refuse exceptions still refuse them. Quality exceptions apply before the baseline and must cover a current finding; unknown rules, refused rules and stale entries fail the gate. Biome declarations permit individual lint rules and assist actions on explicit files, without a subject. A Biome declaration naming a missing file fails too.
|
|
61
|
+
|
|
62
|
+
Quality merges the native Biome overrides into a temporary config beside the root config, preserving the repository's settings, preset and plugins, and removes the temporary file after the command. Both `quality lint` and `quality fix` use it. Keep `biome.json` free of consumer exception settings; a manual weakening is still reported. Direct editor or Biome commands use the checked-in config; run Quality to apply its exceptions.
|
|
63
|
+
|
|
64
|
+
For a generated directory exclusion, use `rules: ["biome/files/includes"]` and `files: ["**", "!**/test-support/generated"]`. The [rule reference](./rules.md#declared-biome-overrides) describes the narrow directory pattern policy.
|
|
65
|
+
|
|
66
|
+
### Upgrade existing exceptions
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
quality exceptions migrate
|
|
70
|
+
quality fix
|
|
71
|
+
quality lint
|
|
54
72
|
```
|
|
55
73
|
|
|
56
|
-
|
|
74
|
+
The command reads the legacy registry (the configured `registry` path, or `quality/registry.json`) and `suppressions/biome-overrides.options.declared`. It moves them into `exceptions`, merges declarations with the same files, reason and subject, deletes the old registry and removes the old rule setting and matching root Biome settings. It keeps other config properties. `--from <registry>` selects another legacy registry and `--config <file>` selects a config. Without a config it creates one.
|
|
75
|
+
|
|
76
|
+
Export an object or `defineConfig({ ... })` without spreads for automatic editing; inline the `rules` object when it contains old Biome declarations. Literal computed keys such as `["exceptions"]` are supported; replace dynamic computed keys with literal keys before migrating. Unsupported shapes fail before any writes. Review the diff and remove unused declaration imports and files. For declarations of settings in nested or extended local Biome configs, remove those settings too; automatic removal covers the root `biome.json` and `biome.jsonc`. Legacy readers keep existing consumers running during upgrades; new exceptions go in `exceptions`.
|
|
57
77
|
|
|
58
78
|
## Pre-commit hook
|
|
59
79
|
|
package/docs/modules.md
CHANGED
|
@@ -69,6 +69,8 @@ A module link opens its source. Type and value declarations with the same name a
|
|
|
69
69
|
|
|
70
70
|
| Module | Exported names |
|
|
71
71
|
| --- | --- |
|
|
72
|
+
| [exceptions/declaration.ts](https://github.com/ShivaeDev/platform/blob/main/packages/quality/src/exceptions/declaration.ts) | `ExceptionDeclaration`, `decodeExceptions` |
|
|
73
|
+
| [exceptions/registryEntries.ts](https://github.com/ShivaeDev/platform/blob/main/packages/quality/src/exceptions/registryEntries.ts) | `registryEntries` |
|
|
72
74
|
| [exceptions/registry.ts](https://github.com/ShivaeDev/platform/blob/main/packages/quality/src/exceptions/registry.ts) | `RegistryEntry`, `decodeRegistry`, `StaleRegistryEntry`, `RegistryCheck`, `applyRegistry` |
|
|
73
75
|
|
|
74
76
|
## git
|
package/docs/north-star.md
CHANGED
|
@@ -12,7 +12,7 @@ A consuming repository gets the whole policy. It does not select a preset of sta
|
|
|
12
12
|
|
|
13
13
|
The repository supplies facts Quality cannot infer: where the source and generated files live, which architectural boundaries its imports must respect, and which additional commands a commit must run. Shared Biome and TypeScript configuration and Vitest helpers carry the package's conventions into those tools. The usual setup should stay small, with defaults that make sense together.
|
|
14
14
|
|
|
15
|
-
Adopting the whole policy does not require fixing all old debt in one change. The baseline records existing findings by rule and file while the checks stay strict. An uncovered finding asks for a repair. Fixing debt passes immediately, and lowering tools reduce its recorded counts. A permitted permanent exception lives in
|
|
15
|
+
Adopting the whole policy does not require fixing all old debt in one change. The baseline records existing findings by rule and file while the checks stay strict. An uncovered finding asks for a repair. Fixing debt passes immediately, and lowering tools reduce its recorded counts. A permitted permanent exception lives in the config with a reason, once for both Quality and Biome. When that exception no longer applies, the gate asks for its removal.
|
|
16
16
|
|
|
17
17
|
Every finding should tell an agent that has never used the package what to change. It names the rule and identifies the file and line when available. Invalid input, an unreadable policy or an import boundary with contradictory examples must stop the run rather than make a check silently narrower.
|
|
18
18
|
|
|
@@ -21,7 +21,7 @@ Every finding should tell an agent that has never used the package what to chang
|
|
|
21
21
|
- Adoption is a small setup task. A repository uses the shared defaults instead of maintaining its own catalogue of rules and levels.
|
|
22
22
|
- Quality's rules, tool configuration and internal exceptions express one policy. A new shared convention belongs here, with a reason and accepted and rejected examples.
|
|
23
23
|
- Repository-specific inputs describe code and architecture. A generated path or import fence does not become permission to choose a weaker standard.
|
|
24
|
-
- The config, inventory, rule evaluation,
|
|
24
|
+
- The config, inventory, rule evaluation, exceptions, baseline and report form one path. Checks use that path instead of inventing their own debt handling.
|
|
25
25
|
- A rule defines exactly what it checks. CLI and git promises have real-command tests; package promises have installed-consumer tests. Messages never imply stronger guarantees than those tests prove.
|
|
26
26
|
- Debt diffs are reviewable. Lowering one entry preserves unrelated lines, and a tracked move can carry the debt it already had.
|
|
27
27
|
- The author retains choices the checker cannot make, including symbol names, semantic code order and whether a newly recorded finding is acceptable debt.
|
|
@@ -36,7 +36,7 @@ The public configuration surface and its gaps are recorded in the [roadmap](./ro
|
|
|
36
36
|
|
|
37
37
|
### Strictness and adoption
|
|
38
38
|
|
|
39
|
-
Adopt the policy as a whole; record old debt instead of weakening it. The baseline exposes uncovered findings without demanding an immediate clean-up of every file. It is a record to review, not proof that retained debt is harmless. Explicit recording can raise counts, and a reviewer owns whether that growth is justified. A
|
|
39
|
+
Adopt the policy as a whole; record old debt instead of weakening it. The baseline exposes uncovered findings without demanding an immediate clean-up of every file. It is a record to review, not proof that retained debt is harmless. Explicit recording can raise counts, and a reviewer owns whether that growth is justified. A config exception is for an enduring, explained exception a rule permits, not a substitute for following that rule.
|
|
40
40
|
|
|
41
41
|
### Automation and judgement
|
|
42
42
|
|
|
@@ -56,6 +56,6 @@ A rule can require a test's name or report a fixture-writing call. It cannot est
|
|
|
56
56
|
- A requirement for every repository to build its own rules or copy a complicated config before it can use Quality.
|
|
57
57
|
- Application services, persistence, transactions, request identity, client state and other runtime framework jobs. Their owning packages implement them.
|
|
58
58
|
- A replacement for TypeScript, Biome, Vitest or git.
|
|
59
|
-
- Automatic approval of baseline growth or a
|
|
59
|
+
- Automatic approval of baseline growth or a exception reason. Review owns whether retained debt is justified.
|
|
60
60
|
- A promise that static imports reproduce every runtime loader or that syntax rules prove business behavior.
|
|
61
61
|
- Renaming public symbols or changing APIs to satisfy a rule whose maintainer decision remains open.
|
package/docs/roadmap.md
CHANGED
|
@@ -7,7 +7,7 @@ This page owns Quality's shared policy, tooling, CLI and hook implementation sta
|
|
|
7
7
|
- [x] Optional typed and runtime-validated config with config-free defaults; built-in and local rules enforced at `error`; local-rule and Standard Schema option APIs; one checked inventory and one report grouped by rule.
|
|
8
8
|
- [x] The public config rejects `warn`, `off`, raised thresholds, inventory exclusions and custom test-file patterns. Vitest projects reject suite exclusions. Reasoned Biome declarations cover individual rules on explicit files and named directory exclusions.
|
|
9
9
|
- [x] A JSON Lines baseline with counted debt, explicit named-rule recording, lowering and pruning, tracked-move handling and preservation of unrelated lines.
|
|
10
|
-
- [x]
|
|
10
|
+
- [x] One reasoned config exception list for Quality and Biome, generated native Biome settings at lint and fix time, legacy migration, optional Quality subjects, stale entries and rules that refuse exceptions.
|
|
11
11
|
- [x] File-size and comment rules; inline-suppression, double-cast, deprecation-setting and declared-Biome-override checks.
|
|
12
12
|
- [x] A shared Biome preset and bridge whose error findings use the gate's baseline; enforcement of the installed Biome's recommended rules; bounded fix rounds and selected fixes left to the author.
|
|
13
13
|
- [x] Static import resolution, rejection of production imports of test code, runtime-cycle checks, same-folder relative imports and direct, transitive and vocabulary fences with validated examples.
|
package/docs/rules.md
CHANGED
|
@@ -49,7 +49,7 @@ A repository with existing comments adopts the rules through the baseline, for e
|
|
|
49
49
|
|
|
50
50
|
### Suppressions
|
|
51
51
|
|
|
52
|
-
A check that is silenced at one site hides the problem instead of fixing it. Five rules close the escape hatches, and none of them takes
|
|
52
|
+
A check that is silenced at one site hides the problem instead of fixing it. Five rules close the escape hatches, and none of them takes exceptions: an exception that names one fails the gate as stale. A repository with existing suppressions adopts the rules through the baseline.
|
|
53
53
|
|
|
54
54
|
| Rule | Reports | Options |
|
|
55
55
|
| --- | --- | --- |
|
|
@@ -79,7 +79,9 @@ A type test proves that an API rejects what its types forbid, and TypeScript ass
|
|
|
79
79
|
|
|
80
80
|
#### Declared Biome overrides
|
|
81
81
|
|
|
82
|
-
Consumer
|
|
82
|
+
Consumer exceptions belong in `quality.config.ts`'s `exceptions` list, as `{ files, rules, reason, subject? }`. A single entry covers Quality rules and individual `biome/lint/<group>/<rule>` or `biome/assist/<group>/<action>` rules on explicit file paths. Quality applies the native Biome settings at lint and fix time; do not mirror them in `biome.json`. See [exceptions and upgrades](./debt-and-hooks.md#exceptions).
|
|
83
|
+
|
|
84
|
+
Globs, whole checks and rule groups cannot be excepted. A `biome/files/includes` entry must retain `**` and add only negative patterns naming a concrete directory, such as `!**/test-support/generated`. These patterns may start with `**/` and use `*` for an intermediate directory, as in `!**/test-support/*/generated`. Every other segment names a directory without dots except an optional leading dot; the final segment must be a name. File patterns, nested `**` and wildcard suffixes are rejected. Shipped preset declarations describe Quality's internal policy and are not subject to the consumer scope restriction.
|
|
83
85
|
|
|
84
86
|
Quality ships reasons for its own internal Biome exceptions. Extend the shared configuration and use the baseline for debt. `suppressions/biome-overrides` reads `biome.json` or `biome.jsonc` at the root, every nested `biome.json` and `biome.jsonc` among the checked files, and the configs each of them `extends`, resolved the way Biome resolves them (see [Shared presets](#shared-presets)). These settings count as overrides, at the top level and in every `overrides` entry:
|
|
85
87
|
|
|
@@ -99,30 +101,7 @@ Quality ships reasons for its own internal Biome exceptions. Extend the shared c
|
|
|
99
101
|
|
|
100
102
|
Biome runs assist actions, key sorting among them, as part of `biome check` and reports what they would change, so turning one off is an override. Formatter options such as `indentStyle` or `lineWidth` choose a style, not an exception, and are not overrides. Settings that raise a rule or enable it are not overrides either. Rule options are not read, so an option that loosens a rule, such as a higher complexity limit, is left to review.
|
|
101
103
|
|
|
102
|
-
|
|
103
|
-
export default defineConfig({
|
|
104
|
-
rules: {
|
|
105
|
-
"suppressions/biome-overrides": {
|
|
106
|
-
options: {
|
|
107
|
-
declared: [
|
|
108
|
-
{
|
|
109
|
-
rule: "lint/style/noDefaultExport",
|
|
110
|
-
includes: ["scripts/tool.config.ts"],
|
|
111
|
-
reason: "Tools load their config files through the default export.",
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
rule: "lint/suspicious/noConsole",
|
|
115
|
-
includes: ["scripts/report.ts"],
|
|
116
|
-
reason: "Scripts report to the terminal they run in.",
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
});
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
A declaration covers a setting when its `rule` and its `includes` match the setting's exactly, in any order. An `includes` list that keeps files out is declared as the whole list, so every pattern added to it needs the declaration to change too. A setting at the top level of the root config has the scope `["**"]`, and an `overrides` entry has its own `includes` (`["**"]` when it has none). Paths in a nested config are relative to its folder, so a rule scoped to `"src/a.ts"` in `packages/web/biome.json` is declared as `"packages/web/src/a.ts"`. Top-level and globbed rule scopes cannot be declared by consumers. A setting without a declaration is reported at its line in the Biome config; a declaration that no setting matches is reported against the root config, so the list cannot outlive the overrides it explains.
|
|
104
|
+
A manual setting without a legacy declaration is reported at its line in the Biome config. The compatibility reader matches the old `{ rule, includes, reason }` declarations to settings with the same rule and exact scope, in any order, and reports stale or repeated declarations. Run `quality exceptions migrate` to replace both with the single config entry. A generated override never makes a checked-in manual override declared.
|
|
126
105
|
|
|
127
106
|
#### Shared presets
|
|
128
107
|
|
|
@@ -134,7 +113,7 @@ A config `extends` its entries the way Biome does:
|
|
|
134
113
|
- Lists are appended, not replaced: `overrides`, `plugins` and every `includes` list, `files.includes` among them. A repository's `files.includes` adds to the preset's, so each list is declared by whoever wrote it.
|
|
135
114
|
- Patterns in an extended config resolve against the repository root, or against the folder of a nested config that extends it, as patterns in the config itself do.
|
|
136
115
|
|
|
137
|
-
A package that ships a preset declares the weakenings the preset makes in a `declarations.json` beside the preset file, as an array of
|
|
116
|
+
A package that ships a preset declares the weakenings the preset makes in a `declarations.json` beside the preset file, as an array of `{ rule, includes, reason }` entries. Its `includes` are written relative to the repository that extends the preset. Those weakenings count as declared, so the repository adds nothing for them:
|
|
138
117
|
|
|
139
118
|
```json
|
|
140
119
|
[
|
|
@@ -146,7 +125,7 @@ A package that ships a preset declares the weakenings the preset makes in a `dec
|
|
|
146
125
|
]
|
|
147
126
|
```
|
|
148
127
|
|
|
149
|
-
A weakening the preset makes without such a declaration is reported at the line of the repository's `extends` entry, and the repository
|
|
128
|
+
A weakening the preset makes without such a declaration is reported at the line of the repository's `extends` entry, and the repository must repair the preset or replace that setting with a config exception. A weakening the repository adds beyond the preset needs its own declaration, and a repository declaration that repeats one the preset ships is reported until it is removed. A preset entry that cannot be resolved or read, or whose `declarations.json` is invalid, is reported at the `extends` entry as well.
|
|
150
129
|
|
|
151
130
|
#### Recommended Biome rules
|
|
152
131
|
|
|
@@ -181,7 +160,7 @@ export default defineConfig({
|
|
|
181
160
|
});
|
|
182
161
|
```
|
|
183
162
|
|
|
184
|
-
`imports/cycles` reports each group of modules that import each other at run time once, at the alphabetically first of them, with one loop through the group. Its count is the number of modules in the group. `import type`, `export type`, type references and imports in declaration files are left out; `import { type X }` stays a runtime import. Dynamic `import()` and `require()` count; `require.resolve()` does not. It takes no
|
|
163
|
+
`imports/cycles` reports each group of modules that import each other at run time once, at the alphabetically first of them, with one loop through the group. Its count is the number of modules in the group. `import type`, `export type`, type references and imports in declaration files are left out; `import { type X }` stays a runtime import. Dynamic `import()` and `require()` count; `require.resolve()` does not. It takes no exceptions. Each finding of `imports/resolvable` has the import as its subject.
|
|
185
164
|
|
|
186
165
|
When the sources hold no module at all, the graph-building rules stop the run instead of passing on an empty graph. Point `sources` at the code; do not disable the checks to conceal an empty inventory. `imports/aliased` does not require a graph, and `imports/fences` does nothing when no fences are declared.
|
|
187
166
|
|
|
@@ -254,13 +233,13 @@ The DSL does not compile without `demonstratedBy`, and the rule checks the examp
|
|
|
254
233
|
|
|
255
234
|
Fences guard shipped code, and [test code](./naming.md#test-code) ships nowhere, so a fence never holds it: a test file or a file under `test-support/` may import across every fence. There is no option to check them.
|
|
256
235
|
|
|
257
|
-
A finding has its fence's name as its subject, so a
|
|
236
|
+
A finding has its fence's name as its subject, so a config exception with that subject excuses one file from one fence.
|
|
258
237
|
|
|
259
|
-
`imports/no-test-code` checks every file edge from a production module to a test file or a file under `test-support/`, including type imports, re-exports and test assets. It rejects missing relative paths under `test-support/` too. Test importers may still import production code and other test code. Move shared code into a production module and import it from both production and tests. The rule takes no
|
|
238
|
+
`imports/no-test-code` checks every file edge from a production module to a test file or a file under `test-support/`, including type imports, re-exports and test assets. It rejects missing relative paths under `test-support/` too. Test importers may still import production code and other test code. Move shared code into a production module and import it from both production and tests. The rule takes no exceptions.
|
|
260
239
|
|
|
261
240
|
### Manifests
|
|
262
241
|
|
|
263
|
-
`manifests/sorted` keeps every `package.json` in the repository in the key order of [sort-package-json](https://github.com/keithamus/sort-package-json), a dependency of this package. It walks the whole repository, not only the sources, and skips untracked files ignored by git and `node_modules`. A manifest that is not valid JSON is reported too. `quality fix` sorts the manifests, and the rule takes no
|
|
242
|
+
`manifests/sorted` keeps every `package.json` in the repository in the key order of [sort-package-json](https://github.com/keithamus/sort-package-json), a dependency of this package. It walks the whole repository, not only the sources, and skips untracked files ignored by git and `node_modules`. A manifest that is not valid JSON is reported too. `quality fix` sorts the manifests, and the rule takes no exceptions.
|
|
264
243
|
|
|
265
244
|
## Local-rule API
|
|
266
245
|
|
|
@@ -307,4 +286,4 @@ export const limited = defineRule({
|
|
|
307
286
|
});
|
|
308
287
|
```
|
|
309
288
|
|
|
310
|
-
This is the option-bearing rule the package tests. It defaults to two files and validates a configured `max` before the asynchronous check runs. A rule without an options schema refuses options. Set `registrable: false` when a rule must never be excused by a
|
|
289
|
+
This is the option-bearing rule the package tests. It defaults to two files and validates a configured `max` before the asynchronous check runs. A rule without an options schema refuses options. Set `registrable: false` when a rule must never be excused by a config exception.
|
package/docs/tooling.md
CHANGED
|
@@ -26,7 +26,7 @@ The preset turns off `noUnusedVariables` and `noUnusedFunctionParameters`, becau
|
|
|
26
26
|
|
|
27
27
|
The preset reports `useSortedClasses` at `error` with its fix enabled for class attributes and calls to `cn`, `clsx` and `cva`. Tailwind output does not depend on the order of classes in an attribute, so sorting is safe.
|
|
28
28
|
|
|
29
|
-
The preset sets `noDelete` to `off` because its fix changed behavior or did not finish on real code. `noUndeclaredClasses` is off because its class resolution does not cover aliases and Tailwind utilities; `noInlineStyles` is off because computed values need inline styles. Quality owns these choices and ships their reasons in `declarations.json`. They do not require consumer declarations. The
|
|
29
|
+
The preset sets `noDelete` to `off` because its fix changed behavior or did not finish on real code. `noUndeclaredClasses` is off because its class resolution does not cover aliases and Tailwind utilities; `noInlineStyles` is off because computed values need inline styles. Quality owns these choices and ships their reasons in `declarations.json`. They do not require consumer declarations. The config exception API is described under [declared Biome overrides](./rules.md#declared-biome-overrides); use the shared defaults for adoption.
|
|
30
30
|
|
|
31
31
|
The preset keeps the following rules at `error` with their fixes off so the author decides the repair: `noAccessKey`, `noAriaHiddenOnFocusable`, `noAutofocus`, `noInteractiveElementToNoninteractiveRole`, `noNoninteractiveElementToInteractiveRole`, `noNoninteractiveTabindex`, `noRedundantRoles`, `useValidAriaProps`, `useValidAriaRole`, `noImportantStyles`, `noConstAssign`, `noProcessGlobal`, `useJsonImportAttributes`, `noUnusedPrivateClassMembers`, `useExhaustiveDependencies`, `noFloatingPromises`, `noMisusedPromises`, `useExhaustiveSwitchCases`, `noEqualsToNull`, `useConsistentArrayType`, `useConsistentCurlyBraces`, `useConsistentTestIt`, `useRegexpTest`, `useUnicodeRegex`, `noNonNullAssertion`, `useAtIndex`, `noParametersOnlyUsedInRecursion`, `noSkippedTests` and `useNamingConvention`. The fix command also skips `noDuplicateObjectKeys` and `useSortedKeys`. Import `process` from `node:process` in Node code or use the application's Effect service. Write JSON imports with `with { type: "json" }` for Node 24; the fixer leaves both choices to the author.
|
|
32
32
|
|
|
@@ -38,7 +38,7 @@ The preset keeps the following rules at `error` with their fixes off so the auth
|
|
|
38
38
|
|
|
39
39
|
`noSkippedTests` has no automatic fix because enabling a skipped test can change which setup and bodies run; the author must repair the test or remove a claim it cannot prove.
|
|
40
40
|
|
|
41
|
-
The `biome` rule runs `biome check` with the repository's config and reports each finding as `biome/<category>`, such as `biome/lint/style/useBlockStatements`, `biome/assist/source/useSortedKeys`, `biome/format` or `biome/plugin`, so Biome's findings go through the baseline like any other rule's. `quality baseline write --rule biome` takes in every Biome category at once. A finding below `error` is not reported; a consumer exception for an individual rule therefore
|
|
41
|
+
The `biome` rule runs `biome check` with the repository's config and reports each finding as `biome/<category>`, such as `biome/lint/style/useBlockStatements`, `biome/assist/source/useSortedKeys`, `biome/format` or `biome/plugin`, so Biome's findings go through the baseline like any other rule's. `quality baseline write --rule biome` takes in every Biome category at once. A finding below `error` is not reported; a consumer exception for an individual rule therefore lives in the config exceptions list with explicit files and a reason. Quality applies its Biome settings during lint and fix. Whole-check, group and blanket-scope declarations are rejected; see [configuration limits](../README.md#configuration-limits). The rule also asks for a root `biome.json` or `biome.jsonc` that extends the preset, and it refuses legacy registry exceptions. A Biome config that Biome cannot load stops the run with Biome's message.
|
|
42
42
|
|
|
43
43
|
`quality fix` sorts the discovered manifests, then runs `biome check --write --unsafe`, with the two skipped fixes above. It then runs Biome's formatter, because a lint fix can leave code unformatted. One fix can make room for another, so it repeats both passes until a round rewrites nothing, at most five rounds. When files still change in the fifth round, it names the changed text files it can discover and exits 2; when those files are outside its inventory, the error gives a verbose Biome command to name them. An unsafe fix can change behavior, such as `==` becoming `===`, so review what it changed.
|
|
44
44
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shivaedev/quality",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "Repository quality gate with typed rules, a baseline of existing debt and a registry of reasoned exceptions",
|
|
5
5
|
"homepage": "https://github.com/ShivaeDev/platform/tree/main/packages/quality#readme",
|
|
6
6
|
"bugs": {
|