@sshkeda/check 1.0.2 → 1.1.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/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Check sends your AI slop code back to the kitchen!
|
|
|
4
4
|
|
|
5
5
|
Check holds your TypeScript code to a strict standard built around Effect and Bun, so the code stays type-safe, observable and predictable.
|
|
6
6
|
|
|
7
|
-
It runs
|
|
7
|
+
It runs about 310 lint rules, 62 of them its own, and about 80 checks on your project's layout, imports and config. It also runs oxfmt, Effect's diagnostics and `bun check`. Your agent keeps fixing what it reports until the slop is gone.
|
|
8
8
|
|
|
9
9
|
No comment or setting turns a rule off everywhere. A small set of rules was picked to allow an override, and you grant each one to a single file in `oxlint.config.ts`. See [Grant a permission](docs/how-to-make-check-pass.md#grant-a-permission).
|
|
10
10
|
|
|
@@ -113,6 +113,14 @@ Check needs Bun 1.4.4 or newer and a Git repository.
|
|
|
113
113
|
"strict": true,
|
|
114
114
|
"noUncheckedIndexedAccess": true,
|
|
115
115
|
"exactOptionalPropertyTypes": true,
|
|
116
|
+
"noImplicitReturns": true,
|
|
117
|
+
"noUnusedLocals": true,
|
|
118
|
+
"noUnusedParameters": true,
|
|
119
|
+
"noPropertyAccessFromIndexSignature": true,
|
|
120
|
+
"noImplicitOverride": true,
|
|
121
|
+
"noFallthroughCasesInSwitch": true,
|
|
122
|
+
"allowUnreachableCode": false,
|
|
123
|
+
"allowUnusedLabels": false,
|
|
116
124
|
"allowImportingTsExtensions": true,
|
|
117
125
|
"types": ["bun"]
|
|
118
126
|
```
|
|
@@ -150,6 +158,10 @@ Check needs Bun 1.4.4 or newer and a Git repository.
|
|
|
150
158
|
bun scripts/ci.ts
|
|
151
159
|
```
|
|
152
160
|
|
|
161
|
+
## Make it yours
|
|
162
|
+
|
|
163
|
+
Check's rules are one opinion. To change them, clone the repo, add or remove rules, and use your copy instead of the npm package.
|
|
164
|
+
|
|
153
165
|
## Development
|
|
154
166
|
|
|
155
167
|
To run its checks and tests, run `bun scripts/ci.ts`. Check checks itself!
|
package/package.json
CHANGED
|
@@ -2,6 +2,7 @@ import { Effect, Record } from "effect";
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
LooseCompilerOption,
|
|
5
|
+
OPTIONS_TSC_LEAVES_UNSET,
|
|
5
6
|
REQUIRED_VALUES_OF_OPTIONS_OFF_BY_DEFAULT,
|
|
6
7
|
STRICT_OPTIONS,
|
|
7
8
|
TypeScriptConfigViolations,
|
|
@@ -28,10 +29,13 @@ const optionViolationsOf = (configFile: string) =>
|
|
|
28
29
|
resolvedValue:
|
|
29
30
|
(option === "allowImportingTsExtensions" &&
|
|
30
31
|
options["rewriteRelativeImportExtensions"] === true) ||
|
|
31
|
-
(options[option] ?? false),
|
|
32
|
+
(options[option] ?? (OPTIONS_TSC_LEAVES_UNSET.has(option) ? undefined : false)),
|
|
32
33
|
}),
|
|
33
34
|
),
|
|
34
35
|
].flatMap(({ option, required, resolvedValue }) => {
|
|
36
|
+
if (resolvedValue === undefined) {
|
|
37
|
+
return [new LooseCompilerOption({ projectFile: configFile, option })];
|
|
38
|
+
}
|
|
35
39
|
const isLoose = typeof resolvedValue === "boolean" && resolvedValue !== required;
|
|
36
40
|
return isLoose
|
|
37
41
|
? [new LooseCompilerOption({ projectFile: configFile, option, resolvedValue })]
|
|
@@ -405,9 +405,22 @@ export const REQUIRED_VALUES_OF_OPTIONS_OFF_BY_DEFAULT = {
|
|
|
405
405
|
noUncheckedIndexedAccess: true,
|
|
406
406
|
exactOptionalPropertyTypes: true,
|
|
407
407
|
allowImportingTsExtensions: true,
|
|
408
|
+
noImplicitReturns: true,
|
|
409
|
+
noUnusedLocals: true,
|
|
410
|
+
noUnusedParameters: true,
|
|
411
|
+
noPropertyAccessFromIndexSignature: true,
|
|
412
|
+
noImplicitOverride: true,
|
|
413
|
+
noFallthroughCasesInSwitch: true,
|
|
414
|
+
allowUnreachableCode: false,
|
|
415
|
+
allowUnusedLabels: false,
|
|
408
416
|
noCheck: false,
|
|
409
417
|
} as const;
|
|
410
418
|
|
|
419
|
+
export const OPTIONS_TSC_LEAVES_UNSET: ReadonlySet<string> = new Set([
|
|
420
|
+
"allowUnreachableCode",
|
|
421
|
+
"allowUnusedLabels",
|
|
422
|
+
]);
|
|
423
|
+
|
|
411
424
|
export class LooseCompilerOption extends Schema.TaggedError<LooseCompilerOption>()(
|
|
412
425
|
"LooseCompilerOption",
|
|
413
426
|
{
|
|
@@ -416,14 +429,16 @@ export class LooseCompilerOption extends Schema.TaggedError<LooseCompilerOption>
|
|
|
416
429
|
...STRICT_OPTIONS,
|
|
417
430
|
...Record.keys(REQUIRED_VALUES_OF_OPTIONS_OFF_BY_DEFAULT),
|
|
418
431
|
]),
|
|
419
|
-
resolvedValue: Schema.Boolean,
|
|
432
|
+
resolvedValue: Schema.optionalKey(Schema.Boolean),
|
|
420
433
|
},
|
|
421
434
|
) {
|
|
422
435
|
public get location() {
|
|
423
436
|
return this.projectFile;
|
|
424
437
|
}
|
|
425
438
|
public override get message() {
|
|
426
|
-
return
|
|
439
|
+
return this.resolvedValue === undefined
|
|
440
|
+
? `${this.option} is unset`
|
|
441
|
+
: `${this.option} resolves to ${this.resolvedValue}`;
|
|
427
442
|
}
|
|
428
443
|
}
|
|
429
444
|
|