Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: upgrade eslint in create-svelte to v9 #12089

Merged
merged 14 commits into from
Apr 11, 2024
Merged

Conversation

jrmajor
Copy link
Contributor

@jrmajor jrmajor commented Apr 7, 2024

Upgrades ESLint in create-svelte to v9 and migrates config from .eslintrc.cjs and .eslintignore to eslint.config.js.

Closes #10742.


Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Edits

  • Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

Copy link

changeset-bot bot commented Apr 7, 2024

🦋 Changeset detected

Latest commit: bb12553

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

This PR includes changesets to release 1 package
Name Type
create-svelte 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

@jrmajor
Copy link
Contributor Author

jrmajor commented Apr 7, 2024

Blocked by sveltejs/eslint-plugin-svelte#727.

}
},
{
ignores: ['build/', '.svelte-kit/', 'package/', 'vite.config.[jt]s.timestamp-*']
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what build and package directories are used for, but they were in the .eslintignore.

ESLint doesn't seem to care about .DS_Store, .env*, pnpm-lock.yaml, package-lock.json or yarn.lock, so I didn't add them.

I've also skipped node_modules, since it's ignored by default.

Copy link
Member

@eltigerchino eltigerchino Apr 8, 2024

Choose a reason for hiding this comment

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

I believe build is the output directory for adapter-static, etc. and package is the directory when packaging the lib directory with @sveltejs/package? (not sure myself)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe build is the output directory for adapter-static, etc.

I think that's correct, found this in docs: https://kit.svelte.dev/docs/adapter-static#options-pages.

package is the directory when packaging the lib directory with @sveltejs/package? (not sure myself)

I've created a new library using yarn create svelte and ran yarn run package. It created a dist directory, so package must be for something else.

Choose a reason for hiding this comment

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

I believe that's the case, yeah. And regarding some of the other files, it seems they are leftovers from the time they decided to stop using .gitignore as the ignore file for eslint and prettier.

I believe build is the output directory for adapter-static, etc. and package is the directory when packaging the lib directory with @sveltejs/package? (not sure myself)

@dominikg
Copy link
Member

dominikg commented Apr 9, 2024

@ota-meshi do we have to update the combined eslint + prettier template to add the ruleset that disables some rules to avoid prettier conflicts?

@jrmajor
Copy link
Contributor Author

jrmajor commented Apr 9, 2024

do we have to update the combined eslint + prettier template to add the ruleset that disables some rules to avoid prettier conflicts?

@dominikg I think that's what https://github.com/prettier/eslint-config-prettier is supposed to do.

@dominikg
Copy link
Member

dominikg commented Apr 9, 2024

i mean https://github.com/sveltejs/eslint-plugin-svelte?tab=readme-ov-file#new-config-eslintconfigjs

specifically eslintPluginSvelte.configs['flat/prettier'] in case a user selects both prettier and eslint in the shell dialogue started with create-svelte both prettier and eslint configs should be set up in a way that they work well together. This is achieved by the different + / - templates. the one that is for prettier+eslint might need to include this config to ensure that the two don't collide. prettier-plugin-svelte alone can't do it as it doesn't have access to eslint config

@jrmajor
Copy link
Contributor Author

jrmajor commented Apr 9, 2024

@dominikg You're right, should be fixed now. Strange that it wasn't there before, since it was introduced way back in https://github.com/sveltejs/eslint-plugin-svelte/releases/tag/v2.2.0.

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

Successfully merging this pull request may close these issues.

Migrate to eslint.config.js
5 participants