Skip to content

feat: Change behaviour of eslint config - #2295

Merged
PatrykKuniczak merged 20 commits into
wxt-dev:mainfrom
PatrykKuniczak:feat/add-eslint-10-unimport-support
Aug 1, 2026
Merged

feat: Change behaviour of eslint config#2295
PatrykKuniczak merged 20 commits into
wxt-dev:mainfrom
PatrykKuniczak:feat/add-eslint-10-unimport-support

Conversation

@PatrykKuniczak

@PatrykKuniczak PatrykKuniczak commented Apr 24, 2026

Copy link
Copy Markdown
Collaborator

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 enabled option for ESLint config generation, deprecating the 'auto' option in favor of true, 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:

  • Introduced a new EslintConfigVersion type (8 | 9) in types.ts to clarify and enforce valid ESLint config version values throughout the codebase.
  • Updated the Eslintrc and ResolvedEslintrc interfaces to use the new EslintConfigVersion type, and clarified the documentation for the enabled option, marking 'auto' as deprecated and setting the default to true. [1] [2]

Logic and default behavior improvements:

  • Changed the default for imports.eslintrc.enabled from 'auto' to true, and updated the logic in resolve-config.ts to warn about and deprecate 'auto' in favor of true.
  • Refactored internal function signatures and usages (e.g., getEslintConfigEntry in unimport.ts) to use the new EslintConfigVersion type for clarity and type safety. [1] [2] [3]

Test updates:

  • Updated and expanded ESLint config generation tests in auto-imports.test.ts to cover both true and 'auto' values for the enabled option, and clarified test descriptions for ESLint 8 and 9 compatibility. [1] [2]
  • Updated helper signatures and usages in tests to use EslintConfigVersion.

These changes improve type safety, clarify configuration options, and ensure future compatibility as ESLint evolves.

@netlify

netlify Bot commented Apr 24, 2026

Copy link
Copy Markdown

Deploy Preview for creative-fairy-df92c4 ready!

Name Link
🔨 Latest commit ee9b50f
🔍 Latest deploy log https://app.netlify.com/projects/creative-fairy-df92c4/deploys/6a6e164da682e000072cc819
😎 Deploy Preview https://deploy-preview-2295--creative-fairy-df92c4.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the pkg/wxt Includes changes to the `packages/wxt` directory label Apr 24, 2026
@pkg-pr-new

pkg-pr-new Bot commented Apr 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

@wxt-dev/analytics

npm i https://pkg.pr.new/@wxt-dev/analytics@2295

@wxt-dev/auto-icons

npm i https://pkg.pr.new/@wxt-dev/auto-icons@2295

@wxt-dev/browser

npm i https://pkg.pr.new/@wxt-dev/browser@2295

@wxt-dev/i18n

npm i https://pkg.pr.new/@wxt-dev/i18n@2295

@wxt-dev/is-background

npm i https://pkg.pr.new/@wxt-dev/is-background@2295

@wxt-dev/module-react

npm i https://pkg.pr.new/@wxt-dev/module-react@2295

@wxt-dev/module-solid

npm i https://pkg.pr.new/@wxt-dev/module-solid@2295

@wxt-dev/module-svelte

npm i https://pkg.pr.new/@wxt-dev/module-svelte@2295

@wxt-dev/module-vue

npm i https://pkg.pr.new/@wxt-dev/module-vue@2295

@wxt-dev/runner

npm i https://pkg.pr.new/@wxt-dev/runner@2295

@wxt-dev/storage

npm i https://pkg.pr.new/@wxt-dev/storage@2295

@wxt-dev/unocss

npm i https://pkg.pr.new/@wxt-dev/unocss@2295

@wxt-dev/webextension-polyfill

npm i https://pkg.pr.new/@wxt-dev/webextension-polyfill@2295

wxt

npm i https://pkg.pr.new/wxt@2295

commit: ee9b50f

@codecov

codecov Bot commented Apr 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.36%. Comparing base (accf458) to head (ee9b50f).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread packages/wxt/src/types.ts Outdated
@PatrykKuniczak

Copy link
Copy Markdown
Collaborator Author

@aklinker1 Should be good right now :)

@aklinker1

Copy link
Copy Markdown
Member

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 8 and 9 literals.

@PatrykKuniczak

Copy link
Copy Markdown
Collaborator Author

@aklinker1 Ok, i'll do a fallback and use @deprecated docs.

@PatrykKuniczak PatrykKuniczak changed the title feat: Add eslint 10 support for unimport of wxt feat!: Add eslint 10 support for unimport of wxt Jun 29, 2026
@PatrykKuniczak

Copy link
Copy Markdown
Collaborator Author

@aklinker1 I've rethough and rereview it, and i won't adjust it, because it can go to major with #2296

Let's wait with those(3) PRs on that topic, till you'll be releasing next major.

It isn't that big breaking changes, ok yeah, user need to change params, but that's it.
#2296 it bigger thing and i think both of those PRs should go in one release and that'll have the biggest sense and impact.

I want to suggest to do it in that way.

@aklinker1

aklinker1 commented Jun 29, 2026

Copy link
Copy Markdown
Member

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.

@PatrykKuniczak

Copy link
Copy Markdown
Collaborator Author

@aklinker1 Yeah
All right

@PatrykKuniczak

Copy link
Copy Markdown
Collaborator Author

@aklinker1 Should be good

@PatrykKuniczak PatrykKuniczak changed the title feat!: Add eslint 10 support for unimport of wxt feat: Add eslint 10 support for unimport of wxt Jul 1, 2026
@PatrykKuniczak
PatrykKuniczak force-pushed the feat/add-eslint-10-unimport-support branch from f5d4c4a to debe8a1 Compare July 29, 2026 11:44
@PatrykKuniczak
PatrykKuniczak requested a review from aklinker1 July 29, 2026 11:49
@PatrykKuniczak

Copy link
Copy Markdown
Collaborator Author

@aklinker1 Ready to go :)

@aklinker1 aklinker1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll go ahead and implement the changes for you, since it took so long to get to...

Comment thread packages/wxt/e2e/tests/auto-imports.test.ts Outdated
Comment thread packages/wxt/e2e/tests/auto-imports.test.ts Outdated
Comment thread packages/wxt/src/builtin-modules/unimport.ts Outdated
Comment thread packages/wxt/src/types.ts Outdated
Comment thread packages/wxt/src/types.ts Outdated
Comment thread packages/wxt/src/types.ts Outdated
Comment thread packages/wxt/src/types.ts Outdated
Comment thread packages/wxt/src/types.ts Outdated
Comment thread packages/wxt/src/types.ts Outdated
@aklinker1

Copy link
Copy Markdown
Member

OK, so after cleaning some things up, I'm not sure this PR is meaningful.

All we're doing is renaming 8 | 9 to 'old' | 'flat' - but what if a new config file version is released in the future? What would we call it in v11? I would call it 'flat11'... or just 11 because people don't need to know what the type of config file is called, just a compatible version. And then we're back to the numbers.

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 -

if (version <= 8) return getEslint8ConfigEntry(options, globals);
else return getEslint9ConfigEntry(options, globals);

So I would push to:

  1. Revert the changes to string names, keep using the version numbers to represent the config file version compatibility
  2. Update the JSDoc for the version numbers to include the format name
  3. Maybe add a type called EslintConfigFileVersions = 8 | 9 so it's clear in the code we're not talking about the version of eslint, but the config file format.
  4. Keep the deprecation of "auto", that's valid.
  5. Keep the change for the default value to true.

@aklinker1 aklinker1 changed the title feat: Add eslint 10 support for unimport of wxt chore: Cleanup imports.eslint.enabled config Jul 31, 2026
@aklinker1
aklinker1 disabled auto-merge July 31, 2026 19:25

@aklinker1 aklinker1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

@PatrykKuniczak

Copy link
Copy Markdown
Collaborator Author

@aklinker1 I think that's not bad, but 9 for version 10, 11 and etc. isn't meaningful.
That's why i've used old and flat.

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 flat to old and drop current old(<=8 for then) and add support for newest versions.

But maybe, OK let's leave only booleans and numbers there it'll be the most meaningful.

Copilot AI review requested due to automatic review settings August 1, 2026 08:04
@PatrykKuniczak

Copy link
Copy Markdown
Collaborator Author

@aklinker1 Seems, you've broken tests.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 EslintConfigVersion and uses it across config types and ESLint config generation.
  • Updates config resolution to default imports.eslintrc.enabled to true and 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.enabled is documented as "the major version of ESLint installed", but the type is false | EslintConfigVersion (currently 8 | 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.

Comment thread packages/wxt/src/types.ts
Comment thread packages/wxt/src/core/resolve-config.ts
Comment thread packages/wxt/src/types.ts
Comment thread packages/wxt/e2e/tests/auto-imports.test.ts
@PatrykKuniczak PatrykKuniczak changed the title chore: Cleanup imports.eslint.enabled config feat: Change behaviour of eslint config Aug 1, 2026
@PatrykKuniczak

Copy link
Copy Markdown
Collaborator Author

@aklinker1 I've changed title and generate new description, i hope now it's more meaningful, previously it was bad indeed.

@PatrykKuniczak

Copy link
Copy Markdown
Collaborator Author

@aklinker1
image

Without break, true will go each time auto will be used, but i think it's expected, yeah?

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@aklinker1

Copy link
Copy Markdown
Member

Without break, true will go each time auto will be used, but i think it's expected, yeah?

Correct, since they're equivalent.

@PatrykKuniczak
PatrykKuniczak merged commit 1153189 into wxt-dev:main Aug 1, 2026
18 checks passed
@PatrykKuniczak
PatrykKuniczak deleted the feat/add-eslint-10-unimport-support branch August 1, 2026 18:22
@PatrykKuniczak

Copy link
Copy Markdown
Collaborator Author

@aklinker1 All right, thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg/wxt Includes changes to the `packages/wxt` directory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants