@jfalava/ts-standard 0.3.2 → 0.3.4

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.
@@ -0,0 +1,36 @@
1
+ # `standard.config.ts`
2
+
3
+ ```ts
4
+ import { defineStandard } from "@jfalava/ts-standard";
5
+
6
+ export default defineStandard({
7
+ // "private" repos gate on Workers Builds and must not have a ci.yml. Default "public".
8
+ visibility: "public",
9
+ // Which column of the standard's script table a package follows. Unlisted packages are "oxc".
10
+ toolchains: { docs: "astro" },
11
+ // What this repo's ci.yml adds to the reference.
12
+ ci: {
13
+ ignoreAdd: ["docs/AGENT.md", "LICENSES/**"], // extra negations in the `code` filter, no "!"
14
+ ignoreRemove: ["**/README.md"], // standard negations this repo counts as code
15
+ filters: ["rust"], // filters beside `code` in the `changes` step
16
+ jobs: ["advisories", "rust"], // jobs beside `changes` and `check`
17
+ env: ["CARGO_TERM_COLOR"], // top-level env keys
18
+ },
19
+ exceptions: [
20
+ {
21
+ rule: "scripts/check-runs-own-checks",
22
+ where: "docs", // package directory ("." for the root) or repo-relative file
23
+ script: "licenses:check", // optional, for script rules
24
+ why: "Needs cargo and the network, which Workers Builds lacks.",
25
+ },
26
+ ],
27
+ });
28
+ ```
29
+
30
+ Toolchains set what `typecheck` must be: `effect-tsgo tsrs --noEmit` for `oxc` and `vite-plus`, `astro check` for `astro`, and `tsc --noEmit` for `pulumi`. `astro` and `pulumi` packages may also depend on `typescript`, and are not held to the tsconfig base rules.
31
+
32
+ ## Exceptions
33
+
34
+ An exception covers every finding with the same `rule` whose `where` and `script` match. Omitting `where` or `script` matches any. A `where` of a file also covers its line findings, such as `.github/workflows/ci.yml:33`. Each needs a `why`; keep it in step with the exceptions table in the repo's README.
35
+
36
+ An exception that covers nothing is itself an error, `standard/stale-exception`, so the list shrinks when the repo catches up with the standard. An exception for `lint/anti-slop` or `lint/pending` names what it excuses, `<package dir>:<plugin>` or `<package dir>:<rule>`, and matches only that; one without, such as `where: "."`, would excuse a whole package and is an error, `standard/broad-exception`.
package/docs/deploy.md ADDED
@@ -0,0 +1,11 @@
1
+ # Deploy rules
2
+
3
+ These apply to `plan`, `deploy`, `ci:deploy` and `destroy` commands that run `alchemy` or `pulumi`.
4
+
5
+ | Rule | Checks |
6
+ | ------------------------ | ------------------------------------------------------------------------------------------- |
7
+ | `deploy/explicit-target` | The command names its target: `--stage`, `--stack` or a variable assignment in front of it. |
8
+ | `deploy/same-target` | All four scripts in a package name the same target. |
9
+ | `deploy/interactive` | `ci:deploy` passes `--yes`; `deploy` and `destroy` do not. |
10
+ | `deploy/plan` | `plan` is `alchemy plan`, and exists when `deploy` does. |
11
+ | `deploy/no-checks` | `deploy` and `ci:deploy` run none of the check verbs and rewrite no files. |
package/docs/lint.md ADDED
@@ -0,0 +1,33 @@
1
+ # Lint rules
2
+
3
+ Every repo lints over [`@cloudflare/oxlint-config`](https://www.npmjs.com/package/@cloudflare/oxlint-config). The [anti-slop](https://github.com/dmmulroy/anti-slop) rules it does not carry ship in this package as two oxlint JS plugins, built from `oxlint/` (MIT, Dillon Mulroy; see `oxlint/UPSTREAM.md`):
4
+
5
+ | Specifier | Plugin name | Rules |
6
+ | ------------------------------------ | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------- |
7
+ | `@jfalava/ts-standard/oxlint` | `anti-slop` | `no-module-mocking`, `require-safety-comment-for-type-assertion` |
8
+ | `@jfalava/ts-standard/oxlint/effect` | `anti-slop-effect` | `no-manual-effect-error-tag`, `no-manual-tag-comparison`, `no-manual-tagged-construction`, `no-service-constructor-imports`, `prefer-effect-match` |
9
+
10
+ Load them by absolute path, so a workspace config that spreads the root one resolves them the same; they need `@oxlint/plugins`, which `pins/toolchain-deps` already requires:
11
+
12
+ ```ts
13
+ import { fileURLToPath } from "node:url";
14
+
15
+ const antiSlop = fileURLToPath(import.meta.resolve("@jfalava/ts-standard/oxlint"));
16
+
17
+ export default defineConfig({
18
+ jsPlugins: [...(preset.jsPlugins ?? []), { name: "anti-slop", specifier: antiSlop }],
19
+ // …
20
+ });
21
+ ```
22
+
23
+ | Rule | Checks |
24
+ | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
25
+ | `lint/preset` | The root `oxlint.config.ts` imports `@cloudflare/oxlint-config`, splits off its root-only `options` (`const { options: presetOptions, ...preset } = cloudflare`) and spreads them back, and sets `categories.correctness`. No `oxlint.config.ts` uses `extends`. |
26
+ | `lint/anti-slop` | Each package with an `oxlint` script loads its oxlint config as oxlint does (the `-c` file, or the nearest `oxlint.config.ts`) and reads the resolved `jsPlugins` and `rules`. It loads `@jfalava/ts-standard/oxlint` as `anti-slop`. It loads `@jfalava/ts-standard/oxlint/effect` as `anti-slop-effect` exactly when it depends on `effect`. Every rule of a loaded plugin is on or pending, at the top level and in every `overrides` entry: off or `warn` (`0` or `1`) only as `"anti-slop/x": "off", // <findings>` in a file the package's config is built from (the config and the files it imports by relative path), or excepted at `<package dir>:<plugin>/<rule>`. The repo no longer vendors `tools/oxlint/anti-slop`. |
27
+ | `lint/pending` | A warning fails nothing, so a rule the repo's own config files set to `warn` (or `1`), at the top level or in an `overrides` entry, is pending work: it carries its count, as `"x": "warn", // <findings>` in a file the package's config is built from, or is excepted at `<package dir>:<rule>`. Warnings a preset sets, such as `@effect/tsgo`'s diagnostics, are the preset's policy and are not checked. |
28
+
29
+ Known gaps in the two lint rules above:
30
+
31
+ - They read only packages with a script that runs `oxlint`. A `vite-plus` package that lints with `vp lint` is skipped, so its plugins and pending rules go unchecked until the web round covers it.
32
+ - A category set to `warn`, such as `categories: { suspicious: "warn" }`, is not a rule entry, so `lint/pending` does not see it.
33
+ - Counts are not verified against a lint run; a pending entry only has to carry one.
package/docs/pins.md ADDED
@@ -0,0 +1,11 @@
1
+ # Pin rules
2
+
3
+ | Rule | Checks |
4
+ | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
5
+ | `pins/package-manager` | The root `packageManager` is `bun@<exact>`. |
6
+ | `pins/exact` | Every catalog entry and dependency is an exact version (`npm:` aliases and SHA-pinned git URLs included), and every `catalog:` reference resolves. |
7
+ | `pins/use-catalog` | In a workspace repo, a dependency that a root catalog lists uses `catalog:`. |
8
+ | `pins/toolchain-deps` | The root has `@cloudflare/oxlint-config`, `@effect/tsgo`, `@oxlint/plugins`, `oxfmt`, `oxlint` and `tsrs`; nothing has `oxlint-tsgolint`; only Astro and Pulumi packages have `typescript`. |
9
+ | `pins/bun-types` | `bun-types` or `@types/bun` is the `packageManager` version. |
10
+ | `pins/prepare` | The root `prepare` is `effect-tsgo patch --no-typescript --tsrs --oxlint`. |
11
+ | `pins/bunfig` | `bunfig.toml` exists, sets `minimumReleaseAge` to at least 86400, and excludes `@effect/tsgo`, its seven platform packages and `@jfalava/ts-standard`. |
@@ -0,0 +1,24 @@
1
+ # Script rules
2
+
3
+ | Rule | Checks |
4
+ | -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
5
+ | `scripts/required` | Every package has `check`, `fix`, `lint`, `lint:fix`, `format`, `format:check` and `typecheck`. A workspace root also has `test`. |
6
+ | `scripts/check-body` | A package's `check` is `bun run lint && bun run format:check && bun run typecheck && bun run test` (`test` only if it has one), followed only by `bun run <thing>:check`. |
7
+ | `scripts/check-read-only` | Nothing reached from any `check`, following `bun run`, `--cwd` and `--workspaces`, writes files: no `--fix`, `--write`, bare `oxfmt` or `vp fmt`. |
8
+ | `scripts/check-runs-own-checks` | Every `<thing>:check` script is reached from that package's `check`. |
9
+ | `scripts/no-bare-bun-test` | Only `test` and `test:*` call `bun test`; aggregates call `bun run test`. |
10
+ | `scripts/fix-body` | `fix` is `bun run lint:fix && bun run format`. |
11
+ | `scripts/fix-pairs` | Every `lint*:fix` is its `lint*` with `--fix`, or calls the `:fix` variants. |
12
+ | `scripts/format-pair` | `format:check` is `format` in check mode (`--check` in place of `--write`, or appended). |
13
+ | `scripts/lint-type-aware` | Every `oxlint` reached from `lint` in an `oxc` or `astro` package passes `--type-aware --type-check`. |
14
+ | `scripts/lint-unused-directives` | In a workspace repo, every `oxlint` reached from a workspace package's `lint` passes `--report-unused-disable-directives-severity=error`. The preset's `reportUnusedDisableDirectives` is a root-only option. |
15
+ | `scripts/lint-body` | An Astro package's `lint` is `bun run lint:oxlint && bun run lint:astro && bun run lint:docs`. |
16
+ | `scripts/typecheck` | `typecheck` is the toolchain's command. |
17
+ | `scripts/test-runs-once` | `test` does not start watch mode: `vitest run`, not `vitest`. |
18
+ | `scripts/root-fan-out` | Each root verb fans out with `bun run --workspaces`; `check` without `--if-present`, the others with it. Only a repo-wide prerequisite such as `bun run build:types` may run before the fan-out. Every package has a `check`. |
19
+ | `scripts/no-global-suffix` | No script name ends in `:global`. |
20
+ | `scripts/no-root-shortcuts` | No root script is only `bun run --cwd <pkg> <script>`, except `dev` and the deploy scripts. |
21
+ | `scripts/no-filter` | No `bun run --filter`: it does not pass stdin. |
22
+ | `scripts/no-bunx` | No `bunx` or `bun x`. |
23
+ | `scripts/no-hooks` | No `pre<script>` hooks beside `prepare`. |
24
+ | `scripts/ci-build` | The root `ci:build` is `bun run check` or `bun run check && bun run build`, it exists when `ci:deploy` does, and no package has one. |
package/docs/setup.md ADDED
@@ -0,0 +1,37 @@
1
+ # Wiring it into a repo
2
+
3
+ 1. Add it, with an exact version as the standard requires:
4
+
5
+ ```sh
6
+ bun add --dev --exact @jfalava/ts-standard
7
+ ```
8
+
9
+ In a workspace repo, put it in the root `catalogs` and reference it as `catalog:`.
10
+
11
+ 2. Exclude the package from the release-age wait in `bunfig.toml`, or every new version waits a day before it installs. Bun matches these entries by exact name, so a scope glob such as `@jfalava/*` excludes nothing. The `pins/bunfig` rule requires this entry:
12
+
13
+ ```toml
14
+ [install]
15
+ minimumReleaseAge = 86400
16
+ minimumReleaseAgeExcludes = [
17
+ "@jfalava/ts-standard",
18
+ # …
19
+ ]
20
+ ```
21
+
22
+ 3. Add the script and end the root `check` with it:
23
+
24
+ ```json
25
+ {
26
+ "scripts": {
27
+ "check": "bun run --workspaces check && bun run standard:check",
28
+ "standard:check": "ts-standard"
29
+ }
30
+ }
31
+ ```
32
+
33
+ In a single-package repo, append `&& bun run standard:check` to `check` after `bun run test`.
34
+
35
+ 4. If the repo differs from the standard anywhere, add a [`standard.config.ts`](configuration.md) at its root. Without one, every rule applies with the defaults.
36
+
37
+ `ts-standard [dir] [--config <file>] [--json]` checks `dir` (default `.`) with `<dir>/standard.config.ts`. It exits 1 when an error is left, and 0 when only warnings are.
@@ -0,0 +1,13 @@
1
+ # tsconfig rules
2
+
3
+ The base is `tsconfig.base.json` in a workspace repo and `tsconfig.json` otherwise.
4
+
5
+ | Rule | Checks |
6
+ | ------------------------------------ | ------------------------------------------------------------------------------------------------------ |
7
+ | `tsconfig/base` | The base exists and its `$schema` is `./node_modules/@effect/tsgo/schema.json`. |
8
+ | `tsconfig/effect-plugin` | The base has the `@effect/language-service` plugin entry, and no package tsconfig overrides `plugins`. |
9
+ | `tsconfig/no-emit` | The base sets `noEmit: true`. |
10
+ | `tsconfig/strict-in-base` | The base sets `strict` and `noUncheckedIndexedAccess`; package tsconfigs set no strict flags. |
11
+ | `tsconfig/extends-base` | Each `oxc` or `vite-plus` package has a `tsconfig.json` that extends the base. |
12
+ | `tsconfig/one-per-package` | No `tsconfig.*.json` beside a package's `tsconfig.json`. |
13
+ | `tsconfig/no-ignore-effect-warnings` | No tsconfig sets `ignoreEffectWarningsInTscExitCode: true`. |
@@ -0,0 +1,14 @@
1
+ # Workflow rules
2
+
3
+ | Rule | Checks |
4
+ | ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
5
+ | `workflows/ci-reference` | A public repo has `ci.yml` and a private one does not. `ci.yml` equals `reference/ci.yml` once the additions in `ci` are taken out, ignoring action refs. Filter differences name the pattern. |
6
+ | `workflows/actions-pinned` | Every `uses:` outside the repo is pinned to a 40-character SHA with a `# v…` comment. |
7
+ | `workflows/reference-pins` | Warning. An action the reference also uses is at the reference's SHA. |
8
+ | `workflows/dependabot` | `.github/dependabot.yml` has a `github-actions` entry. |
9
+ | `workflows/hygiene` | Every workflow has top-level `permissions` and a `concurrency` group (reusable workflows excepted), and every job that runs steps has `timeout-minutes`. |
10
+ | `workflows/bun-from-package-manager` | No `setup-bun` step sets `bun-version`. |
11
+ | `workflows/scripts-only` | `run:` steps call bun only as `bun install --frozen-lockfile` or `bun run <script>`, never `bunx`, and never `--ignore-scripts`. |
12
+ | `workflows/release-check` | A tag-triggered workflow runs `bun run check`. |
13
+ | `workflows/release-version` | A tag-triggered workflow checks the tag against the package version (`${GITHUB_REF_NAME#v}`). |
14
+ | `workflows/release-build` | A tag-triggered workflow calls `build:<target>` scripts, and every matrix target exists as a script in the package it runs in. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jfalava/ts-standard",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "Checks a Bun repo against the TypeScript scripts and workflows standard: package.json scripts, pins, tsconfig, lint setup and GitHub workflows. Also ships the anti-slop oxlint plugins the standard uses.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -13,6 +13,7 @@
13
13
  "files": [
14
14
  "src",
15
15
  "reference",
16
+ "docs",
16
17
  "dist",
17
18
  "oxlint/LICENSE",
18
19
  "oxlint/UPSTREAM.md"
package/src/check.ts CHANGED
@@ -23,7 +23,7 @@ export interface Result {
23
23
  }
24
24
 
25
25
  /** Its exceptions name one plugin or rule of one package and match it exactly, not by prefix. */
26
- const EXACT_RULES: ReadonlySet<string> = new Set(["lint/anti-slop"]);
26
+ const EXACT_RULES: ReadonlySet<string> = new Set(["lint/anti-slop", "lint/pending"]);
27
27
 
28
28
  const matches = (e: Exception, f: Finding): boolean =>
29
29
  e.rule === f.rule &&
@@ -48,7 +48,7 @@ export const check = (root: string, config: StandardConfig): Result => {
48
48
  const broad: Finding[] = (config.exceptions ?? []).filter(isBroad).map((e) => ({
49
49
  rule: "standard/broad-exception",
50
50
  where: e.where ?? "*",
51
- message: `exception for \`${e.rule}\` must name a plugin or rule, as \`<package dir>:<plugin>\` or \`<package dir>:<plugin>/<rule>\``,
51
+ message: `exception for \`${e.rule}\` must name a plugin or rule, as \`<package dir>:<plugin>\` or \`<package dir>:<rule>\``,
52
52
  }));
53
53
  const exceptions = (config.exceptions ?? []).filter((e) => !isBroad(e));
54
54
  const used = new Set<Exception>();
package/src/lint.ts CHANGED
@@ -98,10 +98,20 @@ const loads = (config: Resolved, plugin: Plugin): JsPlugin | undefined =>
98
98
  return spec === plugin.specifier || (spec.startsWith("/") && isFileOf(spec, plugin));
99
99
  });
100
100
 
101
- const isOff = (value: Level | readonly [Level, ...unknown[]]): boolean => {
102
- const level = typeof value === "object" ? value[0] : value;
103
- return level === "off" || level === 0;
101
+ type Setting = Level | readonly [Level, ...unknown[]];
102
+ const levelOf = (value: Setting): Level => (typeof value === "object" ? value[0] : value);
103
+ const isWarn = (value: Setting): boolean => {
104
+ const level = levelOf(value);
105
+ return level === "warn" || level === 1;
104
106
  };
107
+ /** Off, or a warning: a warning fails nothing, so it parks findings the same way off does. */
108
+ const isQuiet = (value: Setting): boolean => {
109
+ const level = levelOf(value);
110
+ return level === "off" || level === 0 || isWarn(value);
111
+ };
112
+ const ruleId = (rule: string): string =>
113
+ rule.replaceAll("/", String.raw`\/`).replaceAll("-", String.raw`\-`);
114
+ const QUIET = `\\[?\\s*(?:["'](?:off|warn)["']|[01]\\b)`;
105
115
 
106
116
  /**
107
117
  * The repo files a config is built from: the config and every file it imports by relative path,
@@ -123,12 +133,18 @@ const sourcesOf = (path: string, seen = new Map<string, string>()): Map<string,
123
133
  };
124
134
 
125
135
  /**
126
- * A rule kept off on purpose sits in a pending map with its finding count, as
127
- * `"anti-slop/x": "off", // 4`, in one of the files the package's config is built from.
136
+ * A rule kept off or at `warn` on purpose sits in a pending map with its finding count, as
137
+ * `"anti-slop/x": "off", // 4` or `"x": "warn", // 4`, in one of the files the package's config
138
+ * is built from.
128
139
  */
129
140
  const pendingIn = (texts: readonly string[], rule: string): boolean => {
130
- const id = rule.replaceAll("/", String.raw`\/`).replaceAll("-", String.raw`\-`);
131
- const marker = new RegExp(`["']${id}["']\\s*:\\s*["']off["']\\s*,?\\s*//\\s*\\d`);
141
+ const marker = new RegExp(`["']${ruleId(rule)}["']\\s*:\\s*${QUIET}[^\\n]*?//\\s*\\d`);
142
+ return texts.some((text) => marker.test(text));
143
+ };
144
+
145
+ /** Whether the repo's own config files set the rule to `warn`, rather than a preset. */
146
+ const warnedIn = (texts: readonly string[], rule: string): boolean => {
147
+ const marker = new RegExp(`["']${ruleId(rule)}["']\\s*:\\s*\\[?\\s*(?:["']warn["']|1\\b)`);
132
148
  return texts.some((text) => marker.test(text));
133
149
  };
134
150
 
@@ -141,6 +157,8 @@ const pluginRules = (repo: Repo): Finding[] => {
141
157
  const out: Finding[] = [];
142
158
  const f = (where: string, message: string) =>
143
159
  out.push({ rule: "lint/anti-slop", where, message });
160
+ const pending = (where: string, message: string) =>
161
+ out.push({ rule: "lint/pending", where, message });
144
162
  for (const pkg of [repo.rootPkg, ...repo.workspaces]) {
145
163
  const path = lintConfigOf(repo, pkg);
146
164
  if (path === undefined) {
@@ -156,6 +174,31 @@ const pluginRules = (repo: Repo): Finding[] => {
156
174
  continue;
157
175
  }
158
176
  const texts = [...sourcesOf(path).values()];
177
+ // A rule the repo sets to `warn` is pending work that passes the gate: it carries its count.
178
+ // Warnings a preset sets, such as @effect/tsgo's diagnostics, are the preset's policy.
179
+ const scopes = [
180
+ { label: "", rules: config.rules },
181
+ ...(config.overrides ?? []).map((o, i) => ({
182
+ label: ` in \`overrides[${i}]\` (${(o.files ?? []).join(", ")})`,
183
+ rules: o.rules,
184
+ })),
185
+ ];
186
+ for (const { label, rules } of scopes) {
187
+ for (const [rule, value] of Object.entries(rules ?? {})) {
188
+ if (
189
+ value !== undefined &&
190
+ !rule.startsWith("anti-slop") &&
191
+ isWarn(value) &&
192
+ warnedIn(texts, rule) &&
193
+ !pendingIn(texts, rule)
194
+ ) {
195
+ pending(
196
+ `${pkg.dir}:${rule}`,
197
+ `is \`warn\`${label} with no pending count; turn it on, or list it as \`"${rule}": "warn", // <findings>\``,
198
+ );
199
+ }
200
+ }
201
+ }
159
202
  const effect = usesEffect(pkg);
160
203
  for (const plugin of [GENERIC, EFFECT]) {
161
204
  const at = `${pkg.dir}:${plugin.name}`;
@@ -184,19 +227,19 @@ const pluginRules = (repo: Repo): Finding[] => {
184
227
  const value = config.rules?.[rule];
185
228
  if (value === undefined) {
186
229
  f(`${pkg.dir}:${rule}`, "is not configured, so it never runs; turn it on");
187
- } else if (isOff(value) && !pendingIn(texts, rule)) {
230
+ } else if (isQuiet(value) && !pendingIn(texts, rule)) {
188
231
  f(
189
232
  `${pkg.dir}:${rule}`,
190
- `is off with no pending count; turn it on, or list it as \`"${rule}": "off", // <findings>\``,
233
+ `is \`${String(levelOf(value))}\` with no pending count; turn it on, or list it as \`"${rule}": "off", // <findings>\``,
191
234
  );
192
235
  }
193
- // An override that turns a kept rule off for some files is the same as turning it off.
236
+ // An override that quiets a kept rule for some files is the same as quieting it.
194
237
  for (const [i, override] of (config.overrides ?? []).entries()) {
195
238
  const local = override.rules?.[rule];
196
- if (local !== undefined && isOff(local) && !pendingIn(texts, rule)) {
239
+ if (local !== undefined && isQuiet(local) && !pendingIn(texts, rule)) {
197
240
  f(
198
241
  `${pkg.dir}:${rule}`,
199
- `is off in \`overrides[${i}]\` (${(override.files ?? []).join(", ")}) with no pending count; turn it on there, or list it as \`"${rule}": "off", // <findings>\``,
242
+ `is \`${String(levelOf(local))}\` in \`overrides[${i}]\` (${(override.files ?? []).join(", ")}) with no pending count; turn it on there, or list it as \`"${rule}": "off", // <findings>\``,
200
243
  );
201
244
  }
202
245
  }
package/src/repo.ts CHANGED
@@ -42,7 +42,11 @@ const expandWorkspaceGlobs = (root: string, patterns: readonly string[]): string
42
42
  for (const pattern of patterns) {
43
43
  if (pattern.endsWith("/*")) {
44
44
  const parent = pattern.slice(0, -2);
45
- for (const entry of readdirSync(join(root, parent), { withFileTypes: true })) {
45
+ // Sorted: readdir order differs between filesystems, and findings follow this order.
46
+ const entries = readdirSync(join(root, parent), { withFileTypes: true }).toSorted((a, b) =>
47
+ a.name.localeCompare(b.name),
48
+ );
49
+ for (const entry of entries) {
46
50
  if (entry.isDirectory() && existsSync(join(root, parent, entry.name, "package.json"))) {
47
51
  dirs.push(`${parent}/${entry.name}`);
48
52
  }