ci: add oxlint as fast pre-lint pass before ESLint#10355
Open
benpsnyder wants to merge 2 commits intoTanStack:mainfrom
Open
ci: add oxlint as fast pre-lint pass before ESLint#10355benpsnyder wants to merge 2 commits intoTanStack:mainfrom
benpsnyder wants to merge 2 commits intoTanStack:mainfrom
Conversation
…nfiguration - Added `eslint-plugin-oxlint` and `jiti` as dependencies. - Created `oxlint.config.ts` for custom linting rules and configurations. - Updated `eslint.config.js` to include oxlint settings and disable overlapping ESLint rules. - Modified package scripts to include a new `test:oxlint` command for running oxlint checks. - Adjusted test files to comply with new linting rules.
Contributor
📝 WalkthroughWalkthroughAdded oxlint integration: new Changes
Sequence Diagram(s)sequenceDiagram
participant DevTool as "ESLint/Runner"
participant RootConfig as "eslint.config.js"
participant Jiti as "jiti loader"
participant OxlintConfig as "oxlint.config.ts"
participant Oxlint as "oxlint.buildFromOxlintConfig"
participant ESLintEngine as "Final ESLint config"
DevTool->>RootConfig: Load config (runtime)
RootConfig->>Jiti: require('./oxlint.config.ts')\nvia jiti(import.meta.url)
Jiti->>OxlintConfig: compile & return default export
OxlintConfig->>Oxlint: pass config to buildFromOxlintConfig(...)
Oxlint-->>RootConfig: return oxlint rule configs
RootConfig->>ESLintEngine: append oxlint rules,\nmerge plugins & linterOptions
ESLintEngine-->>DevTool: run lint with final config
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
- Added `eslint-plugin-unused-imports` to manage unused imports. - Updated `@tanstack/eslint-config` to version 0.4.0 for improved linting rules. - Modified ESLint configurations across multiple packages to include type annotations and ensure consistent exports. - Adjusted rules in `oxlint.config.ts` to allow shadowing and refined other linting rules. - Updated package dependencies in `pnpm-lock.yaml` to reflect the changes.
4 tasks
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
🎯 Changes
Add oxlint (Rust-based linter, ~50-100x faster than ESLint) as a first-pass linter that runs before ESLint in CI. Oxlint handles the bulk of correctness rules in ~250ms across 691 files, letting ESLint focus only on rules it exclusively covers (cspell, type-aware typescript-eslint rules, import ordering, react-hooks).
This pattern is already used by Preact, Sentry, Renovate, and Kibana. The implementation follows the same approach used in the AnalogJS repo (v3-alpha branch).
What changed:
oxlint.config.ts— typed config withdefineConfig, plugins: typescript, vitest, import, reacteslint.config.js— imports oxlint config via jiti, appendsbuildFromOxlintConfig()as last entry to auto-disable overlapping rules, setsreportUnusedDisableDirectives: 'off'package.json— addstest:oxlintscript, adds it totest:pr/test:ciNx targets andincludedScriptspackages/vue-query/src/__tests__/useMutation.test.ts— fix pre-existing unsafe optional chaining with a defensive checkpackages/react-query/src/__tests__/useQuery.promise.test.tsx— suppress false positive on vitest 3-argdescribe()with options objectoxlint,eslint-plugin-oxlint,jitiAlso incorporated from other open PRs:
@tanstack/eslint-configbump to 0.4.0,eslint-plugin-unused-imports, JSDoc type annotations +const configexport style on all 31 eslint configs,no-shadow/pnpm/enforce-catalog/pnpm/json-enforce-catalogrule overridesvitest/expect-expectis now handled by oxlint at warn level, so the eslint-disable comments that PR adds are no longer neededRules that stay ESLint-only (no oxlint equivalent)
@cspell/eslint-plugin(spell checking)@typescript-eslint/consistent-type-imports,array-type,naming-convention,method-signature-style@typescript-eslint/no-unnecessary-condition,no-unnecessary-type-assertion,no-for-in-array,require-await(type-aware)import/*rules (ordering, no-commonjs, no-duplicates)node/prefer-node-protocol@stylistic/spaced-commentsort-importseslint-plugin-react-hooksRelated issues & PRs
Superseded by this PR (can be closed):
vitest/expect-expect, making the eslint-disable comments unnecessaryRelated but independent (not affected by this PR):
This is PR 1 of 6 in the Oxc/Rolldown/tsdown modernization series.
✅ Checklist
pnpm run test:pr.🚀 Release Impact