[pull] main from trunk-io:main - #83
Merged
Merged
Conversation
## What? Add an Oxlint integration for JavaScript, TypeScript, JSX, and TSX: - Run Oxlint with SARIF output for diagnostics. - Run Oxfmt as the formatter. - Recognize the documented Oxlint and Oxfmt configuration files. - Track configuration inputs that affect lint and format results. - Add lint and format integration tests with pinned-version snapshots. - Document Oxlint in the supported-linters list. ## Why? Oxlint and Oxfmt provide fast, dedicated linting and formatting with strong ESLint and Prettier compatibility. This integration installs both tools hermetically and follows their current configuration and CLI conventions. ## Validation - `npm test -- linters/oxlint` - `PLUGINS_TEST_LINTER_VERSION=KnownGoodVersion npm test -- linters/oxlint` - `npm test -- tests/repo_tests/config_check.test.ts --runInBand` - `npm test -- tests/repo_tests` (Graphite submit hook) - `trunk check ...` on all changed source files - Snyk Code scan: no findings Co-authored-by: Eli Schleifer <1265982+EliSchleifer@users.noreply.github.com>
## Summary
- Move clang-format's default `version` from `14.0.1` and the lint
`known_good_version` from `16.0.3` to `20.1.0`, the newest patch the
trunk.io CDN actually hosts.
- Add a header comment in `plugin.yaml` enumerating the patches
available per platform on the trunk.io CDN so future contributors can
pick a working version without trial-and-error.
The `downloads:` block is structurally unchanged — only the default and
the documented `known_good_version` move.
## Test plan
- [x] Pre-push hook runs
`tests/repo_tests/{valid_package_download,config_check}.test.ts` —
passed (228 tests, 1 snapshot).
- [ ] Snapshot update: the lint test currently uses
`clang_format_v16.0.3_*.shot`; running with `known_good_version: 20.1.0`
will regenerate snapshots.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Eli Schleifer <1265982+EliSchleifer@users.noreply.github.com>
Avoid taking a go runtime dependency - use prebuilt binaries
## Summary The `pinact` linter's autofix corrupts every `uses:` line it pins. Running `trunk check --fix` (or fmt-on-save) turns: ```yaml uses: actions/checkout@v4 ``` into: ```yaml uses: actions/checkout@11d5960 # v4.4.0 uses: actions/checkout@v4 ``` The pinned ref is written, but the original `uses: …@v4` is left dangling on the same line (falling past the `#` into a comment). Every pinned action is affected. ### Root cause The plugin passes pinact's SARIF straight to Trunk's fix applier. pinact describes each fix with a **line-only** region: ```json "deletedRegion": { "startLine": 40 }, "insertedContent": { "text": " uses: actions/checkout@<sha> # v4.4.0" } ``` Trunk reads a `deletedRegion` with no `endLine`/columns as a **zero-width insertion point at column 1**, so it *inserts* the pinned line and never deletes the original — concatenating both. The `ruff`/`sqlfluff`/etc. converters in this repo don't hit this because they always emit a fully-specified region (`startLine`+`startColumn`+`endLine`+`endColumn`). ### Fix `pinact_run.py` now post-processes pinact's SARIF before emitting it (`normalize_fix_regions`): each fix's `deletedRegion` is widened to span the whole original line (`startColumn: 1` → `endColumn: len(line)+1`, `endLine = startLine`), matching the convention Trunk applies correctly. It's a no-op for any region pinact ever fully specifies (guards on `endColumn`/`endLine`/`charLength`/`charOffset`). ### Coverage gap this exposes None of the existing snapshot tests ever applied a pinact fix — the driver's `runCheck` forces `-n` (`--no-fix`), so every snapshot only covered parse-errors. Added a regression test that applies a real fix and asserts the line is pinned to a SHA **without** the concatenation corruption. Verified it fails without the `pinact_run.py` change and passes with it. It's online-gated (a resolvable SHA is required) and version-independent (does not snapshot the volatile SHA). ## Test plan - [x] `trunk fmt` + `trunk check` on both changed files — no new issues - [x] New regression test passes with the fix, fails without it - [x] End-to-end: applied against a repo with ~170 pinned `uses:` lines — 0 mangled, byte-for-byte identical to a direct `pinact run` - [x] Pre-push repo tests pass (232/232) Made with [Cursor](https://cursor.com) --------- Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )