@shivaedev/quality 0.7.1 → 0.7.3
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 +15 -0
- package/dist/baseline/compare.d.ts +1 -1
- package/dist/baseline/compare.d.ts.map +1 -1
- package/dist/baseline/compare.js +1 -1
- package/dist/baseline/compare.js.map +1 -1
- package/dist/baseline/format.d.ts +1 -1
- package/dist/baseline/format.d.ts.map +1 -1
- package/dist/baseline/format.js +2 -2
- package/dist/baseline/format.js.map +1 -1
- package/dist/baseline/legacy.d.ts +2 -2
- package/dist/baseline/legacy.d.ts.map +1 -1
- package/dist/baseline/legacy.js +2 -2
- package/dist/baseline/legacy.js.map +1 -1
- package/dist/baseline/rewrite.js +1 -1
- package/dist/baseline/rewrite.js.map +1 -1
- package/dist/baseline/update.d.ts +1 -1
- package/dist/baseline/update.d.ts.map +1 -1
- package/dist/baseline/update.js +1 -1
- package/dist/baseline/update.js.map +1 -1
- package/dist/cli/args.d.ts +1 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +4 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/baseline.d.ts +3 -3
- package/dist/cli/baseline.d.ts.map +1 -1
- package/dist/cli/baseline.js +7 -7
- package/dist/cli/baseline.js.map +1 -1
- package/dist/cli/fix.d.ts +8 -3
- package/dist/cli/fix.d.ts.map +1 -1
- package/dist/cli/fix.js +63 -36
- package/dist/cli/fix.js.map +1 -1
- package/dist/cli/lint.d.ts +2 -2
- package/dist/cli/lint.d.ts.map +1 -1
- package/dist/cli/lint.js +4 -4
- package/dist/cli/lint.js.map +1 -1
- package/dist/cli/migrate.d.ts +1 -1
- package/dist/cli/migrate.d.ts.map +1 -1
- package/dist/cli/migrate.js +9 -9
- package/dist/cli/migrate.js.map +1 -1
- package/dist/cli/run-main.d.ts +3 -1
- package/dist/cli/run-main.d.ts.map +1 -1
- package/dist/cli/run-main.js +13 -1
- package/dist/cli/run-main.js.map +1 -1
- package/dist/cli/shrink.d.ts +2 -2
- package/dist/cli/shrink.d.ts.map +1 -1
- package/dist/cli/shrink.js +2 -2
- package/dist/cli/shrink.js.map +1 -1
- package/dist/cli.js +7 -7
- package/dist/cli.js.map +1 -1
- package/dist/config/decode.d.ts +3 -2
- package/dist/config/decode.d.ts.map +1 -1
- package/dist/config/decode.js +5 -1
- package/dist/config/decode.js.map +1 -1
- package/dist/config/load.d.ts +2 -2
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +2 -2
- package/dist/config/load.js.map +1 -1
- package/dist/config/resolve.d.ts +3 -3
- package/dist/config/resolve.d.ts.map +1 -1
- package/dist/config/resolve.js +1 -1
- package/dist/config/resolve.js.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/engine/baseline-file.d.ts +3 -3
- package/dist/engine/baseline-file.d.ts.map +1 -1
- package/dist/engine/baseline-file.js +5 -5
- package/dist/engine/baseline-file.js.map +1 -1
- package/dist/engine/evaluate.d.ts +3 -3
- package/dist/engine/evaluate.d.ts.map +1 -1
- package/dist/engine/evaluate.js +2 -2
- package/dist/engine/evaluate.js.map +1 -1
- package/dist/engine/run-rules.d.ts +2 -2
- package/dist/engine/run-rules.d.ts.map +1 -1
- package/dist/engine/run-rules.js +2 -2
- package/dist/engine/run-rules.js.map +1 -1
- package/dist/engine/session.d.ts +4 -4
- package/dist/engine/session.d.ts.map +1 -1
- package/dist/engine/session.js +6 -6
- package/dist/engine/session.js.map +1 -1
- package/dist/engine/violation.d.ts +2 -2
- package/dist/engine/violation.d.ts.map +1 -1
- package/dist/exceptions/registry.d.ts +2 -2
- package/dist/exceptions/registry.d.ts.map +1 -1
- package/dist/exceptions/registry.js +2 -2
- package/dist/exceptions/registry.js.map +1 -1
- package/dist/git/base.d.ts +1 -1
- package/dist/git/base.d.ts.map +1 -1
- package/dist/git/base.js +1 -1
- package/dist/git/base.js.map +1 -1
- package/dist/git/command.d.ts +1 -1
- package/dist/git/command.d.ts.map +1 -1
- package/dist/git/command.js +1 -1
- package/dist/git/command.js.map +1 -1
- package/dist/git/history.d.ts +1 -1
- package/dist/git/history.d.ts.map +1 -1
- package/dist/imports/departures.d.ts +1 -1
- package/dist/imports/departures.d.ts.map +1 -1
- package/dist/imports/departures.js +1 -1
- package/dist/imports/departures.js.map +1 -1
- package/dist/imports/fences/evaluate.d.ts +2 -2
- package/dist/imports/fences/evaluate.d.ts.map +1 -1
- package/dist/imports/fences/match.d.ts +2 -2
- package/dist/imports/fences/match.d.ts.map +1 -1
- package/dist/imports/fences/match.js +2 -2
- package/dist/imports/fences/match.js.map +1 -1
- package/dist/imports/fences/policy.js +1 -1
- package/dist/imports/fences/policy.js.map +1 -1
- package/dist/imports/fences/reach.d.ts +2 -2
- package/dist/imports/fences/reach.d.ts.map +1 -1
- package/dist/imports/fences/vocabulary.d.ts +1 -1
- package/dist/imports/fences/vocabulary.d.ts.map +1 -1
- package/dist/imports/generated.d.ts +1 -1
- package/dist/imports/generated.d.ts.map +1 -1
- package/dist/imports/generated.js +1 -1
- package/dist/imports/generated.js.map +1 -1
- package/dist/imports/graph.d.ts +1 -1
- package/dist/imports/graph.d.ts.map +1 -1
- package/dist/imports/graph.js +1 -1
- package/dist/imports/graph.js.map +1 -1
- package/dist/imports/resolve.js +1 -1
- package/dist/imports/resolve.js.map +1 -1
- package/dist/imports/workspace.d.ts +1 -1
- package/dist/imports/workspace.d.ts.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/inventory/collect.d.ts +1 -1
- package/dist/inventory/collect.d.ts.map +1 -1
- package/dist/manifests/sorted.d.ts +1 -1
- package/dist/manifests/sorted.d.ts.map +1 -1
- package/dist/manifests/sorted.js +3 -3
- package/dist/manifests/sorted.js.map +1 -1
- package/dist/report/render.d.ts +1 -1
- package/dist/report/render.d.ts.map +1 -1
- package/dist/report/render.js +2 -2
- package/dist/report/render.js.map +1 -1
- package/dist/report/stale.d.ts +1 -1
- package/dist/report/stale.d.ts.map +1 -1
- package/dist/rules/biome.d.ts +1 -1
- package/dist/rules/biome.d.ts.map +1 -1
- package/dist/rules/biome.js +3 -3
- package/dist/rules/biome.js.map +1 -1
- package/dist/rules/built-in.js +14 -14
- package/dist/rules/built-in.js.map +1 -1
- package/dist/rules/comments/kinds.js +1 -1
- package/dist/rules/comments/kinds.js.map +1 -1
- package/dist/rules/comments/max-per-file.d.ts +1 -1
- package/dist/rules/comments/max-per-file.js +2 -2
- package/dist/rules/comments/max-per-file.js.map +1 -1
- package/dist/rules/comments/no-jsdoc.d.ts +1 -1
- package/dist/rules/comments/no-jsdoc.js +1 -1
- package/dist/rules/comments/no-jsdoc.js.map +1 -1
- package/dist/rules/comments/pattern-rule.d.ts +1 -1
- package/dist/rules/comments/pattern-rule.d.ts.map +1 -1
- package/dist/rules/comments/pattern-rule.js +1 -1
- package/dist/rules/comments/pattern-rule.js.map +1 -1
- package/dist/rules/comments/scan.d.ts +1 -1
- package/dist/rules/comments/scan.d.ts.map +1 -1
- package/dist/rules/comments/scan.js +1 -1
- package/dist/rules/comments/scan.js.map +1 -1
- package/dist/rules/imports/aliased.d.ts +1 -1
- package/dist/rules/imports/aliased.d.ts.map +1 -1
- package/dist/rules/imports/aliased.js +2 -2
- package/dist/rules/imports/aliased.js.map +1 -1
- package/dist/rules/imports/cycles.d.ts +1 -1
- package/dist/rules/imports/cycles.d.ts.map +1 -1
- package/dist/rules/imports/cycles.js +4 -4
- package/dist/rules/imports/cycles.js.map +1 -1
- package/dist/rules/imports/fences.d.ts +2 -2
- package/dist/rules/imports/fences.d.ts.map +1 -1
- package/dist/rules/imports/fences.js +3 -3
- package/dist/rules/imports/fences.js.map +1 -1
- package/dist/rules/imports/resolvable.d.ts +1 -1
- package/dist/rules/imports/resolvable.js +3 -3
- package/dist/rules/imports/resolvable.js.map +1 -1
- package/dist/rules/manifests-sorted.d.ts +1 -1
- package/dist/rules/manifests-sorted.d.ts.map +1 -1
- package/dist/rules/manifests-sorted.js +2 -2
- package/dist/rules/manifests-sorted.js.map +1 -1
- package/dist/rules/max-lines.d.ts +1 -1
- package/dist/rules/max-lines.js +1 -1
- package/dist/rules/max-lines.js.map +1 -1
- package/dist/rules/suppressions/biome/configs.d.ts +1 -1
- package/dist/rules/suppressions/biome/configs.d.ts.map +1 -1
- package/dist/rules/suppressions/biome/declarations.d.ts +1 -1
- package/dist/rules/suppressions/biome/declarations.d.ts.map +1 -1
- package/dist/rules/suppressions/biome/declarations.js +1 -1
- package/dist/rules/suppressions/biome/declarations.js.map +1 -1
- package/dist/rules/suppressions/biome/resolve.d.ts +1 -1
- package/dist/rules/suppressions/biome/resolve.d.ts.map +1 -1
- package/dist/rules/suppressions/biome/resolve.js +1 -1
- package/dist/rules/suppressions/biome/resolve.js.map +1 -1
- package/dist/rules/suppressions/biome-overrides.d.ts +1 -1
- package/dist/rules/suppressions/biome-overrides.js +4 -4
- package/dist/rules/suppressions/biome-overrides.js.map +1 -1
- package/dist/rules/suppressions/directives.d.ts +1 -1
- package/dist/rules/suppressions/directives.d.ts.map +1 -1
- package/dist/rules/suppressions/no-double-cast.d.ts +1 -1
- package/dist/rules/suppressions/no-double-cast.d.ts.map +1 -1
- package/dist/rules/suppressions/no-double-cast.js +2 -2
- package/dist/rules/suppressions/no-double-cast.js.map +1 -1
- package/dist/rules/suppressions/no-inline.d.ts +1 -1
- package/dist/rules/suppressions/no-inline.d.ts.map +1 -1
- package/dist/rules/suppressions/no-inline.js +2 -2
- package/dist/rules/suppressions/no-inline.js.map +1 -1
- package/dist/rules/suppressions/stylesheet-comments.d.ts +1 -1
- package/dist/rules/suppressions/stylesheet-comments.d.ts.map +1 -1
- package/dist/rules/suppressions/stylesheet-comments.js +1 -1
- package/dist/rules/suppressions/stylesheet-comments.js.map +1 -1
- package/dist/rules/syntax.d.ts +1 -1
- package/dist/rules/syntax.d.ts.map +1 -1
- package/package.json +10 -2
- package/src/baseline/compare.ts +1 -1
- package/src/baseline/format.ts +2 -2
- package/src/baseline/legacy.ts +2 -2
- package/src/baseline/rewrite.ts +1 -1
- package/src/baseline/update.ts +1 -1
- package/src/cli/args.ts +7 -1
- package/src/cli/baseline.ts +8 -8
- package/src/cli/fix.ts +81 -42
- package/src/cli/lint.ts +4 -4
- package/src/cli/migrate.ts +9 -9
- package/src/cli/run-main.ts +17 -2
- package/src/cli/shrink.ts +5 -5
- package/src/cli.ts +7 -7
- package/src/config/decode.ts +7 -2
- package/src/config/load.ts +3 -3
- package/src/config/resolve.ts +6 -6
- package/src/config.ts +1 -1
- package/src/engine/baseline-file.ts +6 -6
- package/src/engine/evaluate.ts +3 -3
- package/src/engine/run-rules.ts +3 -3
- package/src/engine/session.ts +6 -6
- package/src/engine/violation.ts +2 -2
- package/src/exceptions/registry.ts +2 -2
- package/src/git/base.ts +1 -1
- package/src/git/command.ts +1 -1
- package/src/git/history.ts +1 -1
- package/src/imports/departures.ts +2 -2
- package/src/imports/fences/evaluate.ts +2 -2
- package/src/imports/fences/match.ts +2 -2
- package/src/imports/fences/policy.ts +2 -2
- package/src/imports/fences/reach.ts +2 -2
- package/src/imports/fences/vocabulary.ts +1 -1
- package/src/imports/generated.ts +2 -2
- package/src/imports/graph.ts +2 -2
- package/src/imports/resolve.ts +1 -1
- package/src/imports/workspace.ts +1 -1
- package/src/index.ts +3 -3
- package/src/inventory/collect.ts +1 -1
- package/src/manifests/sorted.ts +3 -3
- package/src/report/render.ts +3 -3
- package/src/report/stale.ts +3 -3
- package/src/rules/biome.ts +3 -3
- package/src/rules/built-in.ts +14 -14
- package/src/rules/comments/kinds.ts +1 -1
- package/src/rules/comments/max-per-file.ts +2 -2
- package/src/rules/comments/no-jsdoc.ts +1 -1
- package/src/rules/comments/pattern-rule.ts +1 -1
- package/src/rules/comments/scan.ts +2 -2
- package/src/rules/imports/aliased.ts +2 -2
- package/src/rules/imports/cycles.ts +4 -4
- package/src/rules/imports/fences.ts +4 -4
- package/src/rules/imports/resolvable.ts +3 -3
- package/src/rules/manifests-sorted.ts +2 -2
- package/src/rules/max-lines.ts +1 -1
- package/src/rules/suppressions/biome/configs.ts +1 -1
- package/src/rules/suppressions/biome/declarations.ts +1 -1
- package/src/rules/suppressions/biome/resolve.ts +2 -2
- package/src/rules/suppressions/biome-overrides.ts +4 -4
- package/src/rules/suppressions/directives.ts +1 -1
- package/src/rules/suppressions/no-double-cast.ts +2 -2
- package/src/rules/suppressions/no-inline.ts +2 -2
- package/src/rules/suppressions/stylesheet-comments.ts +1 -1
- package/src/rules/syntax.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-double-cast.d.ts","sourceRoot":"","sources":["../../../src/rules/suppressions/no-double-cast.ts"],"names":[],"mappings":"AAwCA,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"no-double-cast.d.ts","sourceRoot":"","sources":["../../../src/rules/suppressions/no-double-cast.ts"],"names":[],"mappings":"AAwCA,eAAO,MAAM,YAAY,mEAMvB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
|
-
import { defineRule } from "
|
|
3
|
-
import { parse } from "
|
|
2
|
+
import { defineRule } from "#rule.ts";
|
|
3
|
+
import { parse } from "#rules/syntax.ts";
|
|
4
4
|
const BRIDGES = new Map([
|
|
5
5
|
[ts.SyntaxKind.UnknownKeyword, "unknown"],
|
|
6
6
|
[ts.SyntaxKind.AnyKeyword, "any"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-double-cast.js","sourceRoot":"","sources":["../../../src/rules/suppressions/no-double-cast.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAiC,MAAM,
|
|
1
|
+
{"version":3,"file":"no-double-cast.js","sourceRoot":"","sources":["../../../src/rules/suppressions/no-double-cast.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAiC,MAAM,UAAU,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,MAAM,OAAO,GAAuC,IAAI,GAAG,CAAC;IAC3D,CAAC,EAAE,CAAC,UAAU,CAAC,cAAc,EAAE,SAAS,CAAC;IACzC,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC;IACjC,CAAC,EAAE,CAAC,UAAU,CAAC,YAAY,EAAE,OAAO,CAAC;CACrC,CAAC,CAAC;AAIH,MAAM,WAAW,GAAG,CAAC,IAAa,EAAqB,EAAE,CAAC,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC;AAExH,MAAM,SAAS,GAAG,CAAC,IAAmB,EAAiB,EAAE,CAAC,CAAC,EAAE,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAEnI,MAAM,QAAQ,GAAG,CAAC,IAAe,EAAsB,EAAE;IACxD,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACzC,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACtE,CAAC,CAAC;AAEF,MAAM,OAAO,GAAG,CAAC,IAAY,EAAE,MAAqB,EAAsB,EAAE;IAC3E,MAAM,QAAQ,GAAc,EAAE,CAAC;IAC/B,MAAM,KAAK,GAAG,CAAC,IAAa,EAAQ,EAAE;QACrC,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC9D,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YAC1B,MAAM,IAAI,GAAG,MAAM,CAAC,6BAA6B,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;YAClF,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,kBAAkB,MAAM,4CAA4C,EAAE,CAAC,CAAC;QACpH,CAAC;QACD,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC9B,CAAC,CAAC;IACF,KAAK,CAAC,MAAM,CAAC,CAAC;IACd,OAAO,QAAQ,CAAC;AACjB,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,IAAgB,EAAsB,EAAE;IAC5D,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3B,OAAO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC/D,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC;IACtC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC;IACpD,WAAW,EACV,qKAAqK;IACtK,EAAE,EAAE,6BAA6B;IACjC,WAAW,EAAE,KAAK;CAClB,CAAC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const noInline: import("
|
|
1
|
+
export declare const noInline: import("#rule.ts").Rule<"suppressions/no-inline", undefined>;
|
|
2
2
|
//# sourceMappingURL=no-inline.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-inline.d.ts","sourceRoot":"","sources":["../../../src/rules/suppressions/no-inline.ts"],"names":[],"mappings":"AA6BA,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"no-inline.d.ts","sourceRoot":"","sources":["../../../src/rules/suppressions/no-inline.ts"],"names":[],"mappings":"AA6BA,eAAO,MAAM,QAAQ,8DASnB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineRule } from "
|
|
2
|
-
import { scanComments } from "
|
|
1
|
+
import { defineRule } from "#rule.ts";
|
|
2
|
+
import { scanComments } from "#rules/comments/scan.ts";
|
|
3
3
|
import { suppressionIn } from "./directives.js";
|
|
4
4
|
import { STYLESHEET, stylesheetComments } from "./stylesheet-comments.js";
|
|
5
5
|
const TYPE_TEST = /(?:^|[/.])typecheck\.test\.[cm]?[jt]sx?$/u;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-inline.js","sourceRoot":"","sources":["../../../src/rules/suppressions/no-inline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAiC,MAAM,
|
|
1
|
+
{"version":3,"file":"no-inline.js","sourceRoot":"","sources":["../../../src/rules/suppressions/no-inline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAiC,MAAM,UAAU,CAAC;AACrE,OAAO,EAAsB,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE1E,MAAM,SAAS,GAAG,2CAA2C,CAAC;AAE9D,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;AAM/C,MAAM,OAAO,GAAG,CAAC,IAAY,EAAE,QAAkC,EAAmB,EAAE,CACrF,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;IAC5B,MAAM,SAAS,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IACzC,OAAO,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,wBAAwB,SAAS,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;AAC1I,CAAC,CAAC,CAAC;AAEJ,MAAM,eAAe,GAAG,KAAK,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAc,EAA4B,EAAE;IACpG,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3D,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1I,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,kBAAkB,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AACnG,CAAC,CAAC;AAEF,SAAS,OAAO,CAAC,IAAU;IAC1B,OAAO,IAAI,CAAC,OAAO,KAAK,mBAAmB,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAC;IAClC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,CACvB,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CACvH,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CACxB;IACF,WAAW,EACV,wTAAwT;IACzT,EAAE,EAAE,wBAAwB;IAC5B,WAAW,EAAE,KAAK;CAClB,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type SourceComment } from "
|
|
1
|
+
import { type SourceComment } from "#rules/comments/scan.ts";
|
|
2
2
|
export declare const STYLESHEET: RegExp;
|
|
3
3
|
export declare const stylesheetComments: (path: string, text: string) => readonly SourceComment[];
|
|
4
4
|
//# sourceMappingURL=stylesheet-comments.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stylesheet-comments.d.ts","sourceRoot":"","sources":["../../../src/rules/suppressions/stylesheet-comments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"stylesheet-comments.d.ts","sourceRoot":"","sources":["../../../src/rules/suppressions/stylesheet-comments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAErE,eAAO,MAAM,UAAU,QAA0B,CAAC;AAuBlD,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,EAAE,MAAM,MAAM,KAAG,SAAS,aAAa,EAC4C,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { bodyOf } from "
|
|
1
|
+
import { bodyOf } from "#rules/comments/scan.ts";
|
|
2
2
|
export const STYLESHEET = /\.(?:css|scss|less)$/u;
|
|
3
3
|
const LINE_COMMENTS = /\.(?:scss|less)$/u;
|
|
4
4
|
const TOKENS = String.raw `"(?:[^"\\\n]|\\.)*"?|'(?:[^'\\\n]|\\.)*'?|url\([^)]*\)?|\/\*[\s\S]*?(?:\*\/|$)`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stylesheet-comments.js","sourceRoot":"","sources":["../../../src/rules/suppressions/stylesheet-comments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAsB,MAAM,
|
|
1
|
+
{"version":3,"file":"stylesheet-comments.js","sourceRoot":"","sources":["../../../src/rules/suppressions/stylesheet-comments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAsB,MAAM,yBAAyB,CAAC;AAErE,MAAM,CAAC,MAAM,UAAU,GAAG,uBAAuB,CAAC;AAElD,MAAM,aAAa,GAAG,mBAAmB,CAAC;AAE1C,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAA,gFAAgF,CAAC;AAE1G,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,IAAI,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,gBAAgB,CAAC,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAE5H,MAAM,MAAM,GAAG,CAAC,IAAY,EAAE,MAAc,EAAU,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;AAElG,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,KAAa,EAAE,MAAc,EAAiB,EAAE;IAChF,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IACvD,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;IACzD,OAAO;QACN,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;QACpF,OAAO,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC5C,IAAI;QACJ,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC;QAC1B,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE;QACpD,IAAI,EAAE,KAAK;KACX,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAE,IAAY,EAA4B,EAAE,CAC1F,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC"}
|
package/dist/rules/syntax.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syntax.d.ts","sourceRoot":"","sources":["../../src/rules/syntax.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"syntax.d.ts","sourceRoot":"","sources":["../../src/rules/syntax.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAS3C,eAAO,MAAM,KAAK,GAAI,MAAM,UAAU,KAAG,EAAE,CAAC,UAAU,GAAG,SAGxD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shivaedev/quality",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
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": {
|
|
@@ -14,6 +14,14 @@
|
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"sideEffects": false,
|
|
16
16
|
"type": "module",
|
|
17
|
+
"imports": {
|
|
18
|
+
"#test/*": "./test/*",
|
|
19
|
+
"#*.ts": {
|
|
20
|
+
"source": "./src/*.ts",
|
|
21
|
+
"types": "./dist/*.d.ts",
|
|
22
|
+
"default": "./dist/*.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
17
25
|
"exports": {
|
|
18
26
|
".": {
|
|
19
27
|
"types": "./dist/index.d.ts",
|
|
@@ -45,7 +53,7 @@
|
|
|
45
53
|
],
|
|
46
54
|
"dependencies": {
|
|
47
55
|
"@biomejs/biome": "2.5.14",
|
|
48
|
-
"@shivaedev/types": "0.1.
|
|
56
|
+
"@shivaedev/types": "0.1.1",
|
|
49
57
|
"ignore": "7.0.6",
|
|
50
58
|
"sort-package-json": "4.0.0",
|
|
51
59
|
"typescript": "npm:@typescript/typescript6@6.0.2"
|
package/src/baseline/compare.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { groupBy, keyOf, levelOf, type RuleIndex, unusedEntryProblem, type Violation } from "
|
|
1
|
+
import { groupBy, keyOf, levelOf, type RuleIndex, unusedEntryProblem, type Violation } from "#engine/violation.ts";
|
|
2
2
|
import type { BaselineEntry } from "./format.ts";
|
|
3
3
|
|
|
4
4
|
export interface Regression {
|
package/src/baseline/format.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
import { type Decoded, decodeWith } from "
|
|
3
|
-
import { keyOf } from "
|
|
2
|
+
import { type Decoded, decodeWith } from "#decoded.ts";
|
|
3
|
+
import { keyOf } from "#engine/violation.ts";
|
|
4
4
|
|
|
5
5
|
const Line = Schema.Struct({
|
|
6
6
|
count: Schema.Int.check(Schema.isGreaterThan(0)),
|
package/src/baseline/legacy.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
import { type Decoded, decodeWith } from "
|
|
3
|
-
import { groupBy, keyOf, type Violation } from "
|
|
2
|
+
import { type Decoded, decodeWith } from "#decoded.ts";
|
|
3
|
+
import { groupBy, keyOf, type Violation } from "#engine/violation.ts";
|
|
4
4
|
import { countOf } from "./compare.ts";
|
|
5
5
|
import type { BaselineEntry } from "./format.ts";
|
|
6
6
|
|
package/src/baseline/rewrite.ts
CHANGED
package/src/baseline/update.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { covers, groupBy, keyOf, levelOf, type RuleIndex, type Violation } from "
|
|
1
|
+
import { covers, groupBy, keyOf, levelOf, type RuleIndex, type Violation } from "#engine/violation.ts";
|
|
2
2
|
import { countOf } from "./compare.ts";
|
|
3
3
|
import type { BaselineEntry } from "./format.ts";
|
|
4
4
|
|
package/src/cli/args.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseArgs } from "node:util";
|
|
2
2
|
import { Result } from "effect";
|
|
3
|
-
import type { WarningDetail } from "
|
|
3
|
+
import type { WarningDetail } from "#report/render.ts";
|
|
4
4
|
|
|
5
5
|
export type Command =
|
|
6
6
|
| { readonly _tag: "Lint"; readonly config: string | undefined; readonly warnings: WarningDetail }
|
|
@@ -45,6 +45,9 @@ const OPTIONS = {
|
|
|
45
45
|
|
|
46
46
|
const usage = (problem: string): Parsed => ({ _tag: "Usage", problem });
|
|
47
47
|
|
|
48
|
+
const ADOPT_REMOVED =
|
|
49
|
+
"`quality adopt` was removed in 0.7.0. To record a rule's existing findings in the baseline, run `quality baseline write --rule <id>`; to apply the fixes Biome can make first, run `quality fix`.";
|
|
50
|
+
|
|
48
51
|
const parsed = (command: Command): Parsed => ({ _tag: "Parsed", command });
|
|
49
52
|
|
|
50
53
|
type Values = ReturnType<typeof parseArgs<{ options: typeof OPTIONS; allowPositionals: true }>>["values"];
|
|
@@ -107,6 +110,9 @@ export const parseCommand = (args: readonly string[]): Parsed => {
|
|
|
107
110
|
return parsed({ _tag: "Help" });
|
|
108
111
|
}
|
|
109
112
|
const name = [command, ...rest].join(" ");
|
|
113
|
+
if (command === "adopt") {
|
|
114
|
+
return usage(ADOPT_REMOVED);
|
|
115
|
+
}
|
|
110
116
|
if (ACCEPTS[name] === undefined) {
|
|
111
117
|
return usage(command === "baseline" && rest.length < 2 ? "baseline takes write, prune, tighten or migrate." : `unknown command: ${name}`);
|
|
112
118
|
}
|
package/src/cli/baseline.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { Console, Effect, type FileSystem } from "effect";
|
|
3
|
-
import type { BaselineEntry } from "
|
|
4
|
-
import { rewriteBaseline } from "
|
|
5
|
-
import { adopt, type Pruned, prune, type Scope } from "
|
|
6
|
-
import { openSession, type Session } from "
|
|
7
|
-
import { applyRegistry } from "
|
|
8
|
-
import { SetupFailure } from "
|
|
9
|
-
import { writeText } from "
|
|
10
|
-
import { plural } from "
|
|
3
|
+
import type { BaselineEntry } from "#baseline/format.ts";
|
|
4
|
+
import { rewriteBaseline } from "#baseline/rewrite.ts";
|
|
5
|
+
import { adopt, type Pruned, prune, type Scope } from "#baseline/update.ts";
|
|
6
|
+
import { openSession, type Session } from "#engine/session.ts";
|
|
7
|
+
import { applyRegistry } from "#exceptions/registry.ts";
|
|
8
|
+
import { SetupFailure } from "#failure.ts";
|
|
9
|
+
import { writeText } from "#inventory/filesystem.ts";
|
|
10
|
+
import { plural } from "#report/plural.ts";
|
|
11
11
|
|
|
12
12
|
const save = (session: Session, entries: readonly BaselineEntry[]): Effect.Effect<void, SetupFailure, FileSystem.FileSystem> =>
|
|
13
13
|
Effect.mapError(
|
package/src/cli/fix.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { relative } from "node:path";
|
|
2
2
|
import { Console, Effect, FileSystem } from "effect";
|
|
3
|
-
import { biomeReport, type Report } from "
|
|
4
|
-
import { loadConfig } from "
|
|
5
|
-
import { SetupFailure } from "
|
|
6
|
-
import { posix } from "
|
|
7
|
-
import { walk } from "
|
|
8
|
-
import { sortManifests } from "
|
|
9
|
-
import { plural } from "
|
|
3
|
+
import { biomeReport, type Report } from "#biome/report.ts";
|
|
4
|
+
import { loadConfig } from "#config/load.ts";
|
|
5
|
+
import { SetupFailure } from "#failure.ts";
|
|
6
|
+
import { posix } from "#inventory/ignore-scope.ts";
|
|
7
|
+
import { walk } from "#inventory/walk.ts";
|
|
8
|
+
import { sortManifests } from "#manifests/sorted.ts";
|
|
9
|
+
import { plural } from "#report/plural.ts";
|
|
10
10
|
|
|
11
11
|
export const MAX_FIX_ROUNDS = 5;
|
|
12
12
|
|
|
@@ -17,67 +17,106 @@ function biome(root: string, args: readonly string[]): Effect.Effect<Report, Set
|
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
function
|
|
20
|
+
function isBinary(bytes: Uint8Array): boolean {
|
|
21
|
+
return bytes.includes(0);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function snapshotOf(root: string): Effect.Effect<ReadonlyMap<string, string>, SetupFailure, FileSystem.FileSystem> {
|
|
21
25
|
return Effect.gen(function* () {
|
|
22
26
|
const fs = yield* FileSystem.FileSystem;
|
|
27
|
+
const decoder = new TextDecoder();
|
|
23
28
|
const paths = yield* walk(root);
|
|
24
|
-
const
|
|
25
|
-
Effect.map(fs.readFile(path), (bytes) => [posix(relative(root, path)),
|
|
29
|
+
const texts = yield* Effect.forEach(paths, (path) =>
|
|
30
|
+
Effect.map(fs.readFile(path), (bytes) => (isBinary(bytes) ? [] : [[posix(relative(root, path)), decoder.decode(bytes)] as const])),
|
|
26
31
|
);
|
|
27
|
-
return new Map(
|
|
32
|
+
return new Map(texts.flat());
|
|
28
33
|
}).pipe(Effect.mapError((failure) => new SetupFailure({ message: failure.message })));
|
|
29
34
|
}
|
|
30
35
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"check",
|
|
35
|
-
"--write",
|
|
36
|
-
"--unsafe",
|
|
37
|
-
"--skip=assist/source/useSortedKeys",
|
|
38
|
-
"--skip=lint/suspicious/noDuplicateObjectKeys",
|
|
39
|
-
])).summary.changed;
|
|
40
|
-
const formatted = (yield* biome(root, ["format", "--write"])).summary.changed;
|
|
41
|
-
yield* Console.log(
|
|
42
|
-
`quality: Biome round ${index} rewrote ${plural(fixed, "file")} with fixes and ${plural(formatted, "file")} with the format pass.`,
|
|
43
|
-
);
|
|
44
|
-
return fixed + formatted;
|
|
45
|
-
});
|
|
36
|
+
export interface Pass<Failure, Requirements> {
|
|
37
|
+
readonly label: string;
|
|
38
|
+
readonly run: Effect.Effect<number, Failure, Requirements>;
|
|
46
39
|
}
|
|
47
40
|
|
|
48
41
|
export interface Settling<Failure, Requirements> {
|
|
49
|
-
readonly
|
|
42
|
+
readonly passes: ReadonlyArray<Pass<Failure, Requirements>>;
|
|
50
43
|
readonly snapshot: Effect.Effect<ReadonlyMap<string, string>, Failure, Requirements>;
|
|
51
44
|
}
|
|
52
45
|
|
|
53
|
-
function
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
46
|
+
function changedBy(root: string, args: readonly string[]): Effect.Effect<number, SetupFailure> {
|
|
47
|
+
return Effect.map(biome(root, args), (report) => report.summary.changed);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function biomePasses(root: string): ReadonlyArray<Pass<SetupFailure, never>> {
|
|
51
|
+
return [
|
|
52
|
+
{
|
|
53
|
+
label: "with fixes",
|
|
54
|
+
run: changedBy(root, ["check", "--write", "--unsafe", "--skip=assist/source/useSortedKeys", "--skip=lint/suspicious/noDuplicateObjectKeys"]),
|
|
55
|
+
},
|
|
56
|
+
{ label: "with the format pass", run: changedBy(root, ["format", "--write"]) },
|
|
57
|
+
];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function round<Failure, Requirements>(
|
|
61
|
+
passes: ReadonlyArray<Pass<Failure, Requirements>>,
|
|
62
|
+
index: number,
|
|
63
|
+
afterEachPass: Effect.Effect<void, Failure, Requirements>,
|
|
64
|
+
): Effect.Effect<number, Failure, Requirements> {
|
|
65
|
+
return Effect.gen(function* () {
|
|
66
|
+
let total = 0;
|
|
67
|
+
const parts: string[] = [];
|
|
68
|
+
for (const pass of passes) {
|
|
69
|
+
const changed = yield* pass.run;
|
|
70
|
+
total += changed;
|
|
71
|
+
parts.push(`${plural(changed, "file")} ${pass.label}`);
|
|
72
|
+
yield* afterEachPass;
|
|
73
|
+
}
|
|
74
|
+
yield* Console.log(`quality: Biome round ${index} rewrote ${parts.join(" and ")}.`);
|
|
75
|
+
return total;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function changedBetween(before: ReadonlyMap<string, string>, after: ReadonlyMap<string, string>): readonly string[] {
|
|
80
|
+
return [...new Set([...before.keys(), ...after.keys()])].filter((path) => before.get(path) !== after.get(path));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function unsettled(changed: ReadonlySet<string>): SetupFailure {
|
|
84
|
+
const paths = [...changed].sort((left, right) => left.localeCompare(right));
|
|
85
|
+
const stopped = `Biome still rewrote files after ${MAX_FIX_ROUNDS} rounds, so quality fix stopped.`;
|
|
86
|
+
const named =
|
|
87
|
+
paths.length > 0
|
|
88
|
+
? [`${stopped} These files changed in the last round:`, ...paths.map((path) => ` ${path}`)]
|
|
89
|
+
: [
|
|
90
|
+
`${stopped} The files it changed in the last round are ones quality fix does not read, such as files .gitignore lists.`,
|
|
91
|
+
"Run `biome check --write --unsafe --verbose` to name them.",
|
|
92
|
+
];
|
|
57
93
|
return new SetupFailure({
|
|
58
|
-
message: [
|
|
59
|
-
`Biome still rewrote files after ${MAX_FIX_ROUNDS} rounds, so quality fix stopped. These files changed in the last round:`,
|
|
60
|
-
...changed.map((path) => ` ${path}`),
|
|
61
|
-
"Two fixes probably undo each other there. Fix the code by hand, or turn off one of the rules.",
|
|
62
|
-
].join("\n"),
|
|
94
|
+
message: [...named, "Two fixes probably undo each other there. Fix the code by hand, or turn off one of the rules."].join("\n"),
|
|
63
95
|
});
|
|
64
96
|
}
|
|
65
97
|
|
|
66
98
|
export function settle<Failure, Requirements>({
|
|
67
|
-
|
|
99
|
+
passes,
|
|
68
100
|
snapshot,
|
|
69
101
|
}: Settling<Failure, Requirements>): Effect.Effect<void, Failure | SetupFailure, Requirements> {
|
|
70
102
|
return Effect.gen(function* () {
|
|
71
103
|
for (let index = 1; index < MAX_FIX_ROUNDS; index += 1) {
|
|
72
|
-
if ((yield* round(index)) === 0) {
|
|
104
|
+
if ((yield* round(passes, index, Effect.void)) === 0) {
|
|
73
105
|
return;
|
|
74
106
|
}
|
|
75
107
|
}
|
|
76
|
-
const
|
|
77
|
-
|
|
108
|
+
const changed = new Set<string>();
|
|
109
|
+
let previous = yield* snapshot;
|
|
110
|
+
const record = Effect.map(snapshot, (current) => {
|
|
111
|
+
for (const path of changedBetween(previous, current)) {
|
|
112
|
+
changed.add(path);
|
|
113
|
+
}
|
|
114
|
+
previous = current;
|
|
115
|
+
});
|
|
116
|
+
if ((yield* round(passes, MAX_FIX_ROUNDS, record)) === 0) {
|
|
78
117
|
return;
|
|
79
118
|
}
|
|
80
|
-
return yield* unsettled(
|
|
119
|
+
return yield* unsettled(changed);
|
|
81
120
|
});
|
|
82
121
|
}
|
|
83
122
|
|
|
@@ -86,6 +125,6 @@ export function fix(cwd: string, config: string | undefined): Effect.Effect<void
|
|
|
86
125
|
const { root } = yield* loadConfig(cwd, config);
|
|
87
126
|
const sorted = yield* Effect.mapError(sortManifests(root), (failure) => new SetupFailure({ message: failure.message }));
|
|
88
127
|
yield* Console.log(`quality: sort-package-json rewrote ${plural(sorted, "manifest")}.`);
|
|
89
|
-
yield* settle({
|
|
128
|
+
yield* settle({ passes: biomePasses(root), snapshot: snapshotOf(root) });
|
|
90
129
|
});
|
|
91
130
|
}
|
package/src/cli/lint.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Console, Effect, type FileSystem } from "effect";
|
|
2
|
-
import { evaluate, passes } from "
|
|
3
|
-
import { openSession } from "
|
|
4
|
-
import { GateFailed, type SetupFailure } from "
|
|
5
|
-
import { render, type WarningDetail } from "
|
|
2
|
+
import { evaluate, passes } from "#engine/evaluate.ts";
|
|
3
|
+
import { openSession } from "#engine/session.ts";
|
|
4
|
+
import { GateFailed, type SetupFailure } from "#failure.ts";
|
|
5
|
+
import { render, type WarningDetail } from "#report/render.ts";
|
|
6
6
|
|
|
7
7
|
export const lint = (
|
|
8
8
|
cwd: string,
|
package/src/cli/migrate.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { Console, Effect, FileSystem } from "effect";
|
|
3
|
-
import { encodeBaseline } from "
|
|
4
|
-
import { convertLegacy, decodeLegacyBaseline, LEGACY_BASELINE } from "
|
|
5
|
-
import { loadConfig } from "
|
|
6
|
-
import { validOrFail } from "
|
|
7
|
-
import { readInput } from "
|
|
8
|
-
import { scan } from "
|
|
9
|
-
import { SetupFailure } from "
|
|
10
|
-
import { writeText } from "
|
|
11
|
-
import { plural } from "
|
|
3
|
+
import { encodeBaseline } from "#baseline/format.ts";
|
|
4
|
+
import { convertLegacy, decodeLegacyBaseline, LEGACY_BASELINE } from "#baseline/legacy.ts";
|
|
5
|
+
import { loadConfig } from "#config/load.ts";
|
|
6
|
+
import { validOrFail } from "#decoded.ts";
|
|
7
|
+
import { readInput } from "#engine/baseline-file.ts";
|
|
8
|
+
import { scan } from "#engine/session.ts";
|
|
9
|
+
import { SetupFailure } from "#failure.ts";
|
|
10
|
+
import { writeText } from "#inventory/filesystem.ts";
|
|
11
|
+
import { plural } from "#report/plural.ts";
|
|
12
12
|
|
|
13
13
|
export const migrateBaseline = (
|
|
14
14
|
cwd: string,
|
package/src/cli/run-main.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import type { EventEmitter } from "node:events";
|
|
1
2
|
import process from "node:process";
|
|
2
3
|
import * as NodeChildProcessSpawner from "@effect/platform-node/NodeChildProcessSpawner";
|
|
3
4
|
import * as NodeFileSystem from "@effect/platform-node/NodeFileSystem";
|
|
4
5
|
import * as NodePath from "@effect/platform-node/NodePath";
|
|
5
6
|
import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
|
|
6
7
|
import { Cause, Console, Effect, Exit, type FileSystem, Layer, Runtime } from "effect";
|
|
7
|
-
import { SetupFailure } from "
|
|
8
|
-
import type { Git } from "
|
|
8
|
+
import { SetupFailure } from "#failure.ts";
|
|
9
|
+
import type { Git } from "#git/command.ts";
|
|
9
10
|
|
|
10
11
|
const INTERRUPTED = 130;
|
|
11
12
|
const COULD_NOT_RUN = 2;
|
|
@@ -32,9 +33,23 @@ const teardown: Runtime.Teardown = (exit, onExit) => {
|
|
|
32
33
|
process.stdout.write("", () => process.stderr.write("", () => onExit(exitCode(exit))));
|
|
33
34
|
};
|
|
34
35
|
|
|
36
|
+
function isClosedPipe(error: unknown): boolean {
|
|
37
|
+
return error instanceof Error && "code" in error && error.code === "EPIPE";
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function quietOnClosedPipe(stream: EventEmitter): void {
|
|
41
|
+
stream.on("error", (error: unknown) => {
|
|
42
|
+
if (!isClosedPipe(error)) {
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
35
48
|
const services = NodeChildProcessSpawner.layer.pipe(Layer.provideMerge(Layer.mergeAll(NodeFileSystem.layer, NodePath.layer)));
|
|
36
49
|
|
|
37
50
|
export const runMain = <Value, Error>(program: Effect.Effect<Value, Error, FileSystem.FileSystem | Git>): void => {
|
|
51
|
+
quietOnClosedPipe(process.stdout);
|
|
52
|
+
quietOnClosedPipe(process.stderr);
|
|
38
53
|
const explained = Effect.tapCause(program, (cause) => (Cause.hasInterruptsOnly(cause) ? Effect.void : explain(cause)));
|
|
39
54
|
NodeRuntime.runMain(Effect.provide(explained, services), { disableErrorReporting: true, teardown });
|
|
40
55
|
};
|
package/src/cli/shrink.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Console, Effect, type FileSystem } from "effect";
|
|
2
|
-
import type { Scope } from "
|
|
3
|
-
import type { SetupFailure } from "
|
|
4
|
-
import { resolveBase } from "
|
|
5
|
-
import type { Git } from "
|
|
6
|
-
import { changesSince } from "
|
|
2
|
+
import type { Scope } from "#baseline/update.ts";
|
|
3
|
+
import type { SetupFailure } from "#failure.ts";
|
|
4
|
+
import { resolveBase } from "#git/base.ts";
|
|
5
|
+
import type { Git } from "#git/command.ts";
|
|
6
|
+
import { changesSince } from "#git/history.ts";
|
|
7
7
|
import { shrinkBaseline } from "./baseline.ts";
|
|
8
8
|
|
|
9
9
|
const followedMoves = (root: string, against: string | undefined): Effect.Effect<Scope, SetupFailure, Git> =>
|
package/src/cli.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
import { Console, Effect } from "effect";
|
|
4
|
-
import { parseCommand, USAGE } from "
|
|
5
|
-
import { writeBaseline } from "
|
|
6
|
-
import { fix } from "
|
|
7
|
-
import { lint } from "
|
|
8
|
-
import { migrateBaseline } from "
|
|
9
|
-
import { runMain } from "
|
|
10
|
-
import { pruneBaseline, tightenBaseline } from "
|
|
4
|
+
import { parseCommand, USAGE } from "#cli/args.ts";
|
|
5
|
+
import { writeBaseline } from "#cli/baseline.ts";
|
|
6
|
+
import { fix } from "#cli/fix.ts";
|
|
7
|
+
import { lint } from "#cli/lint.ts";
|
|
8
|
+
import { migrateBaseline } from "#cli/migrate.ts";
|
|
9
|
+
import { runMain } from "#cli/run-main.ts";
|
|
10
|
+
import { pruneBaseline, tightenBaseline } from "#cli/shrink.ts";
|
|
11
11
|
import { SetupFailure } from "./failure.ts";
|
|
12
12
|
|
|
13
13
|
const parsed = parseCommand(process.argv.slice(2));
|
package/src/config/decode.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
import { type Decoded, decodeWith } from "
|
|
3
|
-
import type { Rule } from "
|
|
2
|
+
import { type Decoded, decodeWith } from "#decoded.ts";
|
|
3
|
+
import type { Rule } from "#rule.ts";
|
|
4
4
|
|
|
5
5
|
const isRule = (value: unknown): value is Rule =>
|
|
6
6
|
typeof value === "object"
|
|
@@ -18,7 +18,12 @@ const Setting = Schema.Union([Level, Schema.Struct({ level: Schema.optionalKey(L
|
|
|
18
18
|
|
|
19
19
|
const LocalRule = Schema.declare(isRule, { expected: "a rule made with defineRule" });
|
|
20
20
|
|
|
21
|
+
const AdoptRemoved = Schema.Never.annotate({
|
|
22
|
+
message: "removed in quality 0.7.0. Delete the key, and record a rule's existing findings with `quality baseline write --rule <id>`.",
|
|
23
|
+
});
|
|
24
|
+
|
|
21
25
|
const ConfigInput = Schema.Struct({
|
|
26
|
+
adopt: Schema.optionalKey(AdoptRemoved),
|
|
22
27
|
baseline: Schema.optionalKey(Schema.String),
|
|
23
28
|
exclude: Schema.optionalKey(Schema.Array(Schema.String)),
|
|
24
29
|
extensions: Schema.optionalKey(Schema.Array(Schema.String)),
|
package/src/config/load.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { dirname, resolve } from "node:path";
|
|
2
2
|
import { pathToFileURL } from "node:url";
|
|
3
3
|
import { Effect, FileSystem } from "effect";
|
|
4
|
-
import { validOrFail } from "
|
|
5
|
-
import { SetupFailure } from "
|
|
6
|
-
import type { InventoryScope } from "
|
|
4
|
+
import { validOrFail } from "#decoded.ts";
|
|
5
|
+
import { SetupFailure } from "#failure.ts";
|
|
6
|
+
import type { InventoryScope } from "#inventory/collect.ts";
|
|
7
7
|
import { type ConfigInput, decodeConfig } from "./decode.ts";
|
|
8
8
|
import { CONFIG_FILE } from "./file.ts";
|
|
9
9
|
import { type ResolvedRules, resolveRules } from "./resolve.ts";
|
package/src/config/resolve.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
-
import type { Level } from "
|
|
3
|
-
import type { Decoded } from "
|
|
4
|
-
import type { ActiveRule } from "
|
|
5
|
-
import type { RuleIndex } from "
|
|
6
|
-
import type { Rule } from "
|
|
7
|
-
import { builtInRules } from "
|
|
2
|
+
import type { Level } from "#config.ts";
|
|
3
|
+
import type { Decoded } from "#decoded.ts";
|
|
4
|
+
import type { ActiveRule } from "#engine/run-rules.ts";
|
|
5
|
+
import type { RuleIndex } from "#engine/violation.ts";
|
|
6
|
+
import type { Rule } from "#rule.ts";
|
|
7
|
+
import { builtInRules } from "#rules/built-in.ts";
|
|
8
8
|
import type { ConfigInput } from "./decode.ts";
|
|
9
9
|
|
|
10
10
|
export interface ResolvedRules extends RuleIndex {
|
package/src/config.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { Effect, type FileSystem } from "effect";
|
|
3
|
-
import { type BaselineEntry, decodeBaseline } from "
|
|
4
|
-
import { LEGACY_BASELINE } from "
|
|
5
|
-
import type { ResolvedConfig } from "
|
|
6
|
-
import { validOrFail } from "
|
|
7
|
-
import { SetupFailure } from "
|
|
8
|
-
import { readOptionalText } from "
|
|
3
|
+
import { type BaselineEntry, decodeBaseline } from "#baseline/format.ts";
|
|
4
|
+
import { LEGACY_BASELINE } from "#baseline/legacy.ts";
|
|
5
|
+
import type { ResolvedConfig } from "#config/load.ts";
|
|
6
|
+
import { validOrFail } from "#decoded.ts";
|
|
7
|
+
import { SetupFailure } from "#failure.ts";
|
|
8
|
+
import { readOptionalText } from "#inventory/filesystem.ts";
|
|
9
9
|
|
|
10
10
|
export interface BaselineFile {
|
|
11
11
|
readonly entries: readonly BaselineEntry[];
|
package/src/engine/evaluate.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { applyBaseline, type Regression, type StaleBaselineEntry } from "
|
|
2
|
-
import type { BaselineEntry } from "
|
|
3
|
-
import { applyRegistry, type RegistryEntry, type StaleRegistryEntry } from "
|
|
1
|
+
import { applyBaseline, type Regression, type StaleBaselineEntry } from "#baseline/compare.ts";
|
|
2
|
+
import type { BaselineEntry } from "#baseline/format.ts";
|
|
3
|
+
import { applyRegistry, type RegistryEntry, type StaleRegistryEntry } from "#exceptions/registry.ts";
|
|
4
4
|
import { byLocation, type RuleIndex, type Violation } from "./violation.ts";
|
|
5
5
|
|
|
6
6
|
export interface Outcome {
|
package/src/engine/run-rules.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { isAbsolute, relative } from "node:path";
|
|
2
2
|
import { Effect } from "effect";
|
|
3
|
-
import { SetupFailure } from "
|
|
4
|
-
import { posix } from "
|
|
5
|
-
import type { Finding, Findings, RuleInputs } from "
|
|
3
|
+
import { SetupFailure } from "#failure.ts";
|
|
4
|
+
import { posix } from "#inventory/ignore-scope.ts";
|
|
5
|
+
import type { Finding, Findings, RuleInputs } from "#rule.ts";
|
|
6
6
|
import type { ActiveLevel, Violation } from "./violation.ts";
|
|
7
7
|
|
|
8
8
|
export interface ActiveRule {
|