Skip to content

refactor(linter): migrate from eslint to oxlint #152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Jun 14, 2025
Merged

refactor(linter): migrate from eslint to oxlint #152

merged 19 commits into from
Jun 14, 2025

Conversation

J3m5
Copy link
Contributor

@J3m5 J3m5 commented Jun 12, 2025

Oxlint — A Quick Intro

Oxlint is a next-generation JavaScript / TypeScript linter written in Rust.
Its 1.0 “stable” release (10 Jun 2025) makes it a production-ready, drop-in alternative to ESLint with dramatic performance gains and native TypeScript parsing.

Key Advantages over ESLint

  1. Brutal performance – Rust + SIMD + multithreading make Oxlint ~50-100 × faster than ESLint in real-world benches.

  2. Tiny memory footprint – avoids Node-JS heap spikes; runs comfortably under ~150 MB even on large codebases.

  3. Better DX – colourful code-frames, inline autofix hints, and clearer wording cut review time.

  4. TypeScript-first – parses TS natively; no separate @typescript-eslint stack required.

  5. Drop-in coverage – 500 + rules today, plus an eslint-plugin-oxlint shim to smooth migration.

  6. Single binary, tiny node_modules – the whole lint stack collapses from hundreds of JS packages to one ~5 MB binary.

  7. Scales with core-count – automatic parallelism on CI runners; ESLint is single-threaded.

What this PR does

  • Remove ESLint and its config; add Oxlint.
  • Enable stricter tsconfig options (erasableSyntaxOnly, etc.) and fix resulting type errors.
  • Refactor source to satisfy new linting rules and improved type checks.
  • Update lint scripts (npm run lint) to call oxlint.

Changelog

Bug Fixes

  • (oxlint) yoda rule - (b902069)
  • (oxlint) eslint/func-style - (100b03c)
  • (oxlint) unicorn/no-array-for-each - (b8c7e44)
  • (oxlint) unicorn/no-useless-promise-resolve-reject - (f92d329)
  • (oxlint) import/no-anonymous-default-export - (dab3e98)
  • (oxlint) typescript/consistent-indexed-object-style - (bc8a7da)
  • (oxlint) unicorn/prefer-spread - (9a350bb)
  • (oxlint) typescript/consistent-type-definitions - (f6166ce)
  • (oxlint) unicorn/consistent-function-scoping - (a333717)
  • (oxlint) unicorn/prefer-string-slice - (d2927e5)
  • (oxlint) unicorn/prefer-type-error - (01b5d49)
  • (oxlint) yoda+eslint/no-negated-condition - (4b63ea8)
  • (oxlint) unicorn/prefer-array-some - (c49984a)
  • (oxlint) promise/prefer-await-to-callbacks + eslint/no-inner-declarations - (b141b93)
  • (oxlint) vitest - (6de19af)
  • (ts/oxlint) enable tsconfig compilerOptions and oxlint rules - (34f0c40)
  • (tsconfig) enable erasableSyntaxOnly and fix errors - (c6f425b)

Miscellaneous Chores

  • (lint-config) remove eslint config and add exlint config - (27b4db6)
  • (package.json) remove eslint and add oxlint - (2cd4171)

blocked by #151

Copy link

github-actions bot commented Jun 12, 2025

Coverage Report

Status Category Percentage Covered / Total
🟢 Lines 71.07% (🎯 70%) 285 / 401
🟢 Statements 71.11% (🎯 70%) 288 / 405
🟢 Functions 71.64% (🎯 70%) 48 / 67
🟢 Branches 58.77% (🎯 58%) 211 / 359
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/Api.ts 100% 100% 100% 100%
src/Field.ts 100% 100% 100% 100%
src/Operation.ts 100% 100% 100% 100%
src/Parameter.ts 100% 100% 100% 100%
src/Resource.ts 100% 100% 100% 100%
src/graphql/fetchQuery.ts 0% 0% 0% 0% 4-39
src/graphql/parseGraphQl.ts 0% 0% 0% 0% 13-120
src/hydra/fetchJsonLd.ts 100% 95% 100% 100%
src/hydra/fetchResource.ts 100% 60% 100% 100%
src/hydra/getParameters.ts 90% 75% 100% 88.88% 14
src/hydra/getType.ts 22.72% 21.95% 100% 22.72% 7-10, 16, 24-51, 56-66
src/hydra/parseHydraDocumentation.ts 87.02% 76.47% 91.66% 86.92% 35, 64-66, 72, 80-82, 86-88, 108-114, 120, 127-129, 205, 220, 283, 291-296, 391
src/openapi3/getType.ts 80% 60% 100% 80% 12
src/openapi3/handleJson.ts 91.2% 71.55% 93.75% 91.11% 46, 125, 169, 176, 184, 202, 213, 281
src/openapi3/parseOpenApi3Documentation.ts 0% 0% 0% 0% 17-40
src/swagger/handleJson.ts 82.75% 66.66% 100% 82.75% 11, 26, 35, 41, 48
src/swagger/parseSwaggerDocumentation.ts 0% 100% 0% 0% 15-35
src/utils/assignSealed.ts 100% 100% 100% 100%
src/utils/getResources.ts 100% 100% 100% 100%
src/utils/parsedJsonReplacer.ts 100% 100% 100% 100%
Generated in workflow #220 for commit 91c0cb8 by the Vitest Coverage Report Action

@J3m5 J3m5 self-assigned this Jun 12, 2025
Base automatically changed from vitest to main June 14, 2025 17:54
J3m5 added 19 commits June 14, 2025 19:57
- expect-expect
- no-conditional-expect
- no-conditional-in-test
- no-standalone-expect
@J3m5 J3m5 merged commit 7a1e724 into main Jun 14, 2025
1 check passed
@J3m5 J3m5 deleted the oxlint branch June 14, 2025 17:58
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