@jfalava/ts-standard 0.3.3 → 0.3.5

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. `examples/` has complete files to copy from.
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. |
@@ -0,0 +1,9 @@
1
+ # Examples
2
+
3
+ Files that pass `ts-standard` with no findings, to copy into a repo and rename. Each example passes with `reference/ci.yml` at `.github/workflows/ci.yml` and `github/dependabot.yml` at `.github/dependabot.yml`; `test/check.test.ts` checks that.
4
+
5
+ - `package/`: a single-package repo with no `effect` dependency: `package.json`, `bunfig.toml`, `tsconfig.json` and `oxlint.config.ts`. It loads the `anti-slop` plugin only.
6
+ - `workspace/`: a workspace repo with a root catalog and three packages. `api` and `cli` depend on `effect` and add the `anti-slop-effect` plugin; `iac` deploys with Alchemy and does not. The root has `tsconfig.base.json` and an `oxlint.config.ts` that exports `base` and `antiSlopEffect`.
7
+ - `github/`: `dependabot.yml` and a tag-triggered `release.yml` for the workspace's `cli`. `ci.yml` is `reference/ci.yml`.
8
+
9
+ Add `standard.config.ts` only where a repo differs from the defaults; see `docs/configuration.md`.
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: github-actions
4
+ directory: /
5
+ schedule:
6
+ interval: weekly
@@ -0,0 +1,75 @@
1
+ # The release workflow for examples/workspace, whose CLI is in cli/. In a single-package repo,
2
+ # read the version from package.json and drop `--cwd cli`. Tags are plain v<version>.
3
+ name: Release
4
+
5
+ on:
6
+ push:
7
+ tags: ["v*"]
8
+
9
+ concurrency:
10
+ group: release-${{ github.ref }}
11
+ cancel-in-progress: false
12
+
13
+ permissions:
14
+ contents: read
15
+
16
+ jobs:
17
+ check:
18
+ runs-on: ubuntu-latest
19
+ timeout-minutes: 15
20
+ steps:
21
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
22
+ - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
23
+ - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
24
+ with:
25
+ path: ~/.bun/install/cache
26
+ key: bun-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('bun.lock') }}
27
+ restore-keys: bun-${{ runner.os }}-${{ runner.arch }}-
28
+ - run: bun install --frozen-lockfile
29
+ - name: Tag matches the CLI version
30
+ run: test "${GITHUB_REF_NAME#v}" = "$(jq -r .version cli/package.json)"
31
+ - run: bun run check
32
+
33
+ build:
34
+ needs: check
35
+ strategy:
36
+ fail-fast: false
37
+ matrix:
38
+ include:
39
+ - { os: ubuntu-latest, target: linux-x64 }
40
+ - { os: ubuntu-24.04-arm, target: linux-arm64 }
41
+ - { os: macos-latest, target: darwin-arm64 }
42
+ - { os: windows-latest, target: windows-x64 }
43
+ runs-on: ${{ matrix.os }}
44
+ timeout-minutes: 30
45
+ steps:
46
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
47
+ - uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
48
+ - run: bun install --frozen-lockfile
49
+ - run: bun run --cwd cli build:${{ matrix.target }}
50
+ # Sign and archive here if the release needs it.
51
+ - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
52
+ with:
53
+ name: example-${{ matrix.target }}
54
+ retention-days: 1
55
+ path: cli/dist/example-${{ matrix.target }}*
56
+
57
+ release:
58
+ needs: build
59
+ runs-on: ubuntu-latest
60
+ timeout-minutes: 10
61
+ permissions:
62
+ contents: write
63
+ steps:
64
+ - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
65
+ with:
66
+ pattern: example-*
67
+ merge-multiple: true
68
+ path: dist
69
+ - name: Generate checksums
70
+ working-directory: dist
71
+ run: sha256sum * > checksums.txt
72
+ - uses: softprops/action-gh-release@8a0cd651e5b2365bd640854a3fa5dfc70e4875f3 # v3.0.4
73
+ with:
74
+ files: dist/*
75
+ generate_release_notes: true
@@ -0,0 +1,18 @@
1
+ [install]
2
+ minimumReleaseAge = 86400
3
+ minimumReleaseAgeExcludes = [
4
+ # A ts-standard release would otherwise wait a day before it installs.
5
+ "@jfalava/ts-standard",
6
+ # Tracks packageManager, which can move on the day Bun releases.
7
+ "bun-types",
8
+ "@effect/tsgo",
9
+ # @effect/tsgo's native binaries are optional dependencies; without these,
10
+ # bun skips them silently and `effect-tsgo patch` fails.
11
+ "@effect/tsgo-darwin-arm64",
12
+ "@effect/tsgo-darwin-x64",
13
+ "@effect/tsgo-linux-arm",
14
+ "@effect/tsgo-linux-arm64",
15
+ "@effect/tsgo-linux-x64",
16
+ "@effect/tsgo-win32-arm64",
17
+ "@effect/tsgo-win32-x64",
18
+ ]
@@ -0,0 +1,57 @@
1
+ import { fileURLToPath } from "node:url";
2
+
3
+ import cloudflare from "@cloudflare/oxlint-config";
4
+ import { defineConfig } from "oxlint";
5
+ import type { DummyRuleMap, OxlintConfig } from "oxlint";
6
+
7
+ // @cloudflare/oxlint-config is the base. `options` is root-only, so it is added back below.
8
+ const { options: presetOptions, ...preset } = cloudflare;
9
+
10
+ // The anti-slop rules the preset does not carry. An absolute path resolves the same from any
11
+ // config that spreads this one. This package does not depend on `effect`, so it does not load
12
+ // @jfalava/ts-standard/oxlint/effect; see examples/workspace for a repo that does.
13
+ const antiSlop = fileURLToPath(import.meta.resolve("@jfalava/ts-standard/oxlint"));
14
+
15
+ const plugins: NonNullable<OxlintConfig["plugins"]> = [
16
+ ...(preset.plugins ?? []),
17
+ "typescript",
18
+ "unicorn",
19
+ "oxc",
20
+ "import",
21
+ ];
22
+
23
+ const antiSlopRules: DummyRuleMap = {
24
+ "anti-slop/no-module-mocking": "error",
25
+ "anti-slop/require-safety-comment-for-type-assertion": "error",
26
+ };
27
+
28
+ // Preset rules turned off for good, each with its reason.
29
+ const policyRules: DummyRuleMap = {
30
+ // Taste: `T[]` and `Array<T>` are both fine.
31
+ "typescript/array-type": "off",
32
+ };
33
+
34
+ // Rules that fail when first turned on go here as `"<rule>": "off", // <findings>` until each
35
+ // finding is fixed or disabled at its line with a reason. The map ends empty.
36
+ const pendingRules: DummyRuleMap = {};
37
+
38
+ // `bun run lint` passes `--type-aware --type-check`; the default export sets them too.
39
+ export default defineConfig({
40
+ ...preset,
41
+ plugins: plugins.filter((plugin, index) => plugins.indexOf(plugin) === index),
42
+ jsPlugins: [...(preset.jsPlugins ?? []), { name: "anti-slop", specifier: antiSlop }],
43
+ // The preset turns oxlint's correctness category off.
44
+ categories: { correctness: "error" },
45
+ env: { ...preset.env, builtin: true },
46
+ rules: {
47
+ ...preset.rules,
48
+ ...antiSlopRules,
49
+ ...policyRules,
50
+ ...pendingRules,
51
+ },
52
+ options: {
53
+ ...presetOptions,
54
+ typeAware: true,
55
+ typeCheck: true,
56
+ },
57
+ });
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "example-cli",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "bin": {
6
+ "example-cli": "./index.ts"
7
+ },
8
+ "type": "module",
9
+ "scripts": {
10
+ "build": "mkdir -p dist && bun build --compile index.ts --outfile dist/example-cli",
11
+ "build:darwin-arm64": "mkdir -p dist && bun build --compile --target=bun-darwin-arm64 index.ts --outfile dist/example-cli-darwin-arm64",
12
+ "build:linux-arm64": "mkdir -p dist && bun build --compile --target=bun-linux-arm64 index.ts --outfile dist/example-cli-linux-arm64",
13
+ "build:linux-x64": "mkdir -p dist && bun build --compile --target=bun-linux-x64 index.ts --outfile dist/example-cli-linux-x64",
14
+ "build:windows-x64": "mkdir -p dist && bun build --compile --target=bun-windows-x64 index.ts --outfile dist/example-cli-windows-x64.exe",
15
+ "check": "bun run lint && bun run format:check && bun run typecheck && bun run test && bun run standard:check",
16
+ "fix": "bun run lint:fix && bun run format",
17
+ "format": "oxfmt",
18
+ "format:check": "oxfmt --check",
19
+ "lint": "oxlint --type-aware --type-check",
20
+ "lint:fix": "oxlint --type-aware --type-check --fix",
21
+ "prepare": "effect-tsgo patch --no-typescript --tsrs --oxlint",
22
+ "standard:check": "ts-standard",
23
+ "test": "bun test",
24
+ "typecheck": "effect-tsgo tsrs --noEmit"
25
+ },
26
+ "devDependencies": {
27
+ "@cloudflare/oxlint-config": "0.2.0",
28
+ "@effect/tsgo": "0.74.1",
29
+ "@jfalava/ts-standard": "0.3.5",
30
+ "@oxlint/plugins": "1.95.0",
31
+ "bun-types": "1.4.5",
32
+ "oxfmt": "0.80.0",
33
+ "oxlint": "1.95.0",
34
+ "tsrs": "7.1.0-beta.tsrs5"
35
+ },
36
+ "packageManager": "bun@1.4.5"
37
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "$schema": "./node_modules/@effect/tsgo/schema.json",
3
+ "compilerOptions": {
4
+ "lib": ["ESNext"],
5
+ "types": ["bun-types"],
6
+ "target": "ESNext",
7
+ "module": "Preserve",
8
+ "moduleDetection": "force",
9
+ "moduleResolution": "bundler",
10
+ "allowImportingTsExtensions": true,
11
+ "verbatimModuleSyntax": true,
12
+ "noEmit": true,
13
+
14
+ "strict": true,
15
+ "skipLibCheck": true,
16
+ "noFallthroughCasesInSwitch": true,
17
+ "noUncheckedIndexedAccess": true,
18
+ "noImplicitOverride": true,
19
+
20
+ // Turns the Effect diagnostics on. Without this entry typecheck passes a floating Effect.
21
+ "plugins": [{ "name": "@effect/language-service" }]
22
+ },
23
+ // Tests are typechecked in the same pass; there is no tsconfig.test.json.
24
+ "include": ["*.ts", "src/**/*.ts", "test/**/*.ts"]
25
+ }
@@ -0,0 +1,10 @@
1
+ import { defineConfig } from "oxlint";
2
+
3
+ import { antiSlopEffect, base } from "../oxlint.config.ts";
4
+
5
+ // This package lists `effect`, so it adds the Effect plugin to the root base.
6
+ export default defineConfig({
7
+ ...base,
8
+ jsPlugins: [...(base.jsPlugins ?? []), antiSlopEffect.jsPlugin],
9
+ rules: { ...base.rules, ...antiSlopEffect.rules },
10
+ });
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@example/api",
3
+ "private": true,
4
+ "type": "module",
5
+ "scripts": {
6
+ "check": "bun run lint && bun run format:check && bun run typecheck && bun run test",
7
+ "fix": "bun run lint:fix && bun run format",
8
+ "format": "oxfmt",
9
+ "format:check": "oxfmt --check",
10
+ "lint": "oxlint --type-aware --type-check --report-unused-disable-directives-severity=error",
11
+ "lint:fix": "oxlint --type-aware --type-check --report-unused-disable-directives-severity=error --fix",
12
+ "test": "vitest run",
13
+ "typecheck": "effect-tsgo tsrs --noEmit"
14
+ },
15
+ "dependencies": {
16
+ "effect": "catalog:effect"
17
+ },
18
+ "devDependencies": {
19
+ "@cloudflare/workers-types": "catalog:types",
20
+ "@oxlint/plugins": "catalog:build",
21
+ "oxfmt": "catalog:build",
22
+ "oxlint": "catalog:build",
23
+ "tsrs": "catalog:build",
24
+ "vitest": "catalog:build"
25
+ }
26
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "types": ["@cloudflare/workers-types"]
5
+ },
6
+ "include": ["src/**/*.ts", "test/**/*.ts"]
7
+ }
@@ -0,0 +1,18 @@
1
+ [install]
2
+ minimumReleaseAge = 86400
3
+ minimumReleaseAgeExcludes = [
4
+ # A ts-standard release would otherwise wait a day before it installs.
5
+ "@jfalava/ts-standard",
6
+ # Tracks packageManager, which can move on the day Bun releases.
7
+ "bun-types",
8
+ "@effect/tsgo",
9
+ # @effect/tsgo's native binaries are optional dependencies; without these,
10
+ # bun skips them silently and `effect-tsgo patch` fails.
11
+ "@effect/tsgo-darwin-arm64",
12
+ "@effect/tsgo-darwin-x64",
13
+ "@effect/tsgo-linux-arm",
14
+ "@effect/tsgo-linux-arm64",
15
+ "@effect/tsgo-linux-x64",
16
+ "@effect/tsgo-win32-arm64",
17
+ "@effect/tsgo-win32-x64",
18
+ ]
@@ -0,0 +1,10 @@
1
+ import { defineConfig } from "oxlint";
2
+
3
+ import { antiSlopEffect, base } from "../oxlint.config.ts";
4
+
5
+ // This package lists `effect`, so it adds the Effect plugin to the root base.
6
+ export default defineConfig({
7
+ ...base,
8
+ jsPlugins: [...(base.jsPlugins ?? []), antiSlopEffect.jsPlugin],
9
+ rules: { ...base.rules, ...antiSlopEffect.rules },
10
+ });
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@example/cli",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "bin": {
6
+ "example": "index.ts"
7
+ },
8
+ "type": "module",
9
+ "scripts": {
10
+ "build": "mkdir -p dist && bun build --compile index.ts --outfile dist/example",
11
+ "build:darwin-arm64": "mkdir -p dist && bun build --compile --target=bun-darwin-arm64 index.ts --outfile dist/example-darwin-arm64",
12
+ "build:linux-arm64": "mkdir -p dist && bun build --compile --target=bun-linux-arm64 index.ts --outfile dist/example-linux-arm64",
13
+ "build:linux-x64": "mkdir -p dist && bun build --compile --target=bun-linux-x64 index.ts --outfile dist/example-linux-x64",
14
+ "build:windows-x64": "mkdir -p dist && bun build --compile --target=bun-windows-x64 index.ts --outfile dist/example-windows-x64.exe",
15
+ "check": "bun run lint && bun run format:check && bun run typecheck && bun run test",
16
+ "fix": "bun run lint:fix && bun run format",
17
+ "format": "oxfmt",
18
+ "format:check": "oxfmt --check",
19
+ "lint": "oxlint --type-aware --type-check --report-unused-disable-directives-severity=error",
20
+ "lint:fix": "oxlint --type-aware --type-check --report-unused-disable-directives-severity=error --fix",
21
+ "test": "vitest run",
22
+ "typecheck": "effect-tsgo tsrs --noEmit"
23
+ },
24
+ "dependencies": {
25
+ "@effect/platform-bun": "catalog:effect",
26
+ "effect": "catalog:effect"
27
+ },
28
+ "devDependencies": {
29
+ "@oxlint/plugins": "catalog:build",
30
+ "bun-types": "catalog:build",
31
+ "oxfmt": "catalog:build",
32
+ "oxlint": "catalog:build",
33
+ "tsrs": "catalog:build",
34
+ "vitest": "catalog:build"
35
+ }
36
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "lib": ["ESNext"],
5
+ "target": "ESNext",
6
+ "module": "Preserve",
7
+ "types": ["bun-types"]
8
+ },
9
+ "include": ["*.ts", "src/**/*.ts", "test/**/*.ts"]
10
+ }
@@ -0,0 +1,7 @@
1
+ import { defineConfig } from "oxlint";
2
+
3
+ import { base } from "../oxlint.config.ts";
4
+
5
+ // This package does not list `effect`, so it takes the root base as it is, without the Effect
6
+ // plugin.
7
+ export default defineConfig({ ...base });
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@example/iac",
3
+ "private": true,
4
+ "type": "module",
5
+ "scripts": {
6
+ "check": "bun run lint && bun run format:check && bun run typecheck && bun run test",
7
+ "ci:deploy": "alchemy deploy --stage prod --yes",
8
+ "deploy": "alchemy deploy --stage prod",
9
+ "destroy": "alchemy destroy --stage prod",
10
+ "dev": "alchemy dev",
11
+ "fix": "bun run lint:fix && bun run format",
12
+ "format": "oxfmt",
13
+ "format:check": "oxfmt --check",
14
+ "lint": "oxlint --type-aware --type-check --report-unused-disable-directives-severity=error",
15
+ "lint:fix": "oxlint --type-aware --type-check --report-unused-disable-directives-severity=error --fix",
16
+ "plan": "alchemy plan --stage prod",
17
+ "test": "vitest run",
18
+ "typecheck": "effect-tsgo tsrs --noEmit"
19
+ },
20
+ "dependencies": {
21
+ "alchemy": "catalog:iac"
22
+ },
23
+ "devDependencies": {
24
+ "@oxlint/plugins": "catalog:build",
25
+ "@types/node": "catalog:types",
26
+ "oxfmt": "catalog:build",
27
+ "oxlint": "catalog:build",
28
+ "tsrs": "catalog:build",
29
+ "vitest": "catalog:build"
30
+ }
31
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "types": ["node"]
5
+ },
6
+ "include": ["alchemy.run.ts", "src/**/*.ts", "test/**/*.ts"]
7
+ }
@@ -0,0 +1,83 @@
1
+ import { fileURLToPath } from "node:url";
2
+
3
+ import cloudflare from "@cloudflare/oxlint-config";
4
+ import { recommended } from "@effect/tsgo/oxlint-presets";
5
+ import { defineConfig } from "oxlint";
6
+ import type { DummyRuleMap, OxlintConfig } from "oxlint";
7
+
8
+ // @cloudflare/oxlint-config without its root-only options, which only the default export adds.
9
+ const { options: presetOptions, ...preset } = cloudflare;
10
+
11
+ // The anti-slop rules the preset does not carry. Absolute paths resolve the same from every
12
+ // package config that spreads `base`.
13
+ const antiSlop = fileURLToPath(import.meta.resolve("@jfalava/ts-standard/oxlint"));
14
+
15
+ const antiSlopRules: DummyRuleMap = {
16
+ "anti-slop/no-module-mocking": "error",
17
+ "anti-slop/require-safety-comment-for-type-assertion": "error",
18
+ };
19
+
20
+ // Packages whose package.json lists `effect` add this plugin and its rules, and no others do:
21
+ // its rules match code shape and would report code that is not Effect.
22
+ export const antiSlopEffect = {
23
+ jsPlugin: {
24
+ name: "anti-slop-effect",
25
+ specifier: fileURLToPath(import.meta.resolve("@jfalava/ts-standard/oxlint/effect")),
26
+ },
27
+ rules: {
28
+ "anti-slop-effect/no-manual-effect-error-tag": "error",
29
+ "anti-slop-effect/no-manual-tag-comparison": "error",
30
+ "anti-slop-effect/no-manual-tagged-construction": "error",
31
+ "anti-slop-effect/no-service-constructor-imports": "error",
32
+ "anti-slop-effect/prefer-effect-match": "error",
33
+ } satisfies DummyRuleMap,
34
+ };
35
+
36
+ const plugins: NonNullable<OxlintConfig["plugins"]> = [
37
+ ...(preset.plugins ?? []),
38
+ ...(recommended.plugins ?? []),
39
+ "typescript",
40
+ "unicorn",
41
+ "oxc",
42
+ "import",
43
+ ];
44
+
45
+ // Preset rules turned off for good, each with its reason.
46
+ const policyRules: DummyRuleMap = {
47
+ // Effect idioms: `import * as Schema`, Data.TaggedError classes checked with instanceof, and
48
+ // generator callbacks declared next to their Effect.gen.
49
+ "import/no-namespace": "off",
50
+ "@nkzw/no-instanceof": "off",
51
+ "unicorn/consistent-function-scoping": "off",
52
+ };
53
+
54
+ // Rules that fail when first turned on go here as `"<rule>": "off", // <findings>` until each
55
+ // finding is fixed or disabled at its line with a reason. The map ends empty.
56
+ const pendingRules: DummyRuleMap = {};
57
+
58
+ // The shared base for package configs. Packages spread it; `extends` would drop env and overrides.
59
+ export const base = defineConfig({
60
+ ...preset,
61
+ plugins: plugins.filter((plugin, index) => plugins.indexOf(plugin) === index),
62
+ jsPlugins: [...(preset.jsPlugins ?? []), { name: "anti-slop", specifier: antiSlop }],
63
+ // The preset turns oxlint's correctness category off.
64
+ categories: { correctness: "error" },
65
+ rules: {
66
+ ...preset.rules,
67
+ ...recommended.rules,
68
+ ...antiSlopRules,
69
+ ...policyRules,
70
+ ...pendingRules,
71
+ },
72
+ });
73
+
74
+ // Root-only options. Package lint scripts pass `--type-aware --type-check` and
75
+ // `--report-unused-disable-directives-severity=error` on the command line instead.
76
+ export default defineConfig({
77
+ ...base,
78
+ options: {
79
+ ...presetOptions,
80
+ typeAware: true,
81
+ typeCheck: true,
82
+ },
83
+ });
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "example-monorepo",
3
+ "private": true,
4
+ "workspaces": {
5
+ "packages": [
6
+ "api",
7
+ "cli",
8
+ "iac"
9
+ ],
10
+ "catalogs": {
11
+ "build": {
12
+ "@cloudflare/oxlint-config": "0.2.0",
13
+ "@effect/tsgo": "0.74.1",
14
+ "@jfalava/ts-standard": "0.3.5",
15
+ "@oxlint/plugins": "1.95.0",
16
+ "bun-types": "1.4.5",
17
+ "oxfmt": "0.80.0",
18
+ "oxlint": "1.95.0",
19
+ "tsrs": "7.1.0-beta.tsrs5",
20
+ "vitest": "5.1.2"
21
+ },
22
+ "types": {
23
+ "@cloudflare/workers-types": "5.20261128.1",
24
+ "@types/node": "26.6.11"
25
+ },
26
+ "effect": {
27
+ "@effect/platform-bun": "4.1.6",
28
+ "effect": "4.1.6"
29
+ },
30
+ "iac": {
31
+ "alchemy": "2.0.0-beta.87"
32
+ }
33
+ }
34
+ },
35
+ "type": "module",
36
+ "scripts": {
37
+ "check": "bun run --workspaces check && oxfmt --check && bun run standard:check",
38
+ "ci:build": "bun run check",
39
+ "ci:deploy": "bun run --cwd iac ci:deploy",
40
+ "deploy": "bun run --cwd iac deploy",
41
+ "destroy": "bun run --cwd iac destroy",
42
+ "dev": "bun run --cwd iac dev",
43
+ "fix": "bun run --workspaces --if-present fix && oxfmt",
44
+ "format": "bun run --workspaces --if-present format && oxfmt",
45
+ "format:check": "bun run --workspaces --if-present format:check && oxfmt --check",
46
+ "lint": "bun run --workspaces --if-present lint",
47
+ "plan": "bun run --cwd iac plan",
48
+ "prepare": "effect-tsgo patch --no-typescript --tsrs --oxlint",
49
+ "standard:check": "ts-standard",
50
+ "test": "bun run --workspaces --if-present test",
51
+ "typecheck": "bun run --workspaces --if-present typecheck"
52
+ },
53
+ "devDependencies": {
54
+ "@cloudflare/oxlint-config": "catalog:build",
55
+ "@effect/tsgo": "catalog:build",
56
+ "@jfalava/ts-standard": "catalog:build",
57
+ "@oxlint/plugins": "catalog:build",
58
+ "oxfmt": "catalog:build",
59
+ "oxlint": "catalog:build",
60
+ "tsrs": "catalog:build"
61
+ },
62
+ "packageManager": "bun@1.4.5"
63
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "$schema": "./node_modules/@effect/tsgo/schema.json",
3
+ "compilerOptions": {
4
+ "target": "ES2024",
5
+ "lib": ["ES2024"],
6
+ "module": "ESNext",
7
+ "moduleResolution": "Bundler",
8
+ "allowImportingTsExtensions": true,
9
+ "resolveJsonModule": true,
10
+ "isolatedModules": true,
11
+ "verbatimModuleSyntax": true,
12
+ "forceConsistentCasingInFileNames": true,
13
+ "skipLibCheck": true,
14
+ "noEmit": true,
15
+
16
+ // Strict flags live here only; package tsconfigs set none.
17
+ "strict": true,
18
+ "noFallthroughCasesInSwitch": true,
19
+ "noImplicitOverride": true,
20
+ "noUncheckedIndexedAccess": true,
21
+
22
+ // Turns the Effect diagnostics on. Without this entry typecheck passes a floating Effect.
23
+ // Package tsconfigs must not override `plugins`.
24
+ "plugins": [{ "name": "@effect/language-service" }]
25
+ }
26
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jfalava/ts-standard",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
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,8 @@
13
13
  "files": [
14
14
  "src",
15
15
  "reference",
16
+ "docs",
17
+ "examples",
16
18
  "dist",
17
19
  "oxlint/LICENSE",
18
20
  "oxlint/UPSTREAM.md"