feat: Change behaviour of eslint config - #2295
Conversation
✅ Deploy Preview for creative-fairy-df92c4 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
@wxt-dev/analytics
@wxt-dev/auto-icons
@wxt-dev/browser
@wxt-dev/i18n
@wxt-dev/is-background
@wxt-dev/module-react
@wxt-dev/module-solid
@wxt-dev/module-svelte
@wxt-dev/module-vue
@wxt-dev/runner
@wxt-dev/storage
@wxt-dev/unocss
@wxt-dev/webextension-polyfill
wxt
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2295 +/- ##
==========================================
+ Coverage 79.12% 79.36% +0.23%
==========================================
Files 134 134
Lines 3996 3993 -3
Branches 924 921 -3
==========================================
+ Hits 3162 3169 +7
+ Misses 737 730 -7
+ Partials 97 94 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@aklinker1 Should be good right now :) |
|
This PR is a breaking change as it stands now. I'm not going to merge it, we're making way to many breaking changes. Make it work for people who still use |
|
@aklinker1 Ok, i'll do a fallback and use |
unimport of wxtunimport of wxt
|
@aklinker1 I've rethough and rereview it, and i won't adjust it, because it can go to Let's wait with those(3) PRs on that topic, till you'll be releasing next It isn't that big breaking changes, ok yeah, user need to change params, but that's it. I want to suggest to do it in that way. |
|
No, this does not require a breaking change. We cannot have a release with as many breaking changes as this upcoming one ever again. I was too lax about this, and I don't think it will go over well with developers. Deprecate the options and continue to support them. We can remove them in the major version after this one. Removing deprecated APIs has a much smaller overhead for devs compared to hard cutting to a new behavior - people get warnings and can see the migration steps and take them ahead of time. |
|
@aklinker1 Yeah |
|
@aklinker1 Should be good |
unimport of wxtunimport of wxt
…ix references across project
f5d4c4a to
debe8a1
Compare
|
@aklinker1 Ready to go :) |
aklinker1
left a comment
There was a problem hiding this comment.
I'll go ahead and implement the changes for you, since it took so long to get to...
|
OK, so after cleaning some things up, I'm not sure this PR is meaningful. All we're doing is renaming The PR description says it resolves #1981, but that PR was about type errors, nothing to do with eslint 10 support. Plus WXT already supports eslint 10 - wxt/packages/wxt/src/builtin-modules/unimport.ts Lines 118 to 119 in caa3dce So I would push to:
|
unimport of wxtimports.eslint.enabled config
aklinker1
left a comment
There was a problem hiding this comment.
@PatrykKuniczak I've made lots of changes to this PR, see comments above. Feel free to merge if you are happy with the changes, or let's talk about it some more.
|
@aklinker1 I think that's not bad, but If 11 or 12 will be released and it won't be support 'flat' config, we can create new key for that or event move But maybe, OK let's leave only booleans and numbers there it'll be the most meaningful. |
|
@aklinker1 Seems, you've broken tests. |
There was a problem hiding this comment.
Pull request overview
This PR refines the imports.eslintrc.enabled configuration by clarifying its semantics, introducing a shared config-version type, switching the default from 'auto' to true, and updating resolution/generation and e2e tests accordingly.
Changes:
- Introduces
EslintConfigVersionand uses it across config types and ESLint config generation. - Updates config resolution to default
imports.eslintrc.enabledtotrueand treats'auto'as deprecated (with a warning). - Updates auto-import ESLint-related e2e tests to cover the new defaults and deprecation behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/wxt/src/types.ts | Adds EslintConfigVersion, updates Eslintrc / ResolvedEslintrc typing and docs for the new default/deprecation. |
| packages/wxt/src/core/resolve-config.ts | Changes default enabled resolution to true and adds a deprecation warning for 'auto'. |
| packages/wxt/src/builtin-modules/unimport.ts | Switches ESLint config generation to use the shared EslintConfigVersion type and explicit branching. |
| packages/wxt/e2e/tests/auto-imports.test.ts | Updates tests to reflect default true, 'auto' deprecation coverage, and config-version typing. |
Suppressed comments (3)
packages/wxt/src/types.ts:1716
ResolvedEslintrc.enabledis documented as "the major version of ESLint installed", but the type isfalse | EslintConfigVersion(currently8 | 9), which represents the generated config format rather than necessarily the installed major (eg ESLint 10+ still maps to the flat config). Please update the comment to match the actual meaning.
/** False if disabled, otherwise the major version of ESLint installed */
packages/wxt/e2e/tests/auto-imports.test.ts:241
- Test description typo: "ESlint" should be "ESLint".
it('"enabled: 8" should output a JSON config file compatible with ESlint <=8', async () => {
packages/wxt/e2e/tests/auto-imports.test.ts:258
- Test description typo: "ESlint" should be "ESLint".
it('"enabled: 9" should output a flat config file compatible with ESlint >=9', async () => {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
imports.eslint.enabled config|
@aklinker1 I've changed title and generate new description, i hope now it's more meaningful, previously it was bad indeed. |
|
Without |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Correct, since they're equivalent. |
|
@aklinker1 All right, thanks :) |

Overview
This pull request updates the handling of ESLint auto-import config generation in the WXT project. The main changes are a simplification of the
enabledoption for ESLint config generation, deprecating the'auto'option in favor oftrue, clarifying documentation, and improving type safety by introducing a dedicated type for ESLint config versions. Test cases and internal logic are updated to reflect these changes.Type safety and configuration updates:
EslintConfigVersiontype (8 | 9) intypes.tsto clarify and enforce valid ESLint config version values throughout the codebase.EslintrcandResolvedEslintrcinterfaces to use the newEslintConfigVersiontype, and clarified the documentation for theenabledoption, marking'auto'as deprecated and setting the default totrue. [1] [2]Logic and default behavior improvements:
imports.eslintrc.enabledfrom'auto'totrue, and updated the logic inresolve-config.tsto warn about and deprecate'auto'in favor oftrue.getEslintConfigEntryinunimport.ts) to use the newEslintConfigVersiontype for clarity and type safety. [1] [2] [3]Test updates:
auto-imports.test.tsto cover bothtrueand'auto'values for theenabledoption, and clarified test descriptions for ESLint 8 and 9 compatibility. [1] [2]EslintConfigVersion.These changes improve type safety, clarify configuration options, and ensure future compatibility as ESLint evolves.