fix(#421): defineConfig compatible#466
Conversation
🦋 Changeset detectedLatest commit: 91fb01f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
defineConfig compatibledefineConfig compatible
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughUpdates TypeScript typings to use ESLint's native Linter types, makes createFlatConfig generic, adjusts exported plugin/config types for defineConfig compatibility, adds expect-type for type tests, adds a changeset, and introduces type-level tests validating the exports. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
defineConfig compatibledefineConfig compatible
commit: |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
test/index.spec-d.ts (1)
6-35: Consider adding test coverage forflatConfigs.warnings.The test covers
electron,errors,stage-0,react,react-native,typescript, andrecommended, butwarningsis also present inflatConfigs(seesrc/index.ts:160) and isn't tested.📝 Suggested addition
expectTypeOf(flatConfigs.recommended).toExtend< Parameters<typeof defineConfig>[0] >() + + expectTypeOf(flatConfigs.warnings).toExtend< + Parameters<typeof defineConfig>[0] + >() })🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@test/index.spec-d.ts` around lines 6 - 35, Add a type test for flatConfigs.warnings similar to the existing ones: in the describe block in test/index.spec-d.ts add an expectTypeOf(flatConfigs.warnings).toExtend<Parameters<typeof defineConfig>[0]>() so flatConfigs.warnings is covered alongside flatConfigs.electron, errors, stage-0, react, react-native, typescript, and recommended.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@test/index.spec-d.ts`:
- Around line 6-35: Add a type test for flatConfigs.warnings similar to the
existing ones: in the describe block in test/index.spec-d.ts add an
expectTypeOf(flatConfigs.warnings).toExtend<Parameters<typeof
defineConfig>[0]>() so flatConfigs.warnings is covered alongside
flatConfigs.electron, errors, stage-0, react, react-native, typescript, and
recommended.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: d77ca44c-a4d0-4904-b144-c9c2aa7687f5
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (5)
.changeset/common-results-stay.mdpackage.jsonsrc/index.tssrc/types.tstest/index.spec-d.ts
43081j
left a comment
There was a problem hiding this comment.
Looks good to me!
Maybe worth trying it out in a real world project somewhere
Can be easily verified with #466 (comment) npm i https://pkg.pr.new/eslint-plugin-import-x@466
pnpm add https://pkg.pr.new/eslint-plugin-import-x@466Update: it does work with my
|

Fixes #421, make
eslint-plugin-import-xcompatible with ESLintdefineConfig().The PR also manages to retain the
Linter.Config<RulesRecord>'sRulesRecordgeneric as readable, check the outputindex.d.ts:TODO:
plugintype correct as wellSummary by CodeRabbit
Enhancements
Tests
Chores