Skip to content

chore(lint): enable oxlint auto-removal of unused imports#8450

Merged
steveruizok merged 7 commits into
mainfrom
stever/oxlint-auto-remove-unused-imports
Apr 4, 2026
Merged

chore(lint): enable oxlint auto-removal of unused imports#8450
steveruizok merged 7 commits into
mainfrom
stever/oxlint-auto-remove-unused-imports

Conversation

@steveruizok

@steveruizok steveruizok commented Apr 4, 2026

Copy link
Copy Markdown
Collaborator

In order to automatically remove unused imports via oxlint (replacing the previous prettier-plugin-organize-imports behavior), this PR bumps oxlint to v1.58.0 and enables the new safe-fix option for import removal. It also migrates all tsconfig files from moduleResolution: "node" (node10) to "bundler", the modern setting for bundler-based projects like tldraw.

What changed

  • oxlint v1.58.0 — adds safe-fix support for import removal (feat(linter/no-unused-vars): add safe-fix option for import fixes oxc-project/oxc#20839), so oxlint --fix removes unused imports without --fix-dangerously
  • no-unused-vars config — added "fix": { "imports": "safe-fix", "variables": "off" } so only imports are auto-removed
  • moduleResolution: "bundler" — migrated the base tsconfig and 6 other tsconfig files from "node" to "bundler". This was required because oxlint-tsgolint 0.18+ (peer dep of oxlint 1.58.0) dropped support for moduleResolution: "node10"
  • oxlint-tsgolint ^0.18.0 — bumped to satisfy oxlint 1.58.0 peer dependency

Relates to oxc-project/oxc#18301

Change type

  • improvement

Test plan

  1. Add unused imports to a .tsx file
  2. Run npx oxlint --fix <file>
  3. Verify unused imports are removed and unused variables are left alone
  4. Run yarn typecheck — passes cleanly
  5. Run yarn lint — passes with 0 errors
  • Unit tests
  • End to end tests

Code changes

Section LOC change
Config/tooling +15 / -11

Bump oxlint to v1.58.0 which includes safe-fix support for import
removal (oxc-project/oxc#20839). Configure the no-unused-vars rule
with `"fix": { "imports": "safe-fix", "variables": "off" }` so that
unused imports are automatically removed by `oxlint --fix` without
requiring `--fix-dangerously`.
@vercel

vercel Bot commented Apr 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
examples Ready Ready Preview Apr 4, 2026 11:31am
tldraw-docs Ready Ready Preview Apr 4, 2026 11:31am
4 Skipped Deployments
Project Deployment Actions Updated (UTC)
analytics Ignored Ignored Preview Apr 4, 2026 11:31am
chat-template Ignored Ignored Preview Apr 4, 2026 11:31am
tldraw-shader Ignored Ignored Preview Apr 4, 2026 11:31am
workflow-template Ignored Ignored Preview Apr 4, 2026 11:31am

Request Review

@huppy-bot huppy-bot Bot added the improvement Product improvement label Apr 4, 2026
oxlint-tsgolint 0.18+ removed support for moduleResolution: "node"
(node10), which our base tsconfig uses. Reverting to 0.17.x avoids
34 "Invalid tsconfig" errors without requiring a moduleResolution
change across the monorepo.
Migrate all tsconfig files using moduleResolution "node" (node10) to
"bundler", the modern setting for bundler-based projects. This allows
bumping oxlint-tsgolint to ^0.18.0 (which dropped node10 support)
and resolves the peer dependency mismatch with oxlint 1.58.0.

Files changed:
- internal/config/tsconfig.base.json (base config for all packages)
- apps/vscode/editor/tsconfig.json
- apps/vscode/extension/tsconfig.json
- internal/apps-script/tsconfig.json
- templates/agent/tsconfig.json
- templates/nextjs/tsconfig.json
- templates/chat/tsconfig.json
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Apr 4, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
agent-template eace1de Apr 04 2026, 10:58 AM

The moduleResolution: "bundler" change triggered a linter that added
target: "ES2017", but the codebase uses the regex dotAll flag (`s`)
which requires ES2018+.
Refactor code snippets in apps/docs/content/releases/next.mdx for readability and correctness: collapse small JSX props onto a single line, expand one-line method implementations into multi-line blocks, and add a leading semicolon before the final <Tldraw /> example to avoid automatic semicolon insertion issues after the class declaration.
@vercel vercel Bot temporarily deployed to Preview – workflow-template April 4, 2026 11:22 Inactive
@vercel vercel Bot temporarily deployed to Preview – chat-template April 4, 2026 11:22 Inactive
@vercel vercel Bot temporarily deployed to Preview – tldraw-shader April 4, 2026 11:22 Inactive
@steveruizok steveruizok enabled auto-merge April 4, 2026 11:23
@steveruizok steveruizok added this pull request to the merge queue Apr 4, 2026
Merged via the queue into main with commit 18558fd Apr 4, 2026
18 checks passed
@steveruizok steveruizok deleted the stever/oxlint-auto-remove-unused-imports branch April 4, 2026 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Product improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant