Skip to content

fix(sv): align eslint version to 10 accross all addons#1069

Merged
jycouet merged 11 commits into
sveltejs:mainfrom
jonasgeiler:fix-supported-eslint
Apr 28, 2026
Merged

fix(sv): align eslint version to 10 accross all addons#1069
jycouet merged 11 commits into
sveltejs:mainfrom
jonasgeiler:fix-supported-eslint

Conversation

@jonasgeiler
Copy link
Copy Markdown
Contributor

Firstly, I apologize for not creating an issue before making this PR, I hope that's okay.
If you want I can still create and link an issue, instead of describing the problem in this PR.

Description

I have noticed that while creating a new project using the sv create command, and first selecting the eslint add-on, and afterwards selecting the prettier add-on (or just using the command pnpm dlx sv@0.15.1 create --template library --no-types --add eslint prettier --install pnpm example-project) that it always shows the following warning message:

An older major version of eslint was detected. Skipping eslint-config-prettier installation.

I thought that didn't make any sense, since I was creating a fresh new project, so I dug deeper and saw that the SUPPORTED_ESLINT_VERSION constant in the prettier.ts add-on definition had an outdated ESLint major version '9', which caused a version mismatch when installing it after the ESLint add-on.
Installing the Prettier add-on first didn't cause this problem, since the add-on script doesn't detect eslint yet and skips installing eslint-config-prettier, handing it over to the ESLint add-on, which happily installs eslint-config-prettier without checking it's own version.

I guess the problem was introduced in #989, where they bumped ESLint to v10, but forgot to update the (somewhat hidden) SUPPORTED_ESLINT_VERSION constant.

Now I could have just set the SUPPORTED_ESLINT_VERSION constant to '10' and call it a day, but I thought I'd rather future-proof this, so it doesn't happen again in the future.
For this, I have create a common ESLINT_VERSION constant (which I made sure also gets updated automatically by pnpm run update-deps), shared between the ESLint and Prettier add-ons.
The ESLint add-on just installs the version defined by that constant, but the Prettier add-on extracts the major version from that constant, and uses it in place of the previously hard-coded value.
I have also heavily modified the Prettier add-on tests, to make sure eslint-config-prettier gets installed, depending on the installed eslint version.

Checklist

  • Update snapshots (if applicable)
  • Add a changeset (if applicable)
  • Allow maintainers to edit this PR
  • I care about what I'm doing, no matter the tool I use (Notepad, Sublime, VSCode, AI...)

    Note: I have used GitHub Copilot's auto-complete feature for this contribution, however, no AI Agents where used. Most of the changes were written and double checked by myself, to the best of my knowledge.

Signed-off-by: Jonas Geiler <git@jonasgeiler.com>
… with common variable

Signed-off-by: Jonas Geiler <git@jonasgeiler.com>
…rough a special comment

Signed-off-by: Jonas Geiler <git@jonasgeiler.com>
Signed-off-by: Jonas Geiler <git@jonasgeiler.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 28, 2026

🦋 Changeset detected

Latest commit: f1be18a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@sveltejs/sv-utils Patch
sv Minor

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

Signed-off-by: Jonas Geiler <git@jonasgeiler.com>
@jonasgeiler jonasgeiler force-pushed the fix-supported-eslint branch from b45d02e to ad46d98 Compare April 28, 2026 03:07
@jonasgeiler jonasgeiler mentioned this pull request Apr 28, 2026
4 tasks
Copy link
Copy Markdown
Contributor

@jycouet jycouet left a comment

Choose a reason for hiding this comment

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

Thank you for your PR and looking at it.
Very well explained 👍

I let you have a look at the comments? Then will test it out

Comment thread packages/sv/src/core/common.ts Outdated
Comment thread packages/sv/src/core/tests/common.ts Outdated
Comment thread packages/sv/src/addons/prettier.ts Outdated
Comment thread packages/sv/src/addons/prettier.ts Outdated
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 28, 2026

Open in StackBlitz

npx https://pkg.pr.new/svelte-migrate@1069
npx https://pkg.pr.new/sv@1069
npx https://pkg.pr.new/@sveltejs/sv-utils@1069

commit: f1be18a

Comment thread packages/sv/src/addons/prettier.ts
Copy link
Copy Markdown
Contributor Author

@jonasgeiler jonasgeiler left a comment

Choose a reason for hiding this comment

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

@jycouet Looking much better now! Nice work :)

@jycouet
Copy link
Copy Markdown
Contributor

jycouet commented Apr 28, 2026

Thank you, you! :)

@jycouet jycouet changed the title fix(sv): replace hard-coded outdated eslint version "9" in prettier addon with common variable, bumping supported eslint version to v10 fix(sv): align eslint version to 10 accross all addons Apr 28, 2026
@jycouet jycouet merged commit d753ce6 into sveltejs:main Apr 28, 2026
8 checks passed
@github-actions github-actions Bot mentioned this pull request Apr 28, 2026
@jonasgeiler jonasgeiler deleted the fix-supported-eslint branch April 28, 2026 20:24
@hyunbinseo
Copy link
Copy Markdown
Contributor

So eslint-config-prettier being removed in sv@0.13.0 was actually a bug?

@jycouet
Copy link
Copy Markdown
Contributor

jycouet commented Apr 30, 2026

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.

3 participants