@hailstails/hone 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  Every release of Hone, newest first. `pnpm run release-pull-request` writes each new section from the commits merged to `main` since the previous release tag, whose subjects are the squash-merged pull request titles; README.md's Compatibility section says what each kind of release may change. The sections below were written by hand from the merged pull requests when the changelog started.
4
4
 
5
+ ## 1.2.0
6
+
7
+ ### Features
8
+
9
+ - add CD-3 edition 2, judging the options a tsconfig.json resolves to through extends, and a required disk on the experimental audit WalkerRepository (#136)
10
+
5
11
  ## 1.1.0
6
12
 
7
13
  ### Features
package/api/audit.d.ts CHANGED
@@ -9,7 +9,7 @@ export type { ClauseId, DisciplineId, RuleSetName } from "../core/values/identif
9
9
  export type { RepoPath } from "../core/values/repo-path-types.js";
10
10
  export type { Result } from "../core/values/result.js";
11
11
  export type { CommentRange, SyntaxApi, SyntaxNode, SyntaxTree } from "../mechanisms/audit/runner/typescript-parse.js";
12
- export type { PieceHit, PreparedFileCheck, PreparedWalkerCheck, SourceObservers, WalkerFile, WalkerPiece, WalkerRepository } from "../mechanisms/audit/runner/walker-piece.js";
12
+ export type { PieceHit, PreparedFileCheck, PreparedWalkerCheck, SourceObservers, WalkerDisk, WalkerFile, WalkerPiece, WalkerRepository } from "../mechanisms/audit/runner/walker-piece.js";
13
13
  export declare const folderScope: (request: {
14
14
  readonly file: string;
15
15
  }) => "generated" | "authored";
package/api/testing.js CHANGED
@@ -5,15 +5,15 @@ import {
5
5
  loadRunner,
6
6
  rejectedCall,
7
7
  runnerInvalidOutput
8
- } from "../chunks/chunk-63SJV5ZY.js";
8
+ } from "../chunks/chunk-5VXHQC4A.js";
9
9
  import {
10
10
  caseVerdictSchema,
11
11
  runnerResultSchema
12
- } from "../chunks/chunk-BLGGM7AV.js";
12
+ } from "../chunks/chunk-H4V72FCW.js";
13
13
  import {
14
14
  readDisciplineFile,
15
15
  readPieceFile
16
- } from "../chunks/chunk-PVCA3ISA.js";
16
+ } from "../chunks/chunk-PL2PNPAR.js";
17
17
  import "../chunks/chunk-RWQ4UNKY.js";
18
18
  import "../chunks/chunk-NA5L6PUE.js";
19
19
  import {
@@ -25,7 +25,7 @@ import {
25
25
  createDefaultPathPort,
26
26
  moduleExtensionOf,
27
27
  repoPathSchema
28
- } from "../chunks/chunk-MZTLH4EU.js";
28
+ } from "../chunks/chunk-Y2KPZDDV.js";
29
29
  import {
30
30
  clauseAddressSchema,
31
31
  mechanismIdSchema
@@ -3,7 +3,7 @@ import {
3
3
  nativeExceptionKindSchema,
4
4
  projectionWriteSchema,
5
5
  runnerResultSchema
6
- } from "./chunk-BLGGM7AV.js";
6
+ } from "./chunk-H4V72FCW.js";
7
7
  import {
8
8
  JSON_KIND_NAMES,
9
9
  RESERVED_EDITION_SETTING,
@@ -16,7 +16,7 @@ import {
16
16
  readPieceFile,
17
17
  readVersionOneJson,
18
18
  sameJsonValue
19
- } from "./chunk-PVCA3ISA.js";
19
+ } from "./chunk-PL2PNPAR.js";
20
20
  import {
21
21
  NOT_INSTALLED,
22
22
  brandedRepoPathSchema,
@@ -24,7 +24,7 @@ import {
24
24
  repoPathSchema,
25
25
  repoPathTextSchema,
26
26
  runnerModuleSegmentsOf
27
- } from "./chunk-MZTLH4EU.js";
27
+ } from "./chunk-Y2KPZDDV.js";
28
28
  import {
29
29
  NOT_ADOPTED,
30
30
  NOT_RUN,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  repoPathSchema,
3
3
  snippetSchema
4
- } from "./chunk-MZTLH4EU.js";
4
+ } from "./chunk-Y2KPZDDV.js";
5
5
  import {
6
6
  clauseAddressObjectSchema
7
7
  } from "./chunk-FR4FASVM.js";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-RWQ4UNKY.js";
5
5
  import {
6
6
  repoPathSchema
7
- } from "./chunk-MZTLH4EU.js";
7
+ } from "./chunk-Y2KPZDDV.js";
8
8
  import {
9
9
  clauseIdSchema,
10
10
  disciplineIdSchema,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createDefaultPathPort,
3
3
  installRootAboveEntry
4
- } from "./chunk-MZTLH4EU.js";
4
+ } from "./chunk-Y2KPZDDV.js";
5
5
 
6
6
  // core/mechanism-port/toolchain-bound-runner.ts
7
7
  var builtOnce = (request) => request.toolchain.then((loaded) => loaded.outcome === "failed" ? loaded : { outcome: "ok", value: request.runnerOf(loaded.value) });
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-MXSIQPCV.js";
4
4
 
5
5
  // core/platform-ports/file-system-port.ts
6
- import { accessSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
6
+ import { accessSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
7
7
  var NO_SUCH_FILE_CODE = "ENOENT";
8
8
  var presenceAfterAccessFailure = (request) => request.thrown instanceof Error && "code" in request.thrown && request.thrown.code === NO_SUCH_FILE_CODE ? "absent" : "present";
9
9
  var failureDetail = (request) => request.thrown instanceof Error ? request.thrown.message : String(request.thrown);
@@ -114,6 +114,25 @@ var defaultDirectorySurface = {
114
114
  var createDefaultDirectoryPort = (_options) => createDirectoryPort({
115
115
  directory: defaultDirectorySurface
116
116
  });
117
+ var createEntryKindPort = (options) => ({
118
+ kindOf: (request) => {
119
+ try {
120
+ return options.surface.stat({ path: request.path }) ?? "absent";
121
+ } catch {
122
+ return "absent";
123
+ }
124
+ }
125
+ });
126
+ var defaultEntryKindSurface = {
127
+ stat: (request) => {
128
+ const found = statSync(request.path, { throwIfNoEntry: false });
129
+ if (found === void 0) {
130
+ return void 0;
131
+ }
132
+ return found.isDirectory() ? "directory" : "file";
133
+ }
134
+ };
135
+ var createDefaultEntryKindPort = (_options) => createEntryKindPort({ surface: defaultEntryKindSurface });
117
136
 
118
137
  // core/platform-ports/path-port.ts
119
138
  import platformPath, { posix, win32 } from "node:path";
@@ -442,6 +461,7 @@ export {
442
461
  createDefaultFileTextPort,
443
462
  createDefaultFileRemovalPort,
444
463
  createDefaultDirectoryPort,
464
+ createDefaultEntryKindPort,
445
465
  isRepoPathText,
446
466
  repoPathTextSchema,
447
467
  brandedRepoPathSchema,
@@ -27,13 +27,13 @@ import {
27
27
  runCheck,
28
28
  runnerFailed,
29
29
  shownFailureOf
30
- } from "../../chunks/chunk-63SJV5ZY.js";
31
- import "../../chunks/chunk-BLGGM7AV.js";
30
+ } from "../../chunks/chunk-5VXHQC4A.js";
31
+ import "../../chunks/chunk-H4V72FCW.js";
32
32
  import "../../chunks/chunk-YLZ73C7O.js";
33
33
  import {
34
34
  parsedJson,
35
35
  readVersionOneJson
36
- } from "../../chunks/chunk-PVCA3ISA.js";
36
+ } from "../../chunks/chunk-PL2PNPAR.js";
37
37
  import "../../chunks/chunk-RWQ4UNKY.js";
38
38
  import "../../chunks/chunk-NA5L6PUE.js";
39
39
  import {
@@ -45,7 +45,7 @@ import {
45
45
  createDefaultPathPort,
46
46
  moduleExtensionOf,
47
47
  repoPathSchema
48
- } from "../../chunks/chunk-MZTLH4EU.js";
48
+ } from "../../chunks/chunk-Y2KPZDDV.js";
49
49
  import {
50
50
  TOOL_IDENTITY,
51
51
  TOOL_RULE_SET,
package/docs/extending.md CHANGED
@@ -223,7 +223,7 @@ export const check: WalkerPiece = {
223
223
  ```
224
224
 
225
225
  - `module` is a path inside the piece folder, and the module exports `check`.
226
- - `prepare` runs once with the selected clauses, the repository's file list and TypeScript's syntax API. `prepareFile` runs once per tracked file and returns `skipped`, `complete` with its hits, or `syntax` with observers that walk the file's syntax tree. `finish` returns hits that need the whole repository.
226
+ - `prepare` runs once with the selected clauses, the repository's file list and TypeScript's syntax API. The repository also carries a `disk`, a required field: its `root`, the kind of entry at an absolute path (`kindAt`) and a file's text (`textAt`), for a piece that must read files beyond the one it is given, untracked ones included. In a conformance case the disk holds only the case's file. A piece's own tests that build a `WalkerRepository` by hand must now give it a `disk` (the type is `WalkerDisk` from `@hailstails/hone/audit`), as the example's proof does. Such tests written before the field was added no longer type-check until they give it one. `prepareFile` runs once per tracked file and returns `skipped`, `complete` with its hits, or `syntax` with observers that walk the file's syntax tree. `finish` returns hits that need the whole repository.
227
227
  - A hit passes back the clause's `address` unchanged, a 1-based line and 0-based column, and a short snippet.
228
228
  - When the piece cannot run, for example on settings it does not accept, return a failed result whose error is a `PieceFailure`: `kind` `piece-invalid`, the clause's `pieceRoot` and a `detail`. `hone check` then stops with a load failure naming the piece folder.
229
229
  - When the piece cannot parse a file, return a failed result whose error is `kind` `file-unparseable`, the `file` and a `detail`. `hone check` then stops with `load failure: runner-failed audit file-unparseable <file> <detail>`.
@@ -1,3 +1,10 @@
1
+ import {
2
+ editionSchema
3
+ } from "../../../chunks/chunk-RWQ4UNKY.js";
4
+ import {
5
+ editionReaches
6
+ } from "../../../chunks/chunk-NA5L6PUE.js";
7
+ import "../../../chunks/chunk-MXSIQPCV.js";
1
8
  import {
2
9
  folderScope
3
10
  } from "../../../chunks/chunk-QWA6OVLC.js";
@@ -35,12 +42,107 @@ var createDefaultJsoncParsePort = (options) => createJsoncParsePort({
35
42
  parseProvider: defaultProviderCallOf(options)
36
43
  });
37
44
 
38
- // mechanisms/audit/CD-3/compiler-overrides.ts
39
- var configEligibility = (request) => {
40
- if (request.file.split("/").at(-1) !== "tsconfig.json") return "excluded";
41
- if (folderScope({ file: request.file }) === "generated") return "excluded";
42
- return "eligible";
45
+ // mechanisms/audit/CD-3/typescript-compiler-options.ts
46
+ var FILE_LIST_DIAGNOSTICS = [18002, 18003];
47
+ var STRICT_FAMILY = ["strict", "useUnknownInCatchVariables"];
48
+ var WILDCARD = /[*?]/;
49
+ var recordingHostOf = (request) => {
50
+ const listed = [];
51
+ return {
52
+ host: {
53
+ useCaseSensitiveFileNames: request.syntaxApi.sys.useCaseSensitiveFileNames,
54
+ fileExists: (path) => request.disk.kindAt({ path }) === "file",
55
+ directoryExists: (path) => request.disk.kindAt({ path }) === "directory",
56
+ readFile: (path) => {
57
+ const text = request.disk.textAt({ path });
58
+ return text.outcome === "ok" ? text.value : void 0;
59
+ },
60
+ readDirectory: (...listing) => {
61
+ const [, , , includes] = listing;
62
+ listed.push(...includes);
63
+ return [];
64
+ },
65
+ getCurrentDirectory: () => request.root
66
+ },
67
+ includesListed: () => listed
68
+ };
69
+ };
70
+ var shownPath = (request) => request.path.startsWith(`${request.root}/`) ? request.path.slice(request.root.length + 1) : request.path;
71
+ var shownText = (request) => request.text.split(`${request.root}/`).join("");
72
+ var folderOf = (request) => request.path.slice(0, request.path.lastIndexOf("/"));
73
+ var stateOf = (request) => request.turnedOn === true ? "on" : "off";
74
+ var settingOf = (request) => {
75
+ const setting = Object.entries(request.compilerOptions).find(([key]) => key === request.option)?.[1];
76
+ return typeof setting === "boolean" ? stateOf({ turnedOn: setting }) : "unset";
77
+ };
78
+ var settingsOf = (request) => {
79
+ const config = request.config;
80
+ const compilerOptions = typeof config === "object" && config !== null && "compilerOptions" in config ? config.compilerOptions : void 0;
81
+ const options = typeof compilerOptions === "object" && compilerOptions !== null ? compilerOptions : {};
82
+ return {
83
+ strict: settingOf({ compilerOptions: options, option: "strict" }),
84
+ noUncheckedIndexedAccess: settingOf({ compilerOptions: options, option: "noUncheckedIndexedAccess" }),
85
+ exactOptionalPropertyTypes: settingOf({ compilerOptions: options, option: "exactOptionalPropertyTypes" }),
86
+ noImplicitOverride: settingOf({ compilerOptions: options, option: "noImplicitOverride" }),
87
+ noFallthroughCasesInSwitch: settingOf({ compilerOptions: options, option: "noFallthroughCasesInSwitch" }),
88
+ noPropertyAccessFromIndexSignature: settingOf({ compilerOptions: options, option: "noPropertyAccessFromIndexSignature" }),
89
+ useUnknownInCatchVariables: settingOf({ compilerOptions: options, option: "useUnknownInCatchVariables" })
90
+ };
91
+ };
92
+ var strictFamilyStateOf = (request) => {
93
+ const api = request.syntaxApi;
94
+ if ("getStrictOptionValue" in api && typeof api.getStrictOptionValue === "function") {
95
+ return stateOf({ turnedOn: api.getStrictOptionValue(request.options, request.option) });
96
+ }
97
+ return stateOf({ turnedOn: request.options[request.option] ?? request.options.strict });
98
+ };
99
+ var effectiveValueOf = (request) => STRICT_FAMILY.includes(request.option) ? strictFamilyStateOf(request) : stateOf({ turnedOn: request.options[request.option] });
100
+ var effectiveOf = (request) => ({
101
+ strict: effectiveValueOf({ ...request, option: "strict" }),
102
+ noUncheckedIndexedAccess: effectiveValueOf({ ...request, option: "noUncheckedIndexedAccess" }),
103
+ exactOptionalPropertyTypes: effectiveValueOf({ ...request, option: "exactOptionalPropertyTypes" }),
104
+ noImplicitOverride: effectiveValueOf({ ...request, option: "noImplicitOverride" }),
105
+ noFallthroughCasesInSwitch: effectiveValueOf({ ...request, option: "noFallthroughCasesInSwitch" }),
106
+ noPropertyAccessFromIndexSignature: effectiveValueOf({ ...request, option: "noPropertyAccessFromIndexSignature" }),
107
+ useUnknownInCatchVariables: effectiveValueOf({ ...request, option: "useUnknownInCatchVariables" })
108
+ });
109
+ var baseOf = (request) => ({
110
+ file: shownPath(request),
111
+ settings: settingsOf({ config: request.syntaxApi.readConfigFile(request.path, request.host.readFile).config })
112
+ });
113
+ var unresolvedDetail = (request) => request.diagnostics.map((diagnostic) => `TS${diagnostic.code} ${shownText({ ...request, text: request.syntaxApi.flattenDiagnosticMessageText(diagnostic.messageText, " ") })}`).join("; ");
114
+ var compiledFilesOf = (request) => {
115
+ if (request.parsed.fileNames.length > 0) return "some";
116
+ if (Object.keys(request.parsed.wildcardDirectories ?? {}).length > 0) return "some";
117
+ return request.includesListed.some((include) => !WILDCARD.test(include)) ? "some" : "none";
118
+ };
119
+ var resolvedConfigOf = (request) => {
120
+ const host = request.recording.host;
121
+ const source = request.syntaxApi.readJsonConfigFile(request.path, host.readFile);
122
+ const parsed = request.syntaxApi.parseJsonSourceFileConfigFileContent(source, host, folderOf(request), void 0, request.path);
123
+ const diagnostics = parsed.errors.filter((diagnostic) => !FILE_LIST_DIAGNOSTICS.includes(diagnostic.code));
124
+ if (diagnostics.length > 0) return { kind: "unresolved", detail: unresolvedDetail({ ...request, diagnostics }) };
125
+ if (compiledFilesOf({ parsed, includesListed: request.recording.includesListed() }) === "none") return { kind: "compiles-nothing" };
126
+ return {
127
+ kind: "resolved",
128
+ effective: effectiveOf({ syntaxApi: request.syntaxApi, options: parsed.options }),
129
+ bases: (source.extendedSourceFiles ?? []).map((path) => baseOf({ ...request, host, path }))
130
+ };
43
131
  };
132
+ var typeScriptCompilerOptionsOf = ({ syntaxApi, disk }) => {
133
+ const root = disk.root.split("\\").join("/");
134
+ return {
135
+ resolve: ({ file }) => {
136
+ const recording = recordingHostOf({ syntaxApi, disk, root });
137
+ return resolvedConfigOf({ syntaxApi, recording, root, path: `${root}/${file}` });
138
+ }
139
+ };
140
+ };
141
+
142
+ // mechanisms/audit/CD-3/compiler-overrides.ts
143
+ var RESOLVING_EDITION = editionSchema.parse("2");
144
+ var IMPLIED_BY_STRICT = ["useUnknownInCatchVariables"];
145
+ var FILE_ANCHOR = { line: 1, column: 0 };
44
146
  var STRICT_FLAGS = [
45
147
  { clause: "strict", option: "strict" },
46
148
  { clause: "no-unchecked-indexed-access", option: "noUncheckedIndexedAccess" },
@@ -50,9 +152,85 @@ var STRICT_FLAGS = [
50
152
  { clause: "no-property-access-from-index-signature", option: "noPropertyAccessFromIndexSignature" },
51
153
  { clause: "use-unknown-in-catch-variables", option: "useUnknownInCatchVariables" }
52
154
  ];
155
+ var configEligibility = (request) => {
156
+ if (request.file.split("/").at(-1) !== "tsconfig.json") return "excluded";
157
+ if (folderScope({ file: request.file }) === "generated") return "excluded";
158
+ return "eligible";
159
+ };
160
+ var selectedFlagsOf = (request) => STRICT_FLAGS.flatMap(
161
+ (flag) => request.clauses.filter((clause) => clause.address.discipline === "CD-3" && clause.address.clause === flag.clause).map((clause) => ({
162
+ address: clause.address,
163
+ option: flag.option,
164
+ judges: editionReaches({ edition: clause.edition, introducedIn: RESOLVING_EDITION }) === "reached" ? "resolved-options" : "own-options"
165
+ }))
166
+ );
167
+ var unparseable = (request) => ({
168
+ outcome: "failed",
169
+ error: { kind: "file-unparseable", file: request.file, detail: request.detail }
170
+ });
171
+ var ownOptionsOf = (request) => {
172
+ const config = request.config;
173
+ if (typeof config !== "object" || config === null || Array.isArray(config)) {
174
+ return unparseable({ file: request.file, detail: "configuration root must be an object" });
175
+ }
176
+ if (!("compilerOptions" in config)) return { outcome: "ok", value: [] };
177
+ const compilerOptions = config.compilerOptions;
178
+ if (typeof compilerOptions !== "object" || compilerOptions === null || Array.isArray(compilerOptions)) {
179
+ return unparseable({ file: request.file, detail: "compilerOptions must be an object" });
180
+ }
181
+ return { outcome: "ok", value: Object.entries(compilerOptions) };
182
+ };
183
+ var ownEntryOf = (request) => request.options.find(([key]) => key === request.option);
184
+ var ownSettingsOf = (request) => {
185
+ const strict = ownEntryOf({ options: request.options, option: "strict" })?.[1];
186
+ if (strict === true) return { strict: "on" };
187
+ return { strict: strict === false ? "off" : "unset" };
188
+ };
189
+ var turnsOff = (request) => {
190
+ const own = request.settings[request.option] ?? "unset";
191
+ if (own === "off") return "turns-off";
192
+ return own === "unset" && IMPLIED_BY_STRICT.includes(request.option) && request.settings.strict === "off" ? "turns-off" : "leaves";
193
+ };
194
+ var resolvedSnippet = (request) => {
195
+ const { option, resolved } = request;
196
+ if (resolved.effective[option] === "on") return void 0;
197
+ const thisFileTurnsOff = turnsOff({ settings: ownSettingsOf({ options: request.config.options }), option });
198
+ const offBases = resolved.bases.filter((base) => turnsOff({ settings: base.settings, option }) === "turns-off").map((base) => base.file);
199
+ if (thisFileTurnsOff === "turns-off") return `compilerOptions.${option} = false, turned off in ${[request.config.file, ...offBases].join(", ")}`;
200
+ if (offBases.length > 0) return `compilerOptions.${option} = false, inherited from ${offBases.join(", ")}`;
201
+ if (resolved.bases.length === 0) return `compilerOptions.${option} unset, and this file extends no base`;
202
+ return `compilerOptions.${option} unset here and in ${resolved.bases.map((base) => base.file).join(", ")}`;
203
+ };
204
+ var judgedSnippet = (request) => {
205
+ switch (request.resolved.kind) {
206
+ case "unresolved":
207
+ return `compilerOptions.${request.option} unknown: ${request.resolved.detail}`;
208
+ case "compiles-nothing":
209
+ return void 0;
210
+ case "resolved":
211
+ return resolvedSnippet({ config: request.config, resolved: request.resolved, option: request.option });
212
+ }
213
+ };
214
+ var presenceHit = (request) => ({
215
+ clause: request.flag.address,
216
+ anchor: FILE_ANCHOR,
217
+ snippet: `compilerOptions.${request.flag.option} = ${JSON.stringify(request.value)}`
218
+ });
219
+ var resolutionNeed = (request) => request.flags.some((flag) => flag.judges === "resolved-options" && ownEntryOf({ options: request.config.options, option: flag.option }) === void 0) ? "needed" : "not-needed";
220
+ var hitsOf = (request) => {
221
+ const resolved = resolutionNeed(request) === "needed" ? request.resolution.resolve({ file: request.config.file }) : void 0;
222
+ return request.flags.flatMap((flag) => {
223
+ const own = ownEntryOf({ options: request.config.options, option: flag.option });
224
+ if (own !== void 0) return [presenceHit({ flag, value: own[1] })];
225
+ if (flag.judges === "own-options" || resolved === void 0) return [];
226
+ const snippet = judgedSnippet({ config: request.config, resolved, option: flag.option });
227
+ return snippet === void 0 ? [] : [{ clause: flag.address, anchor: FILE_ANCHOR, snippet }];
228
+ });
229
+ };
53
230
  var createCompilerOverridesCheck = (options) => ({
54
- prepare: ({ clauses }) => {
55
- const selectedFlags = STRICT_FLAGS.flatMap((flag) => clauses.filter((clause) => clause.address.discipline === "CD-3" && clause.address.clause === flag.clause).map((clause) => ({ address: clause.address, option: flag.option })));
231
+ prepare: ({ clauses, repository, syntaxApi }) => {
232
+ const flags = selectedFlagsOf({ clauses });
233
+ const resolution = options.resolutionOf({ syntaxApi, disk: repository.disk });
56
234
  return {
57
235
  outcome: "ok",
58
236
  value: {
@@ -61,27 +239,10 @@ var createCompilerOverridesCheck = (options) => ({
61
239
  const text = readText();
62
240
  if (text.outcome === "failed") return text;
63
241
  const parsed = options.jsonc.parse({ source: text.value });
64
- if (parsed.outcome === "failed") {
65
- return { outcome: "failed", error: { kind: "file-unparseable", file, detail: parsed.error.detail } };
66
- }
67
- const config = parsed.value;
68
- if (typeof config !== "object" || config === null || Array.isArray(config)) {
69
- return { outcome: "failed", error: { kind: "file-unparseable", file, detail: "configuration root must be an object" } };
70
- }
71
- if (!("compilerOptions" in config)) return { outcome: "ok", value: { kind: "complete", hits: [] } };
72
- const compilerOptions = config.compilerOptions;
73
- if (typeof compilerOptions !== "object" || compilerOptions === null || Array.isArray(compilerOptions)) {
74
- return { outcome: "failed", error: { kind: "file-unparseable", file, detail: "compilerOptions must be an object" } };
75
- }
76
- const entries = Object.entries(compilerOptions);
77
- const hits = selectedFlags.flatMap((flag) => {
78
- const entry = entries.find(([key]) => key === flag.option);
79
- return entry === void 0 ? [] : [{
80
- clause: flag.address,
81
- anchor: { line: 1, column: 0 },
82
- snippet: `compilerOptions.${flag.option} = ${JSON.stringify(entry[1])}`
83
- }];
84
- });
242
+ if (parsed.outcome === "failed") return unparseable({ file, detail: parsed.error.detail });
243
+ const own = ownOptionsOf({ file, config: parsed.value });
244
+ if (own.outcome === "failed") return own;
245
+ const hits = hitsOf({ config: { file, options: own.value }, flags, resolution });
85
246
  return { outcome: "ok", value: { kind: "complete", hits } };
86
247
  },
87
248
  finish: () => ({ outcome: "ok", value: [] })
@@ -89,7 +250,10 @@ var createCompilerOverridesCheck = (options) => ({
89
250
  };
90
251
  }
91
252
  });
92
- var check = createCompilerOverridesCheck({ jsonc: createDefaultJsoncParsePort({ trailingCommas: "refused" }) });
253
+ var check = createCompilerOverridesCheck({
254
+ jsonc: createDefaultJsoncParsePort({ trailingCommas: "refused" }),
255
+ resolutionOf: typeScriptCompilerOptionsOf
256
+ });
93
257
  export {
94
258
  check,
95
259
  createCompilerOverridesCheck
@@ -7,43 +7,71 @@
7
7
  "clause": "strict",
8
8
  "settings": {
9
9
  "module": "compiler-overrides.js"
10
- }
10
+ },
11
+ "editions": [
12
+ "1",
13
+ "2"
14
+ ]
11
15
  },
12
16
  {
13
17
  "clause": "no-unchecked-indexed-access",
14
18
  "settings": {
15
19
  "module": "compiler-overrides.js"
16
- }
20
+ },
21
+ "editions": [
22
+ "1",
23
+ "2"
24
+ ]
17
25
  },
18
26
  {
19
27
  "clause": "exact-optional-property-types",
20
28
  "settings": {
21
29
  "module": "compiler-overrides.js"
22
- }
30
+ },
31
+ "editions": [
32
+ "1",
33
+ "2"
34
+ ]
23
35
  },
24
36
  {
25
37
  "clause": "no-implicit-override",
26
38
  "settings": {
27
39
  "module": "compiler-overrides.js"
28
- }
40
+ },
41
+ "editions": [
42
+ "1",
43
+ "2"
44
+ ]
29
45
  },
30
46
  {
31
47
  "clause": "no-fallthrough-cases-in-switch",
32
48
  "settings": {
33
49
  "module": "compiler-overrides.js"
34
- }
50
+ },
51
+ "editions": [
52
+ "1",
53
+ "2"
54
+ ]
35
55
  },
36
56
  {
37
57
  "clause": "no-property-access-from-index-signature",
38
58
  "settings": {
39
59
  "module": "compiler-overrides.js"
40
- }
60
+ },
61
+ "editions": [
62
+ "1",
63
+ "2"
64
+ ]
41
65
  },
42
66
  {
43
67
  "clause": "use-unknown-in-catch-variables",
44
68
  "settings": {
45
69
  "module": "compiler-overrides.js"
46
- }
70
+ },
71
+ "editions": [
72
+ "1",
73
+ "2"
74
+ ]
47
75
  }
48
76
  ]
49
77
  }
@@ -10,7 +10,8 @@ The audit runner is Hone's standalone mechanism for checks that read a project's
10
10
 
11
11
  ## Files
12
12
 
13
- - `walker-piece.ts` declares the contract a piece implements, `WalkerPiece`: a `prepare` call that receives the piece's selected clauses, the repository's tracked paths and TypeScript's API, and returns a prepared check with per-file `prepareFile` and a repository-wide `finish`.
13
+ - `walker-piece.ts` declares the contract a piece implements, `WalkerPiece`: a `prepare` call that receives the piece's selected clauses, the repository's tracked paths with a `disk` for reading files around them, such as a base config under `node_modules`, and TypeScript's API, and returns a prepared check with per-file `prepareFile` and a repository-wide `finish`.
14
+ - `walker-disk.ts` builds the `disk` a piece is handed: for a run, the real files under the repository root, untracked ones included, read through the file ports; for a conformance case, the case's texts in memory.
14
15
  - `source-scope.ts` classifies a repository path as `generated` (under `node_modules`, `dist`, `build`, `coverage`, `.git`, or a root `vendor`) or `authored`, so every piece skips generated folders the same way.
15
16
  - `walker-check-schema.ts` holds the schema for a clause's settings: `module`, a path inside the piece folder ending `.ts`, and optionally `escapingDirectives`, the TypeScript directives that escape the clause.
16
17
  - `type-directives.ts` reads a comment as a TypeScript directive only where the compiler honours it, and turns each directive a clause lists into an `inline-disable` of that clause. A piece that judges directives reads them through it too.
@@ -35,6 +36,6 @@ The runner offers the piece every tracked path in the repository, and the piece
35
36
 
36
37
  After every file, the prepared check's `finish` may return repository-wide hits, each naming its file. Every hit names one of the piece's selected clauses and carries a snippet the piece chooses.
37
38
 
38
- `conform` runs each case of a clause's `discipline.json` as a one-file repository holding only that case.
39
+ `conform` runs each case of a clause's `discipline.json` as a one-file repository holding only that case, whose `disk` holds only the case's file under the root `/repository`.
39
40
 
40
41
  A piece that throws, or returns a value outside its schema, makes the run fail as `piece-invalid`. A piece that cannot parse a file returns a failed result whose error is `{ kind: "file-unparseable", file, detail }`, and the check stops with `load failure: runner-failed audit file-unparseable <file> <detail>`.
@@ -6,16 +6,17 @@ import {
6
6
  import {
7
7
  hitSchema,
8
8
  runnerResultSchema
9
- } from "../../../chunks/chunk-BLGGM7AV.js";
9
+ } from "../../../chunks/chunk-H4V72FCW.js";
10
10
  import {
11
11
  createDefaultPackageLocationPort,
12
12
  installRootOfRunnerEntry,
13
13
  toolchainBoundStandaloneRunner
14
- } from "../../../chunks/chunk-CBWWAKQY.js";
14
+ } from "../../../chunks/chunk-T32FOWZA.js";
15
15
  import {
16
16
  gatheredOutcomes
17
17
  } from "../../../chunks/chunk-LDQUT742.js";
18
18
  import {
19
+ createDefaultEntryKindPort,
19
20
  createDefaultFileTextPort,
20
21
  createDefaultModuleLoaderPort,
21
22
  createDefaultPathPort,
@@ -24,7 +25,7 @@ import {
24
25
  loadedPeer,
25
26
  moduleExtensionOf,
26
27
  moduleFileForm
27
- } from "../../../chunks/chunk-MZTLH4EU.js";
28
+ } from "../../../chunks/chunk-Y2KPZDDV.js";
28
29
  import {
29
30
  sameClauseAddress
30
31
  } from "../../../chunks/chunk-FR4FASVM.js";
@@ -388,6 +389,38 @@ var walkerPieceSettingsSchema = z3.object({
388
389
  escapingDirectives: z3.array(z3.enum(TYPE_DIRECTIVES)).readonly().optional()
389
390
  }).readonly();
390
391
 
392
+ // mechanisms/audit/runner/walker-disk.ts
393
+ var CASE_ROOT = "/repository";
394
+ var portsDisk = (request) => ({
395
+ root: request.root,
396
+ kindAt: ({ path }) => request.entryKind.kindOf({ path }),
397
+ textAt: ({ path }) => {
398
+ const text = request.fileText.read({ path });
399
+ return text.outcome === "failed" ? { outcome: "failed", error: { detail: text.error.detail } } : text;
400
+ }
401
+ });
402
+ var foldersHolding = (request) => {
403
+ const segments = request.path.split("/");
404
+ return segments.slice(1, -1).map((_, depth) => segments.slice(0, depth + 2).join("/"));
405
+ };
406
+ var textsDisk = (request) => {
407
+ const files = new Map(Object.entries(request.texts).map(([file, text]) => [`${request.root}/${file}`, text]));
408
+ const folders = /* @__PURE__ */ new Set([request.root, ...[...files.keys()].flatMap((path) => foldersHolding({ path }))]);
409
+ return {
410
+ root: request.root,
411
+ kindAt: ({ path }) => {
412
+ if (files.has(path)) {
413
+ return "file";
414
+ }
415
+ return folders.has(path) ? "directory" : "absent";
416
+ },
417
+ textAt: ({ path }) => {
418
+ const text = files.get(path);
419
+ return text === void 0 ? { outcome: "failed", error: { detail: `${path} is not a file` } } : { outcome: "ok", value: text };
420
+ }
421
+ };
422
+ };
423
+
391
424
  // mechanisms/audit/runner/create-walker-runner.ts
392
425
  var finishedHitsSchema = runnerResultSchema({ value: z4.array(hitSchema).readonly() });
393
426
  var pieceInvalid3 = (request) => ({
@@ -508,7 +541,8 @@ var runOverRepository = (request) => {
508
541
  files: request.run.trackedPaths,
509
542
  exists: ({ file }) => request.ports.fileText.exists({
510
543
  path: request.ports.path.join({ segments: [request.run.repoRoot, file] })
511
- })
544
+ }),
545
+ disk: portsDisk({ root: request.run.repoRoot, entryKind: request.ports.entryKind, fileText: request.ports.fileText })
512
546
  };
513
547
  return preparedPieces({ ports: request.ports, clauses: request.run.clauses, repository }).then((prepared) => {
514
548
  if (prepared.outcome === "failed") return prepared;
@@ -529,7 +563,8 @@ var caseFile = (request) => ({
529
563
  var caseVerdict = (request) => {
530
564
  const repository = {
531
565
  files: [request.sourceCase.fileName],
532
- exists: ({ file }) => file === request.sourceCase.fileName ? "present" : "absent"
566
+ exists: ({ file }) => file === request.sourceCase.fileName ? "present" : "absent",
567
+ disk: textsDisk({ root: CASE_ROOT, texts: { [request.sourceCase.fileName]: request.sourceCase.source } })
533
568
  };
534
569
  return preparedPieces({ ports: request.ports, clauses: [request.clause], repository }).then((prepared) => {
535
570
  if (prepared.outcome === "failed") return prepared;
@@ -611,7 +646,8 @@ var runner = toolchainBoundStandaloneRunner({
611
646
  fileText: createDefaultFileTextPort({}),
612
647
  modules: createDefaultModuleLoaderPort({}),
613
648
  path: createDefaultPathPort({}),
614
- parse
649
+ parse,
650
+ entryKind: createDefaultEntryKindPort({})
615
651
  })
616
652
  });
617
653
  export {
@@ -45,11 +45,23 @@ export type PreparedWalkerCheck = {
45
45
  readonly prepareFile: (request: WalkerFile) => Result<PreparedFileCheck, PieceFailure>;
46
46
  readonly finish: () => Result<readonly Hit[], PieceFailure>;
47
47
  };
48
+ export type WalkerDisk = {
49
+ readonly root: string;
50
+ readonly kindAt: (request: {
51
+ readonly path: string;
52
+ }) => "file" | "directory" | "absent";
53
+ readonly textAt: (request: {
54
+ readonly path: string;
55
+ }) => Result<string, {
56
+ readonly detail: string;
57
+ }>;
58
+ };
48
59
  export type WalkerRepository = {
49
60
  readonly files: readonly RepoPath[];
50
61
  readonly exists: (request: {
51
62
  readonly file: RepoPath;
52
63
  }) => "present" | "absent";
64
+ readonly disk: WalkerDisk;
53
65
  };
54
66
  export type WalkerPiece = {
55
67
  readonly prepare: (request: {
@@ -2,14 +2,14 @@ import "../../../chunks/chunk-YLZ73C7O.js";
2
2
  import {
3
3
  eslintConfigLookupSchema,
4
4
  parsedJson
5
- } from "../../../chunks/chunk-PVCA3ISA.js";
5
+ } from "../../../chunks/chunk-PL2PNPAR.js";
6
6
  import "../../../chunks/chunk-RWQ4UNKY.js";
7
7
  import "../../../chunks/chunk-NA5L6PUE.js";
8
8
  import {
9
9
  createDefaultPackageLocationPort,
10
10
  installRootOfRunnerEntry,
11
11
  toolchainBoundEmbeddedRunner
12
- } from "../../../chunks/chunk-CBWWAKQY.js";
12
+ } from "../../../chunks/chunk-T32FOWZA.js";
13
13
  import {
14
14
  gatheredOutcomes,
15
15
  listedOutcome
@@ -31,7 +31,7 @@ import {
31
31
  moduleFileForm,
32
32
  repoPathSchema,
33
33
  versionSupport
34
- } from "../../../chunks/chunk-MZTLH4EU.js";
34
+ } from "../../../chunks/chunk-Y2KPZDDV.js";
35
35
  import {
36
36
  TOOL_IDENTITY,
37
37
  clauseAddressText,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hailstails/hone",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Checks a repository against the disciplines it selects, applies its recorded exceptions and prints one verdict.",
5
5
  "keywords": [
6
6
  "disciplines",
@@ -6,19 +6,30 @@ Read [the rule and its spirit](README.md) first. This page is the mechanics: how
6
6
 
7
7
  | Clause | Mechanism | Checks |
8
8
  | --- | --- | --- |
9
- | `CD-3#strict` | audit | `strict` is set in a `tsconfig.json` |
10
- | `CD-3#no-unchecked-indexed-access` | audit | `noUncheckedIndexedAccess` is set |
11
- | `CD-3#exact-optional-property-types` | audit | `exactOptionalPropertyTypes` is set |
12
- | `CD-3#no-implicit-override` | audit | `noImplicitOverride` is set |
13
- | `CD-3#no-fallthrough-cases-in-switch` | audit | `noFallthroughCasesInSwitch` is set |
14
- | `CD-3#no-property-access-from-index-signature` | audit | `noPropertyAccessFromIndexSignature` is set |
15
- | `CD-3#use-unknown-in-catch-variables` | audit | `useUnknownInCatchVariables` is set |
9
+ | `CD-3#strict` | audit | `strict` is set in a `tsconfig.json`; edition 2 adds that it resolves to on |
10
+ | `CD-3#no-unchecked-indexed-access` | audit | `noUncheckedIndexedAccess` is set; edition 2 adds that it resolves to on |
11
+ | `CD-3#exact-optional-property-types` | audit | `exactOptionalPropertyTypes` is set; edition 2 adds that it resolves to on |
12
+ | `CD-3#no-implicit-override` | audit | `noImplicitOverride` is set; edition 2 adds that it resolves to on |
13
+ | `CD-3#no-fallthrough-cases-in-switch` | audit | `noFallthroughCasesInSwitch` is set; edition 2 adds that it resolves to on |
14
+ | `CD-3#no-property-access-from-index-signature` | audit | `noPropertyAccessFromIndexSignature` is set; edition 2 adds that it resolves to on |
15
+ | `CD-3#use-unknown-in-catch-variables` | audit | `useUnknownInCatchVariables` is set; edition 2 adds that it resolves to on |
16
16
 
17
17
  ## What the check flags
18
+ Each CD-3 clause has two editions. Edition 1 runs by default. Edition 2 also judges what each `tsconfig.json` inherits, and becomes the default in the next major release; see [Settings](#settings) to run it now.
19
+
20
+ Edition 1:
18
21
  - `tsconfig.json` files, named exactly, at any depth. `tsconfig.base.json` and other names are not read. Generated folders such as `node_modules`, `dist`, `build` and `coverage` are skipped.
19
- - For each selected clause, the matching option present in that file's `compilerOptions`. Presence is enough: `true` is flagged as well as `false`, and the shared base is not consulted.
22
+ - For each selected clause, the matching option present in that file's `compilerOptions`. Presence is enough: `true` is flagged as well as `false`.
20
23
  - Options in `extends`-ed files are not seen. A file that cannot be parsed, or whose root or `compilerOptions` is not an object, fails the run.
21
24
 
25
+ Edition 2 also flags, for each selected option a `tsconfig.json` does not set itself, an option its resolved configuration leaves off:
26
+ - The configuration is resolved by the repository's installed TypeScript, as `tsc` would resolve it: every file in the `extends` chain, a relative path, a package such as `@tsconfig/strictest` or a workspace package under `node_modules`, and an array of bases on TypeScript 5.0 or later, later bases winning. An option a base turns on and a later file turns off is off.
27
+ - `strict` and `useUnknownInCatchVariables` take TypeScript's defaults: TypeScript 6 treats `strict` as on when nothing sets it, and `useUnknownInCatchVariables` follows `strict` unless it is set.
28
+ - The finding names the file to edit. `= false, inherited from <base>` names each base that turns the option off. `= false, turned off in <file>` names this `tsconfig.json` when its own `"strict": false` turns `useUnknownInCatchVariables` off. `unset here and in <bases>` lists every file in the chain, none of which sets the option; `unset, and this file extends no base` says there is no chain.
29
+ - A configuration TypeScript cannot resolve, such as a base file that is missing, a package that is not installed, or bases that extend each other, is flagged for each selected option the file does not set as `unknown`, followed by TypeScript's own diagnostic. An `extends` holding `${configDir}` resolves however the installed TypeScript resolves it, and is flagged the same way when TypeScript cannot find it. Fix the chain, and the options are judged.
30
+ - The base files are judged through the `tsconfig.json` files that extend them, not on their own.
31
+ - A `tsconfig.json` from which TypeScript would compile no file is not judged on what it resolves to, since its options apply to no file. After resolving the chain, TypeScript has no `files` entry, and no `include` entry that names a path outright or a folder or pattern it would search. Examples: an empty `files` list, its own or inherited, with no `include`, such as the solution-style root with only `references` that `npm create vite` writes; an empty `include`; an `exclude` of every file. Any non-empty `include` that names a file or a folder is still judged, such as `"include": ["vite.config.ts"]` or `["src"]`, and so is a config that sets neither `files` nor `include`, since TypeScript then includes every file. An option a skipped file sets itself is still flagged, as in edition 1. The configs it references are not judged through it; only files named `tsconfig.json` are read.
32
+
22
33
  ## Example violation
23
34
  ```json
24
35
  { "compilerOptions": { "strict": false } }
@@ -28,7 +39,20 @@ Read [the rule and its spirit](README.md) first. This page is the mechanics: how
28
39
  ```json
29
40
  { "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "dist" } }
30
41
  ```
31
- Put the flags in a shared base file that is not named `tsconfig.json`, and leave them out of every `tsconfig.json`. That the base file turns them on is left to review.
42
+ Put the flags in a shared base file that is not named `tsconfig.json`, and leave them out of every `tsconfig.json`. Under edition 1, that the base file turns them on is left to review. Under edition 2 the check reads the base: turn every selected flag on in it.
43
+
44
+ ```json
45
+ { "compilerOptions": { "strict": true, "noUncheckedIndexedAccess": true, "exactOptionalPropertyTypes": true, "noImplicitOverride": true, "noFallthroughCasesInSwitch": true, "noPropertyAccessFromIndexSignature": true, "useUnknownInCatchVariables": true } }
46
+ ```
47
+
48
+ ## Settings
49
+ - `edition`: the edition this clause runs, `"1"` or `"2"`. Without it, the clause runs edition 1, or the latest edition when `checkEditions` in `disciplines.json` is `"latest"`.
50
+
51
+ ```json
52
+ "clauseSettings": {
53
+ "CD-3#no-unchecked-indexed-access": { "edition": "2" }
54
+ }
55
+ ```
32
56
 
33
57
  ## Exceptions
34
58
  Add an entry to `discipline-exceptions.json` at the repository root. Use `authorised-location` when a package must set the flag itself. Use `file-carve-out` for debt in one file: it is forfeited once the file is touched, and needs a `whyChain` as below. See [discipline-exceptions.json](../../README.md#discipline-exceptionsjson).
@@ -29,6 +29,24 @@
29
29
  "expectedLines": [
30
30
  1
31
31
  ]
32
+ },
33
+ {
34
+ "name": "strict set to false under the second edition",
35
+ "fileName": "packages/a/tsconfig.json",
36
+ "source": "{\n \"compilerOptions\": {\n \"strict\": false\n }\n}\n",
37
+ "expectedLines": [
38
+ 1
39
+ ],
40
+ "edition": "2"
41
+ },
42
+ {
43
+ "name": "a base that cannot be read",
44
+ "fileName": "packages/a/tsconfig.json",
45
+ "source": "{ \"extends\": \"../../tsconfig.base.json\", \"compilerOptions\": { \"target\": \"ESNext\" } }\n",
46
+ "expectedLines": [
47
+ 1
48
+ ],
49
+ "edition": "2"
32
50
  }
33
51
  ],
34
52
  "allow": [
@@ -49,6 +67,20 @@
49
67
  "fileName": "tsconfig.base.json",
50
68
  "source": "{ \"compilerOptions\": { \"strict\": true } }\n",
51
69
  "expectedLines": []
70
+ },
71
+ {
72
+ "name": "tsconfig.base.json is not read under the second edition",
73
+ "fileName": "tsconfig.base.json",
74
+ "source": "{ \"compilerOptions\": { \"strict\": false } }\n",
75
+ "expectedLines": [],
76
+ "edition": "2"
77
+ },
78
+ {
79
+ "name": "a solution-style config that compiles no files",
80
+ "fileName": "tsconfig.json",
81
+ "source": "{ \"files\": [], \"references\": [{ \"path\": \"./tsconfig.app.json\" }, { \"path\": \"./tsconfig.node.json\" }] }\n",
82
+ "expectedLines": [],
83
+ "edition": "2"
52
84
  }
53
85
  ]
54
86
  }
@@ -80,6 +112,33 @@
80
112
  "expectedLines": [
81
113
  1
82
114
  ]
115
+ },
116
+ {
117
+ "name": "noUncheckedIndexedAccess set to false under the second edition",
118
+ "fileName": "packages/a/tsconfig.json",
119
+ "source": "{\n \"compilerOptions\": {\n \"noUncheckedIndexedAccess\": false\n }\n}\n",
120
+ "expectedLines": [
121
+ 1
122
+ ],
123
+ "edition": "2"
124
+ },
125
+ {
126
+ "name": "a base that cannot be read",
127
+ "fileName": "packages/a/tsconfig.json",
128
+ "source": "{ \"extends\": \"../../tsconfig.base.json\", \"compilerOptions\": { \"target\": \"ESNext\" } }\n",
129
+ "expectedLines": [
130
+ 1
131
+ ],
132
+ "edition": "2"
133
+ },
134
+ {
135
+ "name": "noUncheckedIndexedAccess unset with no base",
136
+ "fileName": "packages/b/tsconfig.json",
137
+ "source": "{ \"compilerOptions\": { \"outDir\": \"dist\", \"target\": \"ESNext\" } }\n",
138
+ "expectedLines": [
139
+ 1
140
+ ],
141
+ "edition": "2"
83
142
  }
84
143
  ],
85
144
  "allow": [
@@ -100,6 +159,20 @@
100
159
  "fileName": "tsconfig.base.json",
101
160
  "source": "{ \"compilerOptions\": { \"noUncheckedIndexedAccess\": true } }\n",
102
161
  "expectedLines": []
162
+ },
163
+ {
164
+ "name": "tsconfig.base.json is not read under the second edition",
165
+ "fileName": "tsconfig.base.json",
166
+ "source": "{ \"compilerOptions\": { \"noUncheckedIndexedAccess\": false } }\n",
167
+ "expectedLines": [],
168
+ "edition": "2"
169
+ },
170
+ {
171
+ "name": "a solution-style config that compiles no files",
172
+ "fileName": "tsconfig.json",
173
+ "source": "{ \"files\": [], \"references\": [{ \"path\": \"./tsconfig.app.json\" }, { \"path\": \"./tsconfig.node.json\" }] }\n",
174
+ "expectedLines": [],
175
+ "edition": "2"
103
176
  }
104
177
  ]
105
178
  }
@@ -131,6 +204,33 @@
131
204
  "expectedLines": [
132
205
  1
133
206
  ]
207
+ },
208
+ {
209
+ "name": "exactOptionalPropertyTypes set to false under the second edition",
210
+ "fileName": "packages/a/tsconfig.json",
211
+ "source": "{\n \"compilerOptions\": {\n \"exactOptionalPropertyTypes\": false\n }\n}\n",
212
+ "expectedLines": [
213
+ 1
214
+ ],
215
+ "edition": "2"
216
+ },
217
+ {
218
+ "name": "a base that cannot be read",
219
+ "fileName": "packages/a/tsconfig.json",
220
+ "source": "{ \"extends\": \"../../tsconfig.base.json\", \"compilerOptions\": { \"target\": \"ESNext\" } }\n",
221
+ "expectedLines": [
222
+ 1
223
+ ],
224
+ "edition": "2"
225
+ },
226
+ {
227
+ "name": "exactOptionalPropertyTypes unset with no base",
228
+ "fileName": "packages/b/tsconfig.json",
229
+ "source": "{ \"compilerOptions\": { \"outDir\": \"dist\", \"target\": \"ESNext\" } }\n",
230
+ "expectedLines": [
231
+ 1
232
+ ],
233
+ "edition": "2"
134
234
  }
135
235
  ],
136
236
  "allow": [
@@ -151,6 +251,20 @@
151
251
  "fileName": "tsconfig.base.json",
152
252
  "source": "{ \"compilerOptions\": { \"exactOptionalPropertyTypes\": true } }\n",
153
253
  "expectedLines": []
254
+ },
255
+ {
256
+ "name": "tsconfig.base.json is not read under the second edition",
257
+ "fileName": "tsconfig.base.json",
258
+ "source": "{ \"compilerOptions\": { \"exactOptionalPropertyTypes\": false } }\n",
259
+ "expectedLines": [],
260
+ "edition": "2"
261
+ },
262
+ {
263
+ "name": "a solution-style config that compiles no files",
264
+ "fileName": "tsconfig.json",
265
+ "source": "{ \"files\": [], \"references\": [{ \"path\": \"./tsconfig.app.json\" }, { \"path\": \"./tsconfig.node.json\" }] }\n",
266
+ "expectedLines": [],
267
+ "edition": "2"
154
268
  }
155
269
  ]
156
270
  }
@@ -182,6 +296,33 @@
182
296
  "expectedLines": [
183
297
  1
184
298
  ]
299
+ },
300
+ {
301
+ "name": "noImplicitOverride set to false under the second edition",
302
+ "fileName": "packages/a/tsconfig.json",
303
+ "source": "{\n \"compilerOptions\": {\n \"noImplicitOverride\": false\n }\n}\n",
304
+ "expectedLines": [
305
+ 1
306
+ ],
307
+ "edition": "2"
308
+ },
309
+ {
310
+ "name": "a base that cannot be read",
311
+ "fileName": "packages/a/tsconfig.json",
312
+ "source": "{ \"extends\": \"../../tsconfig.base.json\", \"compilerOptions\": { \"target\": \"ESNext\" } }\n",
313
+ "expectedLines": [
314
+ 1
315
+ ],
316
+ "edition": "2"
317
+ },
318
+ {
319
+ "name": "noImplicitOverride unset with no base",
320
+ "fileName": "packages/b/tsconfig.json",
321
+ "source": "{ \"compilerOptions\": { \"outDir\": \"dist\", \"target\": \"ESNext\" } }\n",
322
+ "expectedLines": [
323
+ 1
324
+ ],
325
+ "edition": "2"
185
326
  }
186
327
  ],
187
328
  "allow": [
@@ -202,6 +343,20 @@
202
343
  "fileName": "tsconfig.base.json",
203
344
  "source": "{ \"compilerOptions\": { \"noImplicitOverride\": true } }\n",
204
345
  "expectedLines": []
346
+ },
347
+ {
348
+ "name": "tsconfig.base.json is not read under the second edition",
349
+ "fileName": "tsconfig.base.json",
350
+ "source": "{ \"compilerOptions\": { \"noImplicitOverride\": false } }\n",
351
+ "expectedLines": [],
352
+ "edition": "2"
353
+ },
354
+ {
355
+ "name": "a solution-style config that compiles no files",
356
+ "fileName": "tsconfig.json",
357
+ "source": "{ \"files\": [], \"references\": [{ \"path\": \"./tsconfig.app.json\" }, { \"path\": \"./tsconfig.node.json\" }] }\n",
358
+ "expectedLines": [],
359
+ "edition": "2"
205
360
  }
206
361
  ]
207
362
  }
@@ -233,6 +388,33 @@
233
388
  "expectedLines": [
234
389
  1
235
390
  ]
391
+ },
392
+ {
393
+ "name": "noFallthroughCasesInSwitch set to false under the second edition",
394
+ "fileName": "packages/a/tsconfig.json",
395
+ "source": "{\n \"compilerOptions\": {\n \"noFallthroughCasesInSwitch\": false\n }\n}\n",
396
+ "expectedLines": [
397
+ 1
398
+ ],
399
+ "edition": "2"
400
+ },
401
+ {
402
+ "name": "a base that cannot be read",
403
+ "fileName": "packages/a/tsconfig.json",
404
+ "source": "{ \"extends\": \"../../tsconfig.base.json\", \"compilerOptions\": { \"target\": \"ESNext\" } }\n",
405
+ "expectedLines": [
406
+ 1
407
+ ],
408
+ "edition": "2"
409
+ },
410
+ {
411
+ "name": "noFallthroughCasesInSwitch unset with no base",
412
+ "fileName": "packages/b/tsconfig.json",
413
+ "source": "{ \"compilerOptions\": { \"outDir\": \"dist\", \"target\": \"ESNext\" } }\n",
414
+ "expectedLines": [
415
+ 1
416
+ ],
417
+ "edition": "2"
236
418
  }
237
419
  ],
238
420
  "allow": [
@@ -253,6 +435,20 @@
253
435
  "fileName": "tsconfig.base.json",
254
436
  "source": "{ \"compilerOptions\": { \"noFallthroughCasesInSwitch\": true } }\n",
255
437
  "expectedLines": []
438
+ },
439
+ {
440
+ "name": "tsconfig.base.json is not read under the second edition",
441
+ "fileName": "tsconfig.base.json",
442
+ "source": "{ \"compilerOptions\": { \"noFallthroughCasesInSwitch\": false } }\n",
443
+ "expectedLines": [],
444
+ "edition": "2"
445
+ },
446
+ {
447
+ "name": "a solution-style config that compiles no files",
448
+ "fileName": "tsconfig.json",
449
+ "source": "{ \"files\": [], \"references\": [{ \"path\": \"./tsconfig.app.json\" }, { \"path\": \"./tsconfig.node.json\" }] }\n",
450
+ "expectedLines": [],
451
+ "edition": "2"
256
452
  }
257
453
  ]
258
454
  }
@@ -284,6 +480,33 @@
284
480
  "expectedLines": [
285
481
  1
286
482
  ]
483
+ },
484
+ {
485
+ "name": "noPropertyAccessFromIndexSignature set to false under the second edition",
486
+ "fileName": "packages/a/tsconfig.json",
487
+ "source": "{\n \"compilerOptions\": {\n \"noPropertyAccessFromIndexSignature\": false\n }\n}\n",
488
+ "expectedLines": [
489
+ 1
490
+ ],
491
+ "edition": "2"
492
+ },
493
+ {
494
+ "name": "a base that cannot be read",
495
+ "fileName": "packages/a/tsconfig.json",
496
+ "source": "{ \"extends\": \"../../tsconfig.base.json\", \"compilerOptions\": { \"target\": \"ESNext\" } }\n",
497
+ "expectedLines": [
498
+ 1
499
+ ],
500
+ "edition": "2"
501
+ },
502
+ {
503
+ "name": "noPropertyAccessFromIndexSignature unset with no base",
504
+ "fileName": "packages/b/tsconfig.json",
505
+ "source": "{ \"compilerOptions\": { \"outDir\": \"dist\", \"target\": \"ESNext\" } }\n",
506
+ "expectedLines": [
507
+ 1
508
+ ],
509
+ "edition": "2"
287
510
  }
288
511
  ],
289
512
  "allow": [
@@ -304,6 +527,20 @@
304
527
  "fileName": "tsconfig.base.json",
305
528
  "source": "{ \"compilerOptions\": { \"noPropertyAccessFromIndexSignature\": true } }\n",
306
529
  "expectedLines": []
530
+ },
531
+ {
532
+ "name": "tsconfig.base.json is not read under the second edition",
533
+ "fileName": "tsconfig.base.json",
534
+ "source": "{ \"compilerOptions\": { \"noPropertyAccessFromIndexSignature\": false } }\n",
535
+ "expectedLines": [],
536
+ "edition": "2"
537
+ },
538
+ {
539
+ "name": "a solution-style config that compiles no files",
540
+ "fileName": "tsconfig.json",
541
+ "source": "{ \"files\": [], \"references\": [{ \"path\": \"./tsconfig.app.json\" }, { \"path\": \"./tsconfig.node.json\" }] }\n",
542
+ "expectedLines": [],
543
+ "edition": "2"
307
544
  }
308
545
  ]
309
546
  }
@@ -335,6 +572,33 @@
335
572
  "expectedLines": [
336
573
  1
337
574
  ]
575
+ },
576
+ {
577
+ "name": "useUnknownInCatchVariables set to false under the second edition",
578
+ "fileName": "packages/a/tsconfig.json",
579
+ "source": "{\n \"compilerOptions\": {\n \"useUnknownInCatchVariables\": false\n }\n}\n",
580
+ "expectedLines": [
581
+ 1
582
+ ],
583
+ "edition": "2"
584
+ },
585
+ {
586
+ "name": "a base that cannot be read",
587
+ "fileName": "packages/a/tsconfig.json",
588
+ "source": "{ \"extends\": \"../../tsconfig.base.json\", \"compilerOptions\": { \"target\": \"ESNext\" } }\n",
589
+ "expectedLines": [
590
+ 1
591
+ ],
592
+ "edition": "2"
593
+ },
594
+ {
595
+ "name": "turned off by strict set to false in the same file",
596
+ "fileName": "packages/b/tsconfig.json",
597
+ "source": "{ \"compilerOptions\": { \"strict\": false } }\n",
598
+ "expectedLines": [
599
+ 1
600
+ ],
601
+ "edition": "2"
338
602
  }
339
603
  ],
340
604
  "allow": [
@@ -355,6 +619,20 @@
355
619
  "fileName": "tsconfig.base.json",
356
620
  "source": "{ \"compilerOptions\": { \"useUnknownInCatchVariables\": true } }\n",
357
621
  "expectedLines": []
622
+ },
623
+ {
624
+ "name": "tsconfig.base.json is not read under the second edition",
625
+ "fileName": "tsconfig.base.json",
626
+ "source": "{ \"compilerOptions\": { \"useUnknownInCatchVariables\": false } }\n",
627
+ "expectedLines": [],
628
+ "edition": "2"
629
+ },
630
+ {
631
+ "name": "a solution-style config that compiles no files",
632
+ "fileName": "tsconfig.json",
633
+ "source": "{ \"files\": [], \"references\": [{ \"path\": \"./tsconfig.app.json\" }, { \"path\": \"./tsconfig.node.json\" }] }\n",
634
+ "expectedLines": [],
635
+ "edition": "2"
358
636
  }
359
637
  ]
360
638
  }