fix(sv): align eslint version to 10 accross all addons#1069
Conversation
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 detectedLatest commit: f1be18a The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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>
b45d02e to
ad46d98
Compare
jycouet
left a comment
There was a problem hiding this comment.
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
commit: |
There was a problem hiding this comment.
@jycouet Looking much better now! Nice work :)
|
Thank you, you! :) |
10 accross all addons
|
So |
|
Probably due to this missing But it's here now: https://github.com/sveltejs/cli/blob/main/packages/sv/src/cli/tests/snapshots/create-with-all-addons/package.json#L42 |
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 createcommand, and first selecting theeslintadd-on, and afterwards selecting theprettieradd-on (or just using the commandpnpm 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: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_VERSIONconstant in theprettier.tsadd-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
eslintyet and skips installingeslint-config-prettier, handing it over to the ESLint add-on, which happily installseslint-config-prettierwithout 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_VERSIONconstant.Now I could have just set the
SUPPORTED_ESLINT_VERSIONconstant 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_VERSIONconstant (which I made sure also gets updated automatically bypnpm 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-prettiergets installed, depending on the installedeslintversion.Checklist