Skip to content

Conversation

@SBoudrias
Copy link
Owner

Summary

Adopts oxlint's new type-aware linting feature (alpha) to replace typescript-eslint rules with ~10x faster performance.

Changes:

  • Upgrade oxlint to 1.33.0 and add oxlint-tsgolint companion package
  • Enable --type-aware flag in lint scripts
  • Migrate 22 type-aware rules from ESLint to oxlint:
    • Core async rules: await-thenable, no-floating-promises, no-misused-promises
    • 15 additional rules: no-deprecated, prefer-includes, no-for-in-array, etc.
    • 4 strict rules: no-unsafe-type-assertion, no-unnecessary-type-assertion, restrict-template-expressions, unbound-method
  • Add targeted overrides for legitimate type assertion patterns in tests and core packages
  • Disable corresponding ESLint rules to avoid duplicate checking

Commits:

  1. chore(deps): Upgrade oxlint to 1.33.0 and add oxlint-tsgolint
  2. feat(lint): Adopt type-aware linting with oxlint (basic 3 rules)
  3. feat(lint): Enable 15 additional type-aware rules
  4. feat(lint): Enable strict type assertion rules with targeted overrides

Test plan

  • yarn pretest passes with 0 errors
  • yarn test passes (all 282 tests)
  • Integration tests pass (CJS and ESM)

- Upgrade oxlint from 1.28.0 to 1.33.0 for type-aware linting support
- Upgrade eslint-plugin-oxlint from 1.28.0 to 1.33.0 for compatibility
- Add oxlint-tsgolint 0.9.1 as peer dependency for type-aware features

Rationale: oxlint 1.33.0 introduces alpha support for type-aware linting rules
which can replace several typescript-eslint rules with ~10x faster performance.
The oxlint-tsgolint companion package provides the TypeScript type information
needed for type-aware rule execution.
- Enable --type-aware flag in pretest and nano-staged scripts
- Configure type-aware rules in .oxlintrc.json:
  - Enable: await-thenable, no-floating-promises, no-misused-promises
  - Disable overly strict rules for this codebase
- Add overrides to allow floating promises in integration tests
- Disable migrated rules in ESLint to avoid duplicate checking

Rationale: Type-aware linting rules like no-floating-promises and await-thenable
catch common async/await mistakes at lint time. By running these through oxlint
instead of typescript-eslint, we get ~10x faster lint performance while
maintaining the same safety guarantees.
- Add type-aware rules: no-deprecated, prefer-includes, no-for-in-array,
  no-implied-eval, require-array-sort-compare, no-base-to-string,
  no-array-delete, only-throw-error, no-redundant-type-constituents,
  no-meaningless-void-operator, no-unsafe-enum-comparison, no-mixed-enums,
  switch-exhaustiveness-check, restrict-plus-operands, prefer-promise-reject-errors
- Disable 13 corresponding ESLint rules to avoid duplicate checking

Rationale: These additional type-aware rules catch common TypeScript mistakes
at lint time with ~10x faster performance than typescript-eslint equivalents.
All rules pass with 0 errors on the current codebase.
- Enable no-unsafe-type-assertion, no-unnecessary-type-assertion,
  restrict-template-expressions, and unbound-method rules globally
- Add targeted overrides for legitimate type assertion patterns:
  - Test files: disable assertion rules for test utilities
  - Integration tests: disable floating promises for test patterns
  - Core packages: disable unsafe assertions for generic type patterns
- Disable corresponding ESLint rules (unbound-method, etc.)
- Remove redundant ESLint test file override (now handled by oxlint)

Rationale: Strict type assertion rules catch unsafe casts at lint time.
Targeted overrides allow intentional patterns in tests and core generic
implementations while enforcing safety in application code.
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