@opendesignai/harness 0.3.0-alpha.0 → 0.5.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,13 +8,13 @@
8
8
  Machine-checked rules for OpenDesign repositories (od-platform, openmotion, opengame), kept in one place and synced to every repository:
9
9
 
10
10
  - **`od/*` lint rules** written in ESLint plugin format and run by [Oxlint](https://oxc.rs/docs/guide/usage/linter) through `jsPlugins` ([decision record](docs/decisions/0001-oxlint.md));
11
- - **presets** (`base`, `platform-boundary`, `product`, and the opt-in `react-compiler` and `type-aware`) that a repository extends from its `.oxlintrc.json`;
11
+ - **presets** (`base`, `platform-boundary`, `product`, and the opt-in `react-compiler`, `testing`, `strict-types`, and `type-aware`) that a repository extends from its `.oxlintrc.json`;
12
12
  - **`od-harness` CLI**: a lint scope check (`lint-scope`), a file size budget (`size`), a baseline ratchet (`ratchet`), incremental duplication and unused-code checks (`clones` with jscpd, `unused` with knip), and `baseline move` for files that move;
13
13
  - **a reusable `harness-gates` workflow** (`.github/workflows/gates.yml`) that runs a repository's gate commands in CI.
14
14
 
15
- Existing debt is frozen in baselines (`oxlint-suppressions.json`, `.harness/size-baseline.json`); new violations fail, and the baselines may only shrink. Duplicated code and unused files, exports and dependencies need no baseline: `clones` and `unused` compare a change with its base commit and fail on what it adds. Error messages are written for coding agents: what was violated, the correct way, and the legitimate exemption, plus a link to the rule's page.
15
+ Existing debt is frozen in baselines (`oxlint-suppressions.json`, `.harness/size-baseline.json`); new violations fail, and baseline growth is limited to the [lint rule changes described in Versioning](#versioning). Duplicated code and unused files, exports and dependencies need no baseline: `clones` and `unused` compare a change with its base commit and fail on what it adds. Error messages are written for coding agents: what was violated, the correct way, and the legitimate exemption, plus a link to the rule's page.
16
16
 
17
- Status: alpha (0.3.0-alpha.0). Distributed through the public npm registry as `@opendesignai/harness` under the `alpha` dist-tag (npm organization `opendesignai`). 0.1.0-alpha.0 was published by hand; later versions are published by CI through npm trusted publishing (see [Versioning](#versioning)). How a repository adopts it: [docs/adopting.md](docs/adopting.md).
17
+ Status: alpha (0.5.0-alpha.0). Distributed through the public npm registry as `@opendesignai/harness` under the `alpha` dist-tag (npm organization `opendesignai`). 0.1.0-alpha.0 was published by hand; later versions are published by CI through npm trusted publishing (see [Versioning](#versioning)). How a repository adopts it: [docs/adopting.md](docs/adopting.md).
18
18
 
19
19
  ## Rules
20
20
 
@@ -38,18 +38,22 @@ Every rule is tested with ESLint's `RuleTester` and with the same cases run thro
38
38
 
39
39
  ## Presets
40
40
 
41
- | Preset | Contents |
42
- | -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
43
- | `presets/base.json` | the ten base `od/*` rules (`od/no-cjk-literal` off in tests and fixtures); Oxlint's `correctness` category (eslint, typescript, unicorn, oxc, react plugins); `react/rules-of-hooks`; `react/exhaustive-deps`; `eslint-comments/no-restricted-disable` forbidding inline disables of `od/*`, `eslint-comments/*`, `rules-of-hooks` and `no-abusive-eslint-disable` (bare names cover any `<prefix>/` form), and disable comments that name no rule (through od-harness's wrapper of the eslint-comments plugin, see [adopting](docs/adopting.md#3-clean-up-what-cannot-be-baselined)); `unicorn/no-abusive-eslint-disable` as a native second guard against disable comments that name no rule; unused disable directives reported as errors; warnings fail the run (`denyWarnings`); the eight compiler correctness rules in `react-compiler` and three noisy `suspicious` compiler rules (`react/exhaustive-effect-dependencies`, `react/hooks`, and `react/memo-dependencies`) turned off |
44
- | `presets/platform-boundary.json` | `od/no-product-literal`, `od/no-shell-imports-product` (inactive until the repository sets `shell` and `product`) |
45
- | `presets/product.json` | `od/no-product-literal`; product-package rules (published-imports-only, manifest checks) arrive with stage 2 |
46
- | `presets/react-compiler.json` | opt-in: nine React Compiler-derived rules (`react/refs`, `react/set-state-in-effect`, `react/immutability`, `react/preserve-manual-memoization`, `react/purity`, `react/use-memo`, `react/incompatible-library`, `react/static-components`, `react/unsupported-syntax`) as errors; extend it after `base` ([ADR 0002](docs/decisions/0002-react-compiler-rules.md)) |
47
- | `presets/type-aware.json` | opt-in: `typescript/no-floating-promises`, `typescript/no-misused-promises`, and `typescript/await-thenable` as errors with `oxlint-tsgolint`; extend it after `base` ([adoption guide](docs/adopting.md#type-aware-linting)) |
41
+ | Preset | Contents |
42
+ | -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
43
+ | `presets/base.json` | the 11 base `od/*` rules (`od/no-cjk-literal` off for tests and fixtures); Oxlint's `correctness` category (eslint, typescript, unicorn, oxc, react plugins); `typescript/ban-ts-comment` (Oxlint defaults); `react/rules-of-hooks`; `react/exhaustive-deps`; `eslint-comments/no-restricted-disable` forbidding inline disables of `od/*`, `eslint-comments/*`, `rules-of-hooks` and `no-abusive-eslint-disable` (bare names cover any `<prefix>/` form), and disable comments that name no rule (through od-harness's wrapper of the eslint-comments plugin, see [adopting](docs/adopting.md#3-clean-up-what-cannot-be-baselined)); `unicorn/no-abusive-eslint-disable` also rejects disables without rule names; unused disable directives reported as errors; warnings fail the run (`denyWarnings`); `eslint/no-control-regex`, the eight compiler correctness rules in `react-compiler` and three noisy `suspicious` compiler rules (`react/exhaustive-effect-dependencies`, `react/hooks`, and `react/memo-dependencies`) turned off |
44
+ | `presets/platform-boundary.json` | `od/no-product-literal`, `od/no-shell-imports-product` (inactive until the repository sets `shell` and `product`) |
45
+ | `presets/product.json` | `od/no-product-literal`; product-package rules (published-imports-only, manifest checks) arrive with stage 2 |
46
+ | `presets/react-compiler.json` | opt-in: nine React Compiler-derived rules (`react/refs`, `react/set-state-in-effect`, `react/immutability`, `react/preserve-manual-memoization`, `react/purity`, `react/use-memo`, `react/incompatible-library`, `react/static-components`, `react/unsupported-syntax`) as errors; extend it after `base` ([ADR 0002](docs/decisions/0002-react-compiler-rules.md)) |
47
+ | `presets/testing.json` | opt-in for Vitest: `vitest/no-focused-tests` and `vitest/no-disabled-tests` as errors. Extend after `base` and before presets that enable other Vitest rules. [Adoption guide](docs/adopting.md#testing-and-strict-types) |
48
+ | `presets/strict-types.json` | opt-in: `typescript/no-explicit-any` as an error. Extend after `base`. [Adoption guide](docs/adopting.md#testing-and-strict-types) |
49
+ | `presets/type-aware.json` | opt-in: `typescript/no-floating-promises`, `typescript/no-misused-promises`, and `typescript/await-thenable` as errors with `oxlint-tsgolint`; extend it after `base` ([adoption guide](docs/adopting.md#type-aware-linting)) |
48
50
 
49
51
  Presets are fragments: extend `base` plus the one that matches the repository. A repository that uses React Compiler also extends `react-compiler`, after `base` (od-platform from the start; a product repository in the change that turns React Compiler on). See [ADR 0002](docs/decisions/0002-react-compiler-rules.md).
50
52
 
51
53
  To opt into type-aware linting, install the pinned `oxlint-tsgolint` backend and extend `type-aware` after `base`. [Adoption guide](docs/adopting.md#type-aware-linting)
52
54
 
55
+ Extend `testing` to catch skipped or focused Vitest tests and `strict-types` to catch explicit TypeScript `any`. [Adoption guide](docs/adopting.md#testing-and-strict-types)
56
+
53
57
  With `categories.suspicious: "error"`, `base` keeps `react/exhaustive-effect-dependencies`, `react/hooks`, and `react/memo-dependencies` off. The category still enables `react/capitalized-calls`. See [optional `react/capitalized-calls`](docs/decisions/0002-react-compiler-rules.md#optional-reactcapitalized-calls) to enable it directly or configure exceptions.
54
58
 
55
59
  > **`od/no-shell-imports-product` is silent until it is configured.** `platform-boundary` turns it on, but it only reports once the repository's `.oxlintrc.json` sets both `shell` and `product` (as below). Without them it checks nothing and says nothing, so set them in the adoption change and check that a known shell-to-product import is reported.
@@ -80,7 +84,7 @@ Oxlint resolves `extends` as file paths, so the `./node_modules/…` prefix is r
80
84
  ```text
81
85
  od-harness lint-scope reject alternate lint configs and ignored tracked files
82
86
  od-harness size [--update | --init] file size budget (800 lines; tests and CSS 1,500)
83
- od-harness ratchet --base <ref> baselines may only shrink relative to <ref>
87
+ od-harness ratchet --base <ref> check baseline changes relative to <ref>
84
88
  --merge-base <ref> … relative to `git merge-base HEAD <ref>` (local runs)
85
89
  od-harness clones --base <ref> no duplicated code that <ref> does not have (jscpd)
86
90
  od-harness unused --base <ref> no unused files, exports, dependencies that <ref> does not have (knip)
@@ -88,6 +92,7 @@ od-harness comments --base <ref> report excess added comment lines as a not
88
92
  od-harness baseline move <from> <to> move baseline entries along with moved files
89
93
  od-harness init [--check] generate or check repository agent configuration
90
94
  od-harness doctor check the installed harness version and Codex hook trust
95
+ od-harness hooks report [--days N] [--format text|json] summarize local hook decisions
91
96
  od-harness verify [--quick | --ci --base <ref>] [--skip lint-scope] [--format text|json|github]
92
97
  od-harness --version print the version
93
98
  ```
@@ -128,8 +133,8 @@ This repository's own workflows are linted by `.github/workflows/workflow-lint.y
128
133
 
129
134
  ## Versioning
130
135
 
131
- - New rules, and changes that make a rule or a preset report more (for example putting the React Compiler rules back into `base`), only ship in minor or major versions (`0.x`: the second number). Patch versions fix false positives, messages and tooling, and may turn rules off. A patch that turns a rule off makes `oxlint` fail in a repository that baselined the rule ("There are suppressions that do not occur anymore") and turns that rule's disable comments into unused directives: the upgrade change runs `oxlint --prune-suppressions` and deletes those comments.
132
- - An upgrade that adds a rule commits the new rule's baseline entries in the same change (`oxlint --suppress-all` on an otherwise clean branch); a repository without `oxlint-suppressions.json` fixes the new violations instead, because only the adoption change may create a baseline file. `od-harness ratchet` accepts new rule IDs only in a change that upgrades `@opendesignai/harness`, or whose `.oxlintrc.json` change turns those rules on, both owner-reviewed ([docs/ratchet.md](docs/ratchet.md#why-a-config-or-version-change-admits-new-rule-ids)).
136
+ - New rules, and changes that make a rule or a preset report more (for example putting the React Compiler rules back into `base`), only ship in minor or major versions (`0.x`: the second number). Patch versions fix false positives, messages and tooling, and may turn rules off. When a patch reduces false positives or turns a rule off, existing suppressions can become stale and make `oxlint` fail ("There are suppressions that do not occur anymore"). Run `oxlint --prune-suppressions` in the upgrade change and delete any disable comments that become unused.
137
+ - When an upgrade adds a rule or makes an existing rule report more, commit the suppressions for existing files with the upgrade (`oxlint --suppress-all` on an otherwise clean branch). A repository without `oxlint-suppressions.json` fixes the new violations because only the adoption change may create a baseline file. `od-harness ratchet` allows existing rule totals to grow only in an owner-reviewed `@opendesignai/harness` upgrade. A change to `.oxlintrc.json` alone can admit only new rule IDs that the owner-reviewed change turns on. See [the ratchet policy](docs/ratchet.md#why-a-config-or-version-change-admits-new-rule-ids).
133
138
  - The public API includes the package's export `.` (`dist/plugin.mjs`: the `od` plugin as the default export, `VERSION`, and the types `Plugin`, `PluginRule`, `RuleContextLike` and `RuleMeta`), `./config` (`OxlintConfig` and `presets`), `./hook`, `./report`, `presets/*`, and the `od-harness` command. Other files in `dist/` are internal: the presets load `dist/eslint-comments.mjs` by path, and it exports the plugin and nothing else. Changes after 0.2.0-alpha.0: `dist/eslint-comments.mjs` no longer exports `clampLoc`, `parseRustDirective` and `wrapRule`, and the package no longer ships the declaration files `dist/cli.d.mts` (which was empty) and `dist/eslint-comments.d.mts`. The export `.` is unchanged. The build checks the packed package with publint and attw (`esm-only` profile) and fails on any warning.
134
139
  - Oxlint and the optional peer `oxlint-tsgolint` are pinned exactly. Every PR that upgrades Oxlint must also upgrade `oxlint-tsgolint`. An Oxlint upgrade is its own release, after the conformance suite, `pnpm smoke` and `pnpm hit-compare` agree. [ADR 0001](docs/decisions/0001-oxlint.md)
135
140
  - knip and jscpd are `dependencies`, pinned exactly: only od-harness runs them, so their versions are part of the harness release ([why](docs/unused.md#why-knip-is-a-dependency-of-od-harness)). So is oxc-parser, at the version knip depends on: `unused` reads comments with it.
@@ -14,4 +14,7 @@ function hookEnv() {
14
14
  stopBase: process.env["OD_HARNESS_BASE"]
15
15
  };
16
16
  }
17
- export { hookEnv as n, isGitHubActions as r, childEnv as t };
17
+ function hookLogMode() {
18
+ return process.env["OD_HARNESS_HOOK_LOG"];
19
+ }
20
+ export { isGitHubActions as i, hookEnv as n, hookLogMode as r, childEnv as t };