@shivaedev/quality 0.7.0 → 0.7.2
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/README.md +4 -2
- package/biome/preset.json +18 -17
- 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/fix.d.ts +7 -2
- package/dist/cli/fix.d.ts.map +1 -1
- package/dist/cli/fix.js +56 -23
- package/dist/cli/fix.js.map +1 -1
- package/dist/cli/run-main.d.ts +2 -0
- package/dist/cli/run-main.d.ts.map +1 -1
- package/dist/cli/run-main.js +12 -0
- package/dist/cli/run-main.js.map +1 -1
- package/dist/config/decode.d.ts +1 -0
- package/dist/config/decode.d.ts.map +1 -1
- package/dist/config/decode.js +4 -0
- package/dist/config/decode.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/args.ts +6 -0
- package/src/cli/fix.ts +74 -29
- package/src/cli/run-main.ts +15 -0
- package/src/config/decode.ts +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.7.2 - 2026-10-04
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- When `quality fix` stops after 5 rounds, it names every file a pass rewrote in the last round, also one that the fix pass changed and the format pass changed back. If none of them is a file it reads, it says so and how to list them.
|
|
8
|
+
- The snapshot `quality fix` takes for its last round holds text files only and leaves binary files out.
|
|
9
|
+
- `quality adopt` and an `adopt` key in the config say that `adopt` was removed in 0.7.0 and to run `quality baseline write --rule <id>` instead.
|
|
10
|
+
- Output into a pipe that closes early, as in `quality --help | head`, no longer crashes with `EPIPE`. Quality stops writing and exits with its own code.
|
|
11
|
+
|
|
12
|
+
## 0.7.1 - 2026-10-04
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- Autofixes that can change behavior or delete something written on purpose now report only, for 20 lint rules and one assist, and the author decides the fix: an autofix added the `u` flag to a regex later compiled by Go's regexp, and another dropped the sign of a computed index. The preset keeps `noAccessKey`, `noAriaHiddenOnFocusable`, `noAutofocus`, `noInteractiveElementToNoninteractiveRole`, `noNoninteractiveElementToInteractiveRole`, `noNoninteractiveTabindex`, `noRedundantRoles`, `useValidAriaProps`, `useValidAriaRole`, `noImportantStyles`, `noConstAssign`, `useExhaustiveDependencies`, `noFloatingPromises`, `useRegexpTest`, `useUnicodeRegex`, `noNonNullAssertion`, `useAtIndex` and `noParametersOnlyUsedInRecursion` at `error` with their fixes off, as `noUnusedPrivateClassMembers` already was, and `quality fix` skips `noDuplicateObjectKeys` and the `useSortedKeys` assist, whose fixes Biome's config cannot turn off. `quality lint` reports them all as before.
|
|
17
|
+
|
|
3
18
|
## 0.7.0 - 2026-10-04
|
|
4
19
|
|
|
5
20
|
### Changed
|
package/README.md
CHANGED
|
@@ -386,15 +386,17 @@ The preset sets:
|
|
|
386
386
|
- **Formatting:** tabs, a line width of 150, double quotes, semicolons, trailing commas and operators at the start of a wrapped line.
|
|
387
387
|
- **Lint:** every rule Biome recommends, at `error`, and a list of stricter rules on top, among them `noUnsafeTypeAssertion`, `useBlockStatements`, `useNumericSeparators`, `useUnicodeRegex`, `useLiteralKeys`, `noFloatingPromises`, `useExhaustiveDependencies`, `it` for every test, function declarations over function expressions, interfaces for object types, a cognitive complexity limit of 15, no nested ternaries, no barrel files and no `export *`.
|
|
388
388
|
- **Imports:** organized in five groups: Node and Bun builtins, packages, `@shivaedev/*` packages, aliases and relative paths. Biome counts as an alias a specifier that starts with `#`, `@/`, `~`, `$` or `%`; a tsconfig path such as `@app/*` sorts with the packages, and Biome's `noUndeclaredDependencies` takes it for one, so name aliases in a form Biome recognizes.
|
|
389
|
-
- **Assist:** organized imports and sorted keys, attributes, enum members, interface members and properties. Keys are sorted in JSON and in object literals alike
|
|
389
|
+
- **Assist:** organized imports and sorted keys, attributes, enum members, interface members and properties. Keys are sorted in JSON and in object literals alike, but only reported: `quality fix` leaves the order to the author. `package.json` is left out, because `manifests/sorted` gives it the order npm users expect.
|
|
390
390
|
- **Plugins:** GritQL rules that ban ambient time, randomness, `console` and `process.env` for Effect's services, and that ask `Effect.fn` for a literal span name shaped `Owner.operation`. They load from `./node_modules/@shivaedev/quality/biome/plugins`, so the package must be installed at the repository root.
|
|
391
391
|
- Files ignored by git are skipped.
|
|
392
392
|
|
|
393
393
|
The preset turns off `noUnusedVariables` and `noUnusedFunctionParameters`, because the tsconfig presets report them through TypeScript, and allows default exports in `*.config.*` files, which tools load through the default export. It also turns off `noProcessGlobal`, `useJsonImportAttributes`, `noMisusedPromises`, `useExhaustiveSwitchCases`, `useSortedClasses`, `noDelete`, `useConsistentArrayType`, `useConsistentCurlyBraces`, `noEqualsToNull` and `noSkippedTests`, because `quality fix` applies every lint fix and their fixes changed behavior or did not terminate on real code. It declares these weakenings in its `declarations.json`, so `suppressions/biome-overrides` takes them as declared. Every other weakening a repository adds is an override it declares with a reason.
|
|
394
394
|
|
|
395
|
+
An autofix applies only a change that removes no decision; a fix that can change behavior or delete something written on purpose reports only, and the author decides. The preset keeps `noAccessKey`, `noAriaHiddenOnFocusable`, `noAutofocus`, `noInteractiveElementToNoninteractiveRole`, `noNoninteractiveElementToInteractiveRole`, `noNoninteractiveTabindex`, `noRedundantRoles`, `useValidAriaProps`, `useValidAriaRole`, `noImportantStyles`, `noConstAssign`, `noUnusedPrivateClassMembers`, `useExhaustiveDependencies`, `noFloatingPromises`, `useRegexpTest`, `useUnicodeRegex`, `noNonNullAssertion`, `useAtIndex` and `noParametersOnlyUsedInRecursion` at `error` with their fixes off, and `quality fix` skips `noDuplicateObjectKeys` and `useSortedKeys`, whose fixes Biome's config cannot turn off.
|
|
396
|
+
|
|
395
397
|
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`, such as a rule a repository declared at `warn`, is not reported. The rule also asks for a root `biome.json` or `biome.jsonc` that extends the preset, and it takes no registry exceptions. A Biome config that Biome cannot load stops the run with Biome's message.
|
|
396
398
|
|
|
397
|
-
`quality fix` sorts every `package.json`, then runs `biome check --write --unsafe`, which applies Biome's lint fixes, unsafe ones included, its assist actions, such as organized imports and
|
|
399
|
+
`quality fix` sorts every `package.json`, then runs `biome check --write --unsafe`, which applies Biome's lint fixes, unsafe ones included, its assist actions, such as organized imports, and its formatting, except the fixes that report only. It then runs Biome's formatter once more, 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 5 rounds; when files still change in the fifth round, it names them and exits 2. An unsafe fix can change behavior, such as `==` becoming `===`, so review what it changed. An editor that runs Biome on save uses the same version when it resolves Biome from the root `node_modules`, so a repository that wants that installs `@biomejs/biome` at the version this package pins.
|
|
398
400
|
|
|
399
401
|
## Vitest projects
|
|
400
402
|
|
package/biome/preset.json
CHANGED
|
@@ -97,21 +97,21 @@
|
|
|
97
97
|
"enabled": true,
|
|
98
98
|
"rules": {
|
|
99
99
|
"a11y": {
|
|
100
|
-
"noAccessKey": "error",
|
|
100
|
+
"noAccessKey": { "fix": "none", "level": "error" },
|
|
101
101
|
"noAmbiguousAnchorText": "error",
|
|
102
|
-
"noAriaHiddenOnFocusable": "error",
|
|
102
|
+
"noAriaHiddenOnFocusable": { "fix": "none", "level": "error" },
|
|
103
103
|
"noAriaUnsupportedElements": "error",
|
|
104
|
-
"noAutofocus": "error",
|
|
104
|
+
"noAutofocus": { "fix": "none", "level": "error" },
|
|
105
105
|
"noDistractingElements": "error",
|
|
106
106
|
"noHeaderScope": "error",
|
|
107
|
-
"noInteractiveElementToNoninteractiveRole": "error",
|
|
107
|
+
"noInteractiveElementToNoninteractiveRole": { "fix": "none", "level": "error" },
|
|
108
108
|
"noLabelWithoutControl": "error",
|
|
109
109
|
"noNoninteractiveElementInteractions": "error",
|
|
110
|
-
"noNoninteractiveElementToInteractiveRole": "error",
|
|
111
|
-
"noNoninteractiveTabindex": "error",
|
|
110
|
+
"noNoninteractiveElementToInteractiveRole": { "fix": "none", "level": "error" },
|
|
111
|
+
"noNoninteractiveTabindex": { "fix": "none", "level": "error" },
|
|
112
112
|
"noPositiveTabindex": "error",
|
|
113
113
|
"noRedundantAlt": "error",
|
|
114
|
-
"noRedundantRoles": "error",
|
|
114
|
+
"noRedundantRoles": { "fix": "none", "level": "error" },
|
|
115
115
|
"noStaticElementInteractions": "error",
|
|
116
116
|
"noSvgWithoutTitle": "error",
|
|
117
117
|
"useAltText": "error",
|
|
@@ -130,8 +130,8 @@
|
|
|
130
130
|
"useMediaCaption": "error",
|
|
131
131
|
"useSemanticElements": "error",
|
|
132
132
|
"useValidAnchor": "error",
|
|
133
|
-
"useValidAriaProps": "error",
|
|
134
|
-
"useValidAriaRole": "error",
|
|
133
|
+
"useValidAriaProps": { "fix": "none", "level": "error" },
|
|
134
|
+
"useValidAriaRole": { "fix": "none", "level": "error" },
|
|
135
135
|
"useValidAriaValues": "error",
|
|
136
136
|
"useValidAutocomplete": "error",
|
|
137
137
|
"useValidLang": "error"
|
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
"noFlatMapIdentity": "error",
|
|
155
155
|
"noForEach": "error",
|
|
156
156
|
"noImplicitCoercions": "error",
|
|
157
|
-
"noImportantStyles": "error",
|
|
157
|
+
"noImportantStyles": { "fix": "none", "level": "error" },
|
|
158
158
|
"noRedundantDefaultExport": "error",
|
|
159
159
|
"noStaticOnlyClass": "error",
|
|
160
160
|
"noThisInStatic": "error",
|
|
@@ -192,7 +192,7 @@
|
|
|
192
192
|
"correctness": {
|
|
193
193
|
"noBeforeInteractiveScriptOutsideDocument": "error",
|
|
194
194
|
"noChildrenProp": "error",
|
|
195
|
-
"noConstAssign": "error",
|
|
195
|
+
"noConstAssign": { "fix": "none", "level": "error" },
|
|
196
196
|
"noConstantCondition": "error",
|
|
197
197
|
"noConstantMathMinMaxClamp": "error",
|
|
198
198
|
"noConstructorReturn": "error",
|
|
@@ -247,6 +247,7 @@
|
|
|
247
247
|
"noVoidElementsWithChildren": "error",
|
|
248
248
|
"noVoidTypeReturn": "error",
|
|
249
249
|
"useExhaustiveDependencies": {
|
|
250
|
+
"fix": "none",
|
|
250
251
|
"level": "error",
|
|
251
252
|
"options": {
|
|
252
253
|
"reportMissingDependenciesArray": true
|
|
@@ -284,7 +285,7 @@
|
|
|
284
285
|
}
|
|
285
286
|
},
|
|
286
287
|
"noExtendNative": "error",
|
|
287
|
-
"noFloatingPromises": "error",
|
|
288
|
+
"noFloatingPromises": { "fix": "none", "level": "error" },
|
|
288
289
|
"noIdenticalTestTitle": "error",
|
|
289
290
|
"noInvalidFileInputAccept": "error",
|
|
290
291
|
"noInvalidPropertyInitValue": "error",
|
|
@@ -352,7 +353,7 @@
|
|
|
352
353
|
"useReactAsyncServerFunction": "error",
|
|
353
354
|
"useReduceTypeParameter": "error",
|
|
354
355
|
"useRegexpExec": "error",
|
|
355
|
-
"useRegexpTest": "error",
|
|
356
|
+
"useRegexpTest": { "fix": "none", "level": "error" },
|
|
356
357
|
"useSortedClasses": {
|
|
357
358
|
"level": "off",
|
|
358
359
|
"options": {
|
|
@@ -363,7 +364,7 @@
|
|
|
363
364
|
"useTailwindShorthandClasses": "error",
|
|
364
365
|
"useTestHooksInOrder": "error",
|
|
365
366
|
"useTestHooksOnTop": "error",
|
|
366
|
-
"useUnicodeRegex": "error",
|
|
367
|
+
"useUnicodeRegex": { "fix": "none", "level": "error" },
|
|
367
368
|
"useValidTestTitle": "error"
|
|
368
369
|
},
|
|
369
370
|
"performance": {
|
|
@@ -394,7 +395,7 @@
|
|
|
394
395
|
"noMultilineString": "error",
|
|
395
396
|
"noNegationElse": "error",
|
|
396
397
|
"noNestedTernary": "error",
|
|
397
|
-
"noNonNullAssertion": "error",
|
|
398
|
+
"noNonNullAssertion": { "fix": "none", "level": "error" },
|
|
398
399
|
"noParameterAssign": "error",
|
|
399
400
|
"noShoutyConstants": "error",
|
|
400
401
|
"noSubstr": "error",
|
|
@@ -404,7 +405,7 @@
|
|
|
404
405
|
"noYodaExpression": "error",
|
|
405
406
|
"useArrayLiterals": "error",
|
|
406
407
|
"useAsConstAssertion": "error",
|
|
407
|
-
"useAtIndex": "error",
|
|
408
|
+
"useAtIndex": { "fix": "none", "level": "error" },
|
|
408
409
|
"useBlockStatements": "error",
|
|
409
410
|
"useCollapsedElseIf": "error",
|
|
410
411
|
"useCollapsedIf": "error",
|
|
@@ -531,7 +532,7 @@
|
|
|
531
532
|
"noNestedPromises": "error",
|
|
532
533
|
"noNonNullAssertedOptionalChain": "error",
|
|
533
534
|
"noOctalEscape": "error",
|
|
534
|
-
"noParametersOnlyUsedInRecursion": "error",
|
|
535
|
+
"noParametersOnlyUsedInRecursion": { "fix": "none", "level": "error" },
|
|
535
536
|
"noProto": "error",
|
|
536
537
|
"noPrototypeBuiltins": "error",
|
|
537
538
|
"noQuickfixBiome": "error",
|
package/dist/cli/args.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../src/cli/args.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,MAAM,MAAM,OAAO,GAChB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAA;CAAE,GAChG;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAC7D;IAAE,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAA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|
29
29
|
warnings: { type: "string" },
|
|
30
30
|
};
|
|
31
31
|
const usage = (problem) => ({ _tag: "Usage", problem });
|
|
32
|
+
const ADOPT_REMOVED = "`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`.";
|
|
32
33
|
const parsed = (command) => ({ _tag: "Parsed", command });
|
|
33
34
|
const COMMAND_OPTIONS = ["against", "from", "rule", "staged", "warnings"];
|
|
34
35
|
const ACCEPTS = {
|
|
@@ -80,6 +81,9 @@ export const parseCommand = (args) => {
|
|
|
80
81
|
return parsed({ _tag: "Help" });
|
|
81
82
|
}
|
|
82
83
|
const name = [command, ...rest].join(" ");
|
|
84
|
+
if (command === "adopt") {
|
|
85
|
+
return usage(ADOPT_REMOVED);
|
|
86
|
+
}
|
|
83
87
|
if (ACCEPTS[name] === undefined) {
|
|
84
88
|
return usage(command === "baseline" && rest.length < 2 ? "baseline takes write, prune, tighten or migrate." : `unknown command: ${name}`);
|
|
85
89
|
}
|
package/dist/cli/args.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"args.js","sourceRoot":"","sources":["../../src/cli/args.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAchC,MAAM,CAAC,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;0DAkBqC,CAAC;AAE3D,MAAM,OAAO,GAAG;IACf,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC3B,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;IAC1B,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;IACxB,IAAI,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE;IACrC,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI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CAAC,aAAa,CAAC,CAAC;IAC7B,CAAC;IACD,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC,OAAO,KAAK,UAAU,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,kDAAkD,CAAC,CAAC,CAAC,oBAAoB,IAAI,EAAE,CAAC,CAAC;IAC3I,CAAC;IACD,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACxC,OAAO,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAC1E,CAAC,CAAC"}
|
package/dist/cli/fix.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { Effect, FileSystem } from "effect";
|
|
2
2
|
import { SetupFailure } from "../failure.ts";
|
|
3
3
|
export declare const MAX_FIX_ROUNDS = 5;
|
|
4
|
+
export declare function snapshotOf(root: string): Effect.Effect<ReadonlyMap<string, string>, SetupFailure, FileSystem.FileSystem>;
|
|
5
|
+
export interface Pass<Failure, Requirements> {
|
|
6
|
+
readonly label: string;
|
|
7
|
+
readonly run: Effect.Effect<number, Failure, Requirements>;
|
|
8
|
+
}
|
|
4
9
|
export interface Settling<Failure, Requirements> {
|
|
5
|
-
readonly
|
|
10
|
+
readonly passes: ReadonlyArray<Pass<Failure, Requirements>>;
|
|
6
11
|
readonly snapshot: Effect.Effect<ReadonlyMap<string, string>, Failure, Requirements>;
|
|
7
12
|
}
|
|
8
|
-
export declare function settle<Failure, Requirements>({
|
|
13
|
+
export declare function settle<Failure, Requirements>({ passes, snapshot, }: Settling<Failure, Requirements>): Effect.Effect<void, Failure | SetupFailure, Requirements>;
|
|
9
14
|
export declare function fix(cwd: string, config: string | undefined): Effect.Effect<void, SetupFailure, FileSystem.FileSystem>;
|
|
10
15
|
//# sourceMappingURL=fix.d.ts.map
|
package/dist/cli/fix.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fix.d.ts","sourceRoot":"","sources":["../../src/cli/fix.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAGrD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAM7C,eAAO,MAAM,cAAc,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"fix.d.ts","sourceRoot":"","sources":["../../src/cli/fix.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAGrD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAM7C,eAAO,MAAM,cAAc,IAAI,CAAC;AAahC,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,EAAE,UAAU,CAAC,UAAU,CAAC,CAUxH;AAED,MAAM,WAAW,IAAI,CAAC,OAAO,EAAE,YAAY;IAC1C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;CAC3D;AAED,MAAM,WAAW,QAAQ,CAAC,OAAO,EAAE,YAAY;IAC9C,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;IAC5D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;CACrF;AAsDD,wBAAgB,MAAM,CAAC,OAAO,EAAE,YAAY,EAAE,EAC7C,MAAM,EACN,QAAQ,GACR,EAAE,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,GAAG,YAAY,EAAE,YAAY,CAAC,CAoB7F;AAED,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,EAAE,UAAU,CAAC,UAAU,CAAC,CAOrH"}
|
package/dist/cli/fix.js
CHANGED
|
@@ -14,46 +14,79 @@ function biome(root, args) {
|
|
|
14
14
|
try: () => biomeReport(root, args),
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function isBinary(bytes) {
|
|
18
|
+
return bytes.includes(0);
|
|
19
|
+
}
|
|
20
|
+
export function snapshotOf(root) {
|
|
18
21
|
return Effect.gen(function* () {
|
|
19
22
|
const fs = yield* FileSystem.FileSystem;
|
|
23
|
+
const decoder = new TextDecoder();
|
|
20
24
|
const paths = yield* walk(root);
|
|
21
|
-
const
|
|
22
|
-
return new Map(
|
|
25
|
+
const texts = yield* Effect.forEach(paths, (path) => Effect.map(fs.readFile(path), (bytes) => (isBinary(bytes) ? [] : [[posix(relative(root, path)), decoder.decode(bytes)]])));
|
|
26
|
+
return new Map(texts.flat());
|
|
23
27
|
}).pipe(Effect.mapError((failure) => new SetupFailure({ message: failure.message })));
|
|
24
28
|
}
|
|
25
|
-
function
|
|
29
|
+
function changedBy(root, args) {
|
|
30
|
+
return Effect.map(biome(root, args), (report) => report.summary.changed);
|
|
31
|
+
}
|
|
32
|
+
function biomePasses(root) {
|
|
33
|
+
return [
|
|
34
|
+
{
|
|
35
|
+
label: "with fixes",
|
|
36
|
+
run: changedBy(root, ["check", "--write", "--unsafe", "--skip=assist/source/useSortedKeys", "--skip=lint/suspicious/noDuplicateObjectKeys"]),
|
|
37
|
+
},
|
|
38
|
+
{ label: "with the format pass", run: changedBy(root, ["format", "--write"]) },
|
|
39
|
+
];
|
|
40
|
+
}
|
|
41
|
+
function round(passes, index, afterEachPass) {
|
|
26
42
|
return Effect.gen(function* () {
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
43
|
+
let total = 0;
|
|
44
|
+
const parts = [];
|
|
45
|
+
for (const pass of passes) {
|
|
46
|
+
const changed = yield* pass.run;
|
|
47
|
+
total += changed;
|
|
48
|
+
parts.push(`${plural(changed, "file")} ${pass.label}`);
|
|
49
|
+
yield* afterEachPass;
|
|
50
|
+
}
|
|
51
|
+
yield* Console.log(`quality: Biome round ${index} rewrote ${parts.join(" and ")}.`);
|
|
52
|
+
return total;
|
|
31
53
|
});
|
|
32
54
|
}
|
|
33
|
-
function
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
55
|
+
function changedBetween(before, after) {
|
|
56
|
+
return [...new Set([...before.keys(), ...after.keys()])].filter((path) => before.get(path) !== after.get(path));
|
|
57
|
+
}
|
|
58
|
+
function unsettled(changed) {
|
|
59
|
+
const paths = [...changed].sort((left, right) => left.localeCompare(right));
|
|
60
|
+
const stopped = `Biome still rewrote files after ${MAX_FIX_ROUNDS} rounds, so quality fix stopped.`;
|
|
61
|
+
const named = paths.length > 0
|
|
62
|
+
? [`${stopped} These files changed in the last round:`, ...paths.map((path) => ` ${path}`)]
|
|
63
|
+
: [
|
|
64
|
+
`${stopped} The files it changed in the last round are ones quality fix does not read, such as files .gitignore lists.`,
|
|
65
|
+
"Run `biome check --write --unsafe --verbose` to name them.",
|
|
66
|
+
];
|
|
37
67
|
return new SetupFailure({
|
|
38
|
-
message: [
|
|
39
|
-
`Biome still rewrote files after ${MAX_FIX_ROUNDS} rounds, so quality fix stopped. These files changed in the last round:`,
|
|
40
|
-
...changed.map((path) => ` ${path}`),
|
|
41
|
-
"Two fixes probably undo each other there. Fix the code by hand, or turn off one of the rules.",
|
|
42
|
-
].join("\n"),
|
|
68
|
+
message: [...named, "Two fixes probably undo each other there. Fix the code by hand, or turn off one of the rules."].join("\n"),
|
|
43
69
|
});
|
|
44
70
|
}
|
|
45
|
-
export function settle({
|
|
71
|
+
export function settle({ passes, snapshot, }) {
|
|
46
72
|
return Effect.gen(function* () {
|
|
47
73
|
for (let index = 1; index < MAX_FIX_ROUNDS; index += 1) {
|
|
48
|
-
if ((yield* round(index)) === 0) {
|
|
74
|
+
if ((yield* round(passes, index, Effect.void)) === 0) {
|
|
49
75
|
return;
|
|
50
76
|
}
|
|
51
77
|
}
|
|
52
|
-
const
|
|
53
|
-
|
|
78
|
+
const changed = new Set();
|
|
79
|
+
let previous = yield* snapshot;
|
|
80
|
+
const record = Effect.map(snapshot, (current) => {
|
|
81
|
+
for (const path of changedBetween(previous, current)) {
|
|
82
|
+
changed.add(path);
|
|
83
|
+
}
|
|
84
|
+
previous = current;
|
|
85
|
+
});
|
|
86
|
+
if ((yield* round(passes, MAX_FIX_ROUNDS, record)) === 0) {
|
|
54
87
|
return;
|
|
55
88
|
}
|
|
56
|
-
return yield* unsettled(
|
|
89
|
+
return yield* unsettled(changed);
|
|
57
90
|
});
|
|
58
91
|
}
|
|
59
92
|
export function fix(cwd, config) {
|
|
@@ -61,7 +94,7 @@ export function fix(cwd, config) {
|
|
|
61
94
|
const { root } = yield* loadConfig(cwd, config);
|
|
62
95
|
const sorted = yield* Effect.mapError(sortManifests(root), (failure) => new SetupFailure({ message: failure.message }));
|
|
63
96
|
yield* Console.log(`quality: sort-package-json rewrote ${plural(sorted, "manifest")}.`);
|
|
64
|
-
yield* settle({
|
|
97
|
+
yield* settle({ passes: biomePasses(root), snapshot: snapshotOf(root) });
|
|
65
98
|
});
|
|
66
99
|
}
|
|
67
100
|
//# sourceMappingURL=fix.js.map
|
package/dist/cli/fix.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fix.js","sourceRoot":"","sources":["../../src/cli/fix.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WA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,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QAC1B,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAChD,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,YAAY,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QACxH,KAAK,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,sCAAsC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC;QACxF,KAAK,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/cli/run-main.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { EventEmitter } from "node:events";
|
|
1
2
|
import { Effect, type FileSystem } from "effect";
|
|
2
3
|
import type { Git } from "../git/command.ts";
|
|
4
|
+
export declare function quietOnClosedPipe(stream: EventEmitter): void;
|
|
3
5
|
export declare const runMain: <Value, Error>(program: Effect.Effect<Value, Error, FileSystem.FileSystem | Git>) => void;
|
|
4
6
|
//# sourceMappingURL=run-main.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-main.d.ts","sourceRoot":"","sources":["../../src/cli/run-main.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"run-main.d.ts","sourceRoot":"","sources":["../../src/cli/run-main.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAMhD,OAAO,EAAkB,MAAM,EAAQ,KAAK,UAAU,EAAkB,MAAM,QAAQ,CAAC;AAEvF,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AA+B7C,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAM5D;AAID,eAAO,MAAM,OAAO,GAAI,KAAK,EAAE,KAAK,EAAE,SAAS,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,GAAG,GAAG,CAAC,KAAG,IAKzG,CAAC"}
|
package/dist/cli/run-main.js
CHANGED
|
@@ -24,8 +24,20 @@ const exitCode = (exit) => {
|
|
|
24
24
|
const teardown = (exit, onExit) => {
|
|
25
25
|
process.stdout.write("", () => process.stderr.write("", () => onExit(exitCode(exit))));
|
|
26
26
|
};
|
|
27
|
+
function isClosedPipe(error) {
|
|
28
|
+
return error instanceof Error && "code" in error && error.code === "EPIPE";
|
|
29
|
+
}
|
|
30
|
+
export function quietOnClosedPipe(stream) {
|
|
31
|
+
stream.on("error", (error) => {
|
|
32
|
+
if (!isClosedPipe(error)) {
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
27
37
|
const services = NodeChildProcessSpawner.layer.pipe(Layer.provideMerge(Layer.mergeAll(NodeFileSystem.layer, NodePath.layer)));
|
|
28
38
|
export const runMain = (program) => {
|
|
39
|
+
quietOnClosedPipe(process.stdout);
|
|
40
|
+
quietOnClosedPipe(process.stderr);
|
|
29
41
|
const explained = Effect.tapCause(program, (cause) => (Cause.hasInterruptsOnly(cause) ? Effect.void : explain(cause)));
|
|
30
42
|
NodeRuntime.runMain(Effect.provide(explained, services), { disableErrorReporting: true, teardown });
|
|
31
43
|
};
|
package/dist/cli/run-main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-main.js","sourceRoot":"","sources":["../../src/cli/run-main.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"run-main.js","sourceRoot":"","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BAAiB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAClC,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACvH,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE,EAAE,qBAAqB,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;AACrG,CAAC,CAAC"}
|
package/dist/config/decode.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Schema } from "effect";
|
|
|
2
2
|
import { type Decoded } from "../decoded.ts";
|
|
3
3
|
import type { Rule } from "../rule.ts";
|
|
4
4
|
declare const ConfigInput: Schema.Struct<{
|
|
5
|
+
readonly adopt: Schema.optionalKey<Schema.Never>;
|
|
5
6
|
readonly baseline: Schema.optionalKey<Schema.String>;
|
|
6
7
|
readonly exclude: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
7
8
|
readonly extensions: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../src/config/decode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../src/config/decode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAsBvC,QAAA,MAAM,WAAW;;;;;;;;;;;;EASf,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,IAAI,CAAC;AAIlD,eAAO,MAAM,YAAY,GAAI,OAAO,OAAO,KAAG,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAgC,CAAC"}
|
package/dist/config/decode.js
CHANGED
|
@@ -11,7 +11,11 @@ const isRule = (value) => typeof value === "object"
|
|
|
11
11
|
const Level = Schema.Literals(["error", "warn", "off"]);
|
|
12
12
|
const Setting = Schema.Union([Level, Schema.Struct({ level: Schema.optionalKey(Level), options: Schema.optionalKey(Schema.Unknown) })]);
|
|
13
13
|
const LocalRule = Schema.declare(isRule, { expected: "a rule made with defineRule" });
|
|
14
|
+
const AdoptRemoved = Schema.Never.annotate({
|
|
15
|
+
message: "removed in quality 0.7.0. Delete the key, and record a rule's existing findings with `quality baseline write --rule <id>`.",
|
|
16
|
+
});
|
|
14
17
|
const ConfigInput = Schema.Struct({
|
|
18
|
+
adopt: Schema.optionalKey(AdoptRemoved),
|
|
15
19
|
baseline: Schema.optionalKey(Schema.String),
|
|
16
20
|
exclude: Schema.optionalKey(Schema.Array(Schema.String)),
|
|
17
21
|
extensions: Schema.optionalKey(Schema.Array(Schema.String)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decode.js","sourceRoot":"","sources":["../../src/config/decode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAgB,UAAU,EAAE,MAAM,eAAe,CAAC;AAGzD,MAAM,MAAM,GAAG,CAAC,KAAc,EAAiB,EAAE,CAChD,OAAO,KAAK,KAAK,QAAQ;OACtB,KAAK,KAAK,IAAI;OACd,IAAI,IAAI,KAAK;OACb,OAAO,KAAK,CAAC,EAAE,KAAK,QAAQ;OAC5B,a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0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
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": {
|
package/src/cli/args.ts
CHANGED
|
@@ -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/fix.ts
CHANGED
|
@@ -17,61 +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
|
-
const formatted = (yield* biome(root, ["format", "--write"])).summary.changed;
|
|
35
|
-
yield* Console.log(
|
|
36
|
-
`quality: Biome round ${index} rewrote ${plural(fixed, "file")} with fixes and ${plural(formatted, "file")} with the format pass.`,
|
|
37
|
-
);
|
|
38
|
-
return fixed + formatted;
|
|
39
|
-
});
|
|
36
|
+
export interface Pass<Failure, Requirements> {
|
|
37
|
+
readonly label: string;
|
|
38
|
+
readonly run: Effect.Effect<number, Failure, Requirements>;
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
export interface Settling<Failure, Requirements> {
|
|
43
|
-
readonly
|
|
42
|
+
readonly passes: ReadonlyArray<Pass<Failure, Requirements>>;
|
|
44
43
|
readonly snapshot: Effect.Effect<ReadonlyMap<string, string>, Failure, Requirements>;
|
|
45
44
|
}
|
|
46
45
|
|
|
47
|
-
function
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
+
];
|
|
51
93
|
return new SetupFailure({
|
|
52
|
-
message: [
|
|
53
|
-
`Biome still rewrote files after ${MAX_FIX_ROUNDS} rounds, so quality fix stopped. These files changed in the last round:`,
|
|
54
|
-
...changed.map((path) => ` ${path}`),
|
|
55
|
-
"Two fixes probably undo each other there. Fix the code by hand, or turn off one of the rules.",
|
|
56
|
-
].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"),
|
|
57
95
|
});
|
|
58
96
|
}
|
|
59
97
|
|
|
60
98
|
export function settle<Failure, Requirements>({
|
|
61
|
-
|
|
99
|
+
passes,
|
|
62
100
|
snapshot,
|
|
63
101
|
}: Settling<Failure, Requirements>): Effect.Effect<void, Failure | SetupFailure, Requirements> {
|
|
64
102
|
return Effect.gen(function* () {
|
|
65
103
|
for (let index = 1; index < MAX_FIX_ROUNDS; index += 1) {
|
|
66
|
-
if ((yield* round(index)) === 0) {
|
|
104
|
+
if ((yield* round(passes, index, Effect.void)) === 0) {
|
|
67
105
|
return;
|
|
68
106
|
}
|
|
69
107
|
}
|
|
70
|
-
const
|
|
71
|
-
|
|
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) {
|
|
72
117
|
return;
|
|
73
118
|
}
|
|
74
|
-
return yield* unsettled(
|
|
119
|
+
return yield* unsettled(changed);
|
|
75
120
|
});
|
|
76
121
|
}
|
|
77
122
|
|
|
@@ -80,6 +125,6 @@ export function fix(cwd: string, config: string | undefined): Effect.Effect<void
|
|
|
80
125
|
const { root } = yield* loadConfig(cwd, config);
|
|
81
126
|
const sorted = yield* Effect.mapError(sortManifests(root), (failure) => new SetupFailure({ message: failure.message }));
|
|
82
127
|
yield* Console.log(`quality: sort-package-json rewrote ${plural(sorted, "manifest")}.`);
|
|
83
|
-
yield* settle({
|
|
128
|
+
yield* settle({ passes: biomePasses(root), snapshot: snapshotOf(root) });
|
|
84
129
|
});
|
|
85
130
|
}
|
package/src/cli/run-main.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
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";
|
|
@@ -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/config/decode.ts
CHANGED
|
@@ -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)),
|