@shivaedev/quality 0.21.0 → 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 +22 -0
- package/README.md +24 -8
- package/biome/declarations.json +1 -1
- package/biome/preset.json +1 -1
- 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/files/namedAfterExport.d.ts.map +1 -1
- package/dist/rules/files/namedAfterExport.js +9 -1
- package/dist/rules/files/namedAfterExport.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/naming.md +1 -1
- 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/files/namedAfterExport.ts +9 -1
- package/src/rules/suppressions/biome/ConsumerDeclaration.ts +24 -0
- package/src/rules/suppressions/biome-overrides.ts +7 -26
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
function nameOf(property) {
|
|
3
|
+
return ts.isPropertyAssignment(property) && ts.isStringLiteral(property.name) ? property.name.text : undefined;
|
|
4
|
+
}
|
|
5
|
+
function strip(node, paths) {
|
|
6
|
+
if (!ts.isObjectLiteralExpression(node)) {
|
|
7
|
+
return node;
|
|
8
|
+
}
|
|
9
|
+
const properties = node.properties.flatMap((property) => {
|
|
10
|
+
const name = nameOf(property);
|
|
11
|
+
const matching = paths.filter((path) => path[0] === name);
|
|
12
|
+
if (!ts.isPropertyAssignment(property) || matching.length === 0) {
|
|
13
|
+
return [property];
|
|
14
|
+
}
|
|
15
|
+
if (matching.some((path) => path.length === 1)) {
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
const value = strip(property.initializer, matching.map((path) => path.slice(1)));
|
|
19
|
+
return ts.isObjectLiteralExpression(value) && value.properties.length === 0
|
|
20
|
+
? []
|
|
21
|
+
: [ts.factory.updatePropertyAssignment(property, property.name, value)];
|
|
22
|
+
});
|
|
23
|
+
return ts.factory.updateObjectLiteralExpression(node, properties);
|
|
24
|
+
}
|
|
25
|
+
function settingPath(rule) {
|
|
26
|
+
const [tool = "", group = "", name = ""] = rule.split("/");
|
|
27
|
+
return tool === "files" ? ["files", "includes"] : [tool === "lint" ? "linter" : "assist", tool === "lint" ? "rules" : "actions", group, name];
|
|
28
|
+
}
|
|
29
|
+
export function migrateBiome(text, file, declarations) {
|
|
30
|
+
const source = ts.parseJsonText(file, text);
|
|
31
|
+
const root = source.statements[0]?.expression;
|
|
32
|
+
if (ts.parseConfigFileTextToJson(file, text).error !== undefined || root === undefined || !ts.isObjectLiteralExpression(root)) {
|
|
33
|
+
throw new Error(`Cannot migrate invalid Biome config ${file}. Repair it, then run quality exceptions migrate again.`);
|
|
34
|
+
}
|
|
35
|
+
const globals = declarations.filter((entry) => entry.rule === "files/includes");
|
|
36
|
+
const stripped = strip(root, globals.map((entry) => settingPath(entry.rule)));
|
|
37
|
+
if (!ts.isObjectLiteralExpression(stripped)) {
|
|
38
|
+
throw new Error(`Cannot migrate ${file}.`);
|
|
39
|
+
}
|
|
40
|
+
const properties = stripped.properties.flatMap((property) => {
|
|
41
|
+
if (nameOf(property) !== "overrides" || !ts.isPropertyAssignment(property) || !ts.isArrayLiteralExpression(property.initializer)) {
|
|
42
|
+
return [property];
|
|
43
|
+
}
|
|
44
|
+
const overrides = property.initializer.elements.flatMap((override) => {
|
|
45
|
+
if (!ts.isObjectLiteralExpression(override)) {
|
|
46
|
+
return [override];
|
|
47
|
+
}
|
|
48
|
+
const includes = override.properties.find((item) => nameOf(item) === "includes");
|
|
49
|
+
const paths = includes !== undefined && ts.isPropertyAssignment(includes) && ts.isArrayLiteralExpression(includes.initializer)
|
|
50
|
+
? includes.initializer.elements.filter(ts.isStringLiteral).map((item) => item.text)
|
|
51
|
+
: ["**"];
|
|
52
|
+
const matching = declarations.filter((entry) => entry.rule !== "files/includes" && entry.includes.length === paths.length && entry.includes.every((path) => paths.includes(path)));
|
|
53
|
+
const updated = strip(override, matching.map((entry) => settingPath(entry.rule)));
|
|
54
|
+
return ts.isObjectLiteralExpression(updated) && updated.properties.every((item) => nameOf(item) === "includes") ? [] : [updated];
|
|
55
|
+
});
|
|
56
|
+
return overrides.length === 0
|
|
57
|
+
? []
|
|
58
|
+
: [ts.factory.updatePropertyAssignment(property, property.name, ts.factory.updateArrayLiteralExpression(property.initializer, overrides))];
|
|
59
|
+
});
|
|
60
|
+
return `${ts.createPrinter().printNode(ts.EmitHint.Expression, ts.factory.updateObjectLiteralExpression(root, properties), source)}\n`;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=migrateBiome.js.map
|
|
@@ -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,C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ig.d.ts","sourceRoot":"","sources":["../../src/exceptions/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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AC/E,IAAI,CAAC,MAAM,CAAC,KAAK,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 @@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CAAC,EAAE,SAAS,MAAM,EAAE,OAAO;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,sBA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AC,CAAC;IAC5D,OAAO,EAAE,SAAS,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,CAA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-
{"version":3,"file":"namedAfterExport.d.ts","sourceRoot":"","sources":["../../../src/rules/files/namedAfterExport.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"namedAfterExport.d.ts","sourceRoot":"","sources":["../../../src/rules/files/namedAfterExport.ts"],"names":[],"mappings":"AAoFA,eAAO,MAAM,gBAAgB;;EAU3B,CAAC"}
|
|
@@ -8,7 +8,15 @@ import { packageLayout } from "#naming/packageLayout.ts";
|
|
|
8
8
|
import { CAMEL, KEBAB, sameWord, wordsOf } from "#naming/words.ts";
|
|
9
9
|
import { defineRule } from "#rule.ts";
|
|
10
10
|
import { parse } from "#rules/syntax.ts";
|
|
11
|
-
const DEFAULT_TOOL_OWNED = [
|
|
11
|
+
const DEFAULT_TOOL_OWNED = [
|
|
12
|
+
"*.config.*",
|
|
13
|
+
"*.d.ts",
|
|
14
|
+
"*.d.mts",
|
|
15
|
+
"*.d.cts",
|
|
16
|
+
"**/.railway/railway.ts",
|
|
17
|
+
"**/.railway/railway.py",
|
|
18
|
+
"**/.railway/railway.go",
|
|
19
|
+
];
|
|
12
20
|
const TEST = /\.(?:test|spec)\.[cm]?[jt]sx?$/u;
|
|
13
21
|
const SHEBANG = "#!";
|
|
14
22
|
const SHAPES = "The file name and the names of its folders spell the export, in any order, and the file's first letter follows the export's case: listItems in items/ is items/list.ts, ItemPanel is ItemPanel.tsx or item/Panel.tsx.";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"namedAfterExport.js","sourceRoot":"","sources":["../../../src/rules/files/namedAfterExport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,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,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,EAAE,CAAC;CAC3H,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
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,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AC"}
|
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/naming.md
CHANGED
|
@@ -60,7 +60,7 @@ The plugins report under the one Biome category `plugin`, so their findings shar
|
|
|
60
60
|
| `maxItems.ts` | `MAX_ITEMS` alone | No: constants live in a topic file with related constants |
|
|
61
61
|
| `items/listItems.ts` | `listItems` | No: the folder is the prefix, so it is `items/list.ts` |
|
|
62
62
|
|
|
63
|
-
Test files are left to the test rules. The `toolOwned` option lists `.gitignore` patterns of files whose names a tool fixes, `*.config
|
|
63
|
+
Test files are left to the test rules. The `toolOwned` option lists `.gitignore` patterns of files whose names a tool fixes, `*.config.*`, declaration files and `.railway/railway.ts` (also `.py` and `.go`) by default. The Railway paths apply at any project root; other files in `.railway/` still follow the naming rules. The shared Biome preset also permits default exports in these config paths.
|
|
64
64
|
|
|
65
65
|
### Folders
|
|
66
66
|
|
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.
|