@opendesignai/harness 0.0.0-stage → 0.1.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/LICENSE +201 -0
- package/README.md +127 -2
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +380 -0
- package/dist/eslint-comments.d.mts +24 -0
- package/dist/eslint-comments.mjs +50 -0
- package/dist/paths-DBoYPrGy.mjs +59 -0
- package/dist/plugin.d.mts +25 -0
- package/dist/plugin.mjs +1040 -0
- package/docs/adopting.md +157 -0
- package/docs/decisions/0001-oxlint.md +74 -0
- package/docs/decisions/0002-react-compiler-rules.md +34 -0
- package/docs/ratchet.md +49 -0
- package/docs/rules/no-api-path-literal.md +35 -0
- package/docs/rules/no-cjk-literal.md +38 -0
- package/docs/rules/no-constant-flag.md +33 -0
- package/docs/rules/no-error-message-match.md +55 -0
- package/docs/rules/no-locale-branch.md +51 -0
- package/docs/rules/no-process-env.md +27 -0
- package/docs/rules/no-product-literal.md +35 -0
- package/docs/rules/no-raw-fetch.md +33 -0
- package/docs/rules/no-raw-storage.md +41 -0
- package/docs/rules/no-shell-imports-product.md +46 -0
- package/docs/rules/no-swallowed-catch.md +75 -0
- package/docs/rules/no-window-bus.md +35 -0
- package/docs/size.md +51 -0
- package/package.json +73 -3
- package/presets/base.json +7 -0
- package/presets/platform-boundary.json +4 -0
- package/presets/product.json +4 -0
- package/presets/react-compiler.json +13 -0
- package/presets/rules/base.json +47 -0
- package/presets/rules/platform-boundary.json +6 -0
- package/presets/rules/product.json +5 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,128 @@
|
|
|
1
|
-
#
|
|
1
|
+
# od-harness
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> [!WARNING]
|
|
4
|
+
> **Experimental.** This repository is an early pilot of the shared OpenDesign lint rules and CI
|
|
5
|
+
> gates. Rules, presets, commands and the workflow inputs will change without notice until the
|
|
6
|
+
> first stable release.
|
|
7
|
+
|
|
8
|
+
Machine-checked rules for OpenDesign repositories (od-platform, openmotion, opengame), kept in one place and synced to every repository:
|
|
9
|
+
|
|
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`) that a repository extends from its `.oxlintrc.json`;
|
|
12
|
+
- **`od-harness` CLI**: a file size budget (`size`) and a baseline ratchet (`ratchet`);
|
|
13
|
+
- **a reusable `harness-gates` workflow** (`.github/workflows/gates.yml`) that runs a repository's gate commands in CI.
|
|
14
|
+
|
|
15
|
+
Existing debt is frozen in baselines (`oxlint-suppressions.json`, `.harness/size-baseline.json`); new violations fail, and the baselines may only shrink. 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
|
+
|
|
17
|
+
Status: first version (0.1.0-alpha.0). Distributed through the public npm registry as `@opendesignai/harness` under the `alpha` dist-tag (npm organization `opendesignai`). The first alpha releases are published by hand from a `pnpm pack` tarball; a CI release workflow with npm trusted publishing follows once the package exists (see [Versioning](#versioning)). How a repository adopts it: [docs/adopting.md](docs/adopting.md).
|
|
18
|
+
|
|
19
|
+
## Rules
|
|
20
|
+
|
|
21
|
+
| Rule | Preset | Reports |
|
|
22
|
+
| ----------------------------------------------------------------------- | -------------------------- | --------------------------------------------------------------------------------------------- |
|
|
23
|
+
| [`od/no-product-literal`](docs/rules/no-product-literal.md) | platform-boundary, product | branching on product identity (`=== "opengame"`, `currentProductId() === …`) |
|
|
24
|
+
| [`od/no-shell-imports-product`](docs/rules/no-shell-imports-product.md) | platform-boundary | static imports from shell files into product directories (configured per repository) |
|
|
25
|
+
| [`od/no-locale-branch`](docs/rules/no-locale-branch.md) | base | hard-coded copy in branches derived from the locale (`isZh ? "标题" : "Title"`) |
|
|
26
|
+
| [`od/no-raw-storage`](docs/rules/no-raw-storage.md) | base | `localStorage` / `sessionStorage` outside the storage wrapper |
|
|
27
|
+
| [`od/no-swallowed-catch`](docs/rules/no-swallowed-catch.md) | base | empty `catch {}` and `.catch(() => null)`; `// fail-open: <reason>` marks deliberate ones |
|
|
28
|
+
| [`od/no-raw-fetch`](docs/rules/no-raw-fetch.md) | base | global `fetch()` outside the API client |
|
|
29
|
+
| [`od/no-api-path-literal`](docs/rules/no-api-path-literal.md) | base | hand-written `/api/…`, `/motion-api/…` paths outside the API client |
|
|
30
|
+
| [`od/no-window-bus`](docs/rules/no-window-bus.md) | base | `window.dispatchEvent`, `new CustomEvent`, listeners for custom event names on global objects |
|
|
31
|
+
| [`od/no-process-env`](docs/rules/no-process-env.md) | base | `process.env` outside the env registry |
|
|
32
|
+
| [`od/no-error-message-match`](docs/rules/no-error-message-match.md) | base | decisions made by matching error message text |
|
|
33
|
+
| [`od/no-cjk-literal`](docs/rules/no-cjk-literal.md) | base | CJK text in source literals and JSX text |
|
|
34
|
+
| [`od/no-constant-flag`](docs/rules/no-constant-flag.md) | base | module-level `const xxxEnabled = true` feature toggles |
|
|
35
|
+
|
|
36
|
+
Every rule is tested with ESLint's `RuleTester` and with the same cases run through the Oxlint CLI; both must report the same diagnostics. Together with `scripts/hit-compare.ts`, which compares ESLint and Oxlint hits on real code, that suite is the regression gate for Oxlint upgrades.
|
|
37
|
+
|
|
38
|
+
## Presets
|
|
39
|
+
|
|
40
|
+
| Preset | Contents |
|
|
41
|
+
| -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
42
|
+
| `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/*` and `rules-of-hooks`, 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)); unused disable directives reported as errors; the React Compiler-derived `react/*` rules turned off (see `react-compiler`) |
|
|
43
|
+
| `presets/platform-boundary.json` | `od/no-product-literal`, `od/no-shell-imports-product` (inactive until the repository sets `shell` and `product`) |
|
|
44
|
+
| `presets/product.json` | `od/no-product-literal`; product-package rules (published-imports-only, manifest checks) arrive with stage 2 |
|
|
45
|
+
| `presets/react-compiler.json` | opt-in: the eight 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`) as errors; extend it after `base` ([ADR 0002](docs/decisions/0002-react-compiler-rules.md)) |
|
|
46
|
+
|
|
47
|
+
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).
|
|
48
|
+
|
|
49
|
+
> **`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.
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"extends": [
|
|
54
|
+
"./node_modules/@opendesignai/harness/presets/base.json",
|
|
55
|
+
"./node_modules/@opendesignai/harness/presets/platform-boundary.json"
|
|
56
|
+
],
|
|
57
|
+
"rules": {
|
|
58
|
+
"od/no-shell-imports-product": [
|
|
59
|
+
"error",
|
|
60
|
+
{ "shell": ["studio/src/"], "product": ["studio/src/motion/game/"] }
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Oxlint resolves `extends` as file paths, so the `./node_modules/…` prefix is required. The base preset also turns on `reportUnusedDisableDirectives: "error"`, so the root config does not need to.
|
|
67
|
+
|
|
68
|
+
## CLI
|
|
69
|
+
|
|
70
|
+
```text
|
|
71
|
+
od-harness size [--update | --init] file size budget (800 lines; tests and CSS 1,500)
|
|
72
|
+
od-harness ratchet --base <ref> baselines may only shrink relative to <ref>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
See [docs/size.md](docs/size.md) and [docs/ratchet.md](docs/ratchet.md).
|
|
76
|
+
|
|
77
|
+
## CI
|
|
78
|
+
|
|
79
|
+
```yaml
|
|
80
|
+
jobs:
|
|
81
|
+
harness-gates:
|
|
82
|
+
uses: nexu-io/od-harness/.github/workflows/gates.yml@v1
|
|
83
|
+
with:
|
|
84
|
+
commands: pnpm test # optional: extra commands after the gates
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The workflow picks pnpm or npm from the lockfile, sets up Node from `.node-version`, installs with the frozen lockfile and runs the gates itself: `oxlint --deny-warnings`, `od-harness size` and `od-harness ratchet --base "$HARNESS_BASE_REF"` (through `pnpm exec` or `npx --no-install`), then each line of `commands`, reporting every failure. Full walkthrough: [docs/adopting.md](docs/adopting.md).
|
|
88
|
+
|
|
89
|
+
## Versioning
|
|
90
|
+
|
|
91
|
+
- 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.
|
|
92
|
+
- 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 when the `@opendesignai/harness` version or `.oxlintrc.json` changed in that change, both owner-reviewed ([docs/ratchet.md](docs/ratchet.md#why-a-config-or-version-change-admits-new-rule-ids)).
|
|
93
|
+
- Oxlint is pinned exactly (`peerDependencies`); 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)).
|
|
94
|
+
- Releases go to the public npm registry under the `alpha` dist-tag (`publishConfig`), published by CI through npm trusted publishing (OIDC, no npm token stored anywhere). That release workflow is not configured yet.
|
|
95
|
+
- Callers reference `gates.yml` by the git tag `v1`.
|
|
96
|
+
|
|
97
|
+
## Next steps
|
|
98
|
+
|
|
99
|
+
- **`od-harness baseline move`**: baselines are keyed by path, and `ratchet` rejects debt re-suppressed under a new path, so moving a file with debt means fixing it. The command must exist before the openmotion pilot branch adopts baselines and before files start moving between directories in the migration, whichever comes first.
|
|
100
|
+
- **`budget-exception`**: an owner-approved way through the gates for a single change (for example a PR label that `gates.yml` reads). Not built yet; today the only exemptions are owner-reviewed `overrides` in the lint config.
|
|
101
|
+
- **knip and jscpd as blocking incremental gates** (new findings only, existing ones tolerated), added to the `gates.yml` defaults.
|
|
102
|
+
|
|
103
|
+
## Development
|
|
104
|
+
|
|
105
|
+
```sh
|
|
106
|
+
corepack pnpm install
|
|
107
|
+
pnpm check # format, lint, size, build, typecheck, test, knip — what CI runs
|
|
108
|
+
pnpm smoke # pack, install into fresh npm and pnpm projects, lint with the presets (network)
|
|
109
|
+
pnpm trial <snapshot-dir>... # run the presets on git checkouts of product repositories (read-only; writes .trial/)
|
|
110
|
+
pnpm hit-compare <snapshot-dir>... # ESLint vs Oxlint hits on real code (after pnpm build); required before an Oxlint upgrade
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
| Path | Contents |
|
|
114
|
+
| ------------------------- | -------------------------------------------------------------------------------------------------- |
|
|
115
|
+
| `src/plugin/` | the `od` plugin: one file per rule in `rules/`, shared helpers in `utils/` |
|
|
116
|
+
| `src/eslint-comments/` | the eslint-comments plugin as the presets load it: upstream rules with a fix for Oxlint |
|
|
117
|
+
| `src/cli/` | `od-harness size` and `ratchet` |
|
|
118
|
+
| `presets/` | consumer presets; `presets/rules/` holds the rule sets without the plugin binding |
|
|
119
|
+
| `test/` | RuleTester cases (`test/rules/*.cases.ts`), Oxlint conformance, CLI, presets, workflow tests |
|
|
120
|
+
| `docs/` | rule pages, adoption guide, decision records; upstream issue drafts (`docs/upstream/`, not packed) |
|
|
121
|
+
| `tools/ts-eslint-parser/` | tests and `scripts/hit-compare.ts` only: typescript-eslint's parser pinned to TypeScript 6 |
|
|
122
|
+
| `scripts/` | `smoke-pack.ts`, `trial.ts`, `hit-compare.ts` |
|
|
123
|
+
|
|
124
|
+
This repository lints itself with the base rule set (`.oxlintrc.json` loads both plugins from `src/`).
|
|
125
|
+
|
|
126
|
+
## License
|
|
127
|
+
|
|
128
|
+
[Apache-2.0](LICENSE)
|
package/dist/cli.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|