Skip to content

chore: enable type-aware linting with oxclint#1349

Merged
pi0 merged 1 commit into
h3js:mainfrom
nickspaargaren:type-aware-linting-via-oxlint
Mar 19, 2026
Merged

chore: enable type-aware linting with oxclint#1349
pi0 merged 1 commit into
h3js:mainfrom
nickspaargaren:type-aware-linting-via-oxlint

Conversation

@nickspaargaren

@nickspaargaren nickspaargaren commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

This PR enables type-aware linting using oxc's type-aware capabilities, allowing the project to leverage TypeScript type information for more sophisticated static analysis.

Some type-aware rules are currently disabled to avoid breaking the existing codebase. These can be gradually re-enabled through separate PRs that:

  1. Remove the rule from the disabled list in .oxlintrc.json
  2. Fix errors that the rule detects

This incremental approach allows us to improve type safety systematically without blocking this initial setup.

When I enabled this, the following rules had to be added:

  • Disabled specific type-aware rules that are currently incompatible or too strict for the codebase:
    • typescript/unbound-method
    • typescript/no-floating-promises
    • typescript/no-implied-eval
    • typescript/await-thenable
    • typescript/restrict-template-expressions
    • typescript/no-base-to-string
    • typescript/no-redundant-type-constituents
    • typescript/no-misused-spread

After approving / agreeing with this change I will create separate PR's to fix these errors/warnings myself.

Documentation

See oxc Type-Aware Linting docs for more information.

Summary by CodeRabbit

  • Chores
    • Integrated type checking into the linting process, eliminating the separate typecheck step.
    • Streamlined the CI workflow by removing the dedicated type-checking phase.
    • Updated linting configuration to enable type-aware analysis.
    • Updated development dependencies to support enhanced linting capabilities.

@nickspaargaren
nickspaargaren requested a review from pi0 as a code owner March 18, 2026 17:24
@coderabbitai

coderabbitai Bot commented Mar 18, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The pull request consolidates type checking into the linting phase by removing the separate pnpm typecheck step from the CI workflow and package scripts, adding oxlint-tsgolint as a devDependency with type-aware configuration, and updating documentation to reflect the new approach.

Changes

Cohort / File(s) Summary
Linting & Type Checking Integration
.oxlintrc.json, package.json, .github/workflows/ci.yml
Adds oxlint type-aware configuration with typeCheck enabled and disables several TypeScript-related rules. Removes the separate typecheck script and step from CI pipeline. Adds oxlint-tsgolint devDependency.
Documentation Updates
AGENTS.md
Updates command reference to remove the separate typecheck command and reflect that lint now includes type checking semantics.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Hops with glee, the lint now sees,
Types checked fast, no need for three,
Oxlint springs forth, so mighty and bright,
One swift command makes all things right!
No more steps apart, they're unified in heart!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title accurately reflects the main change: enabling type-aware linting with oxlint. It is concise, clear, and directly describes the primary objective of the PR.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
.oxlintrc.json (1)

10-17: Track disabled type-aware rules with explicit owners/issues.

Temporarily disabling these rules is reasonable for rollout, but add an explicit tracking map (rule → issue/owner/target PR) to avoid permanent drift.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.oxlintrc.json around lines 10 - 17, Add a tracking map for the disabled
type-aware rules so they don't drift: create a JSON object (e.g.,
"disabledRuleTracking") next to the existing rules in .oxlintrc.json that maps
each disabled rule name (typescript/unbound-method,
typescript/no-floating-promises, typescript/no-implied-eval,
typescript/await-thenable, typescript/restrict-template-expressions,
typescript/no-base-to-string, typescript/no-redundant-type-constituents,
typescript/no-misused-spread) to an owner, an issue or ticket ID, and a target
PR or date; ensure the mapping keys match the exact rule strings and that
maintainers update the map when flipping rules back on so the information
remains current.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.oxlintrc.json:
- Around line 10-17: Add a tracking map for the disabled type-aware rules so
they don't drift: create a JSON object (e.g., "disabledRuleTracking") next to
the existing rules in .oxlintrc.json that maps each disabled rule name
(typescript/unbound-method, typescript/no-floating-promises,
typescript/no-implied-eval, typescript/await-thenable,
typescript/restrict-template-expressions, typescript/no-base-to-string,
typescript/no-redundant-type-constituents, typescript/no-misused-spread) to an
owner, an issue or ticket ID, and a target PR or date; ensure the mapping keys
match the exact rule strings and that maintainers update the map when flipping
rules back on so the information remains current.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c7dbbf6b-ca43-4ea6-9240-36122d08c807

📥 Commits

Reviewing files that changed from the base of the PR and between 35d8a14 and fee3471.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • .github/workflows/ci.yml
  • .oxlintrc.json
  • AGENTS.md
  • package.json
💤 Files with no reviewable changes (1)
  • .github/workflows/ci.yml

@pi0

pi0 commented Mar 18, 2026

Copy link
Copy Markdown
Member

Very cool! I will check it locally before merge

In the meantime if you had time would be cool to make a codeup oxlint-ts action (similar to https://github.com/unjs/codeup/blob/main/actions/unjs/oxlint.ts) this way all UnJS/H3/Nitro packages can be auto migrated.

@pi0 pi0 changed the title Enable Type-Aware Linting with Oxclint chore: enable type-aware linting with oxclint Mar 19, 2026
@pi0
pi0 merged commit d274800 into h3js:main Mar 19, 2026
4 of 5 checks passed
@nickspaargaren

Copy link
Copy Markdown
Contributor Author

@pi0 I looked at the codeup actions for a bit, very interesting! It would help me a lot if there were a dedicated GitHub issue for this in the repo. Could you help me with that? Feel free to assign it to me if you’d like!

@pi0

pi0 commented Mar 21, 2026

Copy link
Copy Markdown
Member

Yes please feel free to make an issue or directly PR i can help on that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants