Skip to content

Conversation

baseballyama
Copy link
Member

close: #1242

Copy link

changeset-bot bot commented Sep 23, 2025

🦋 Changeset detected

Latest commit: e6122d9

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

This PR includes changesets to release 1 package
Name Type
eslint-plugin-svelte Patch

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

@baseballyama baseballyama force-pushed the chore/svelte-config branch 2 times, most recently from ef91ca5 to e370871 Compare September 23, 2025 02:18
Copy link
Contributor

github-actions bot commented Sep 23, 2025

Try the Instant Preview in Online Playground

ESLint Online Playground

Install the Instant Preview to Your Local

npm i https://pkg.pr.new/eslint-plugin-svelte@e6122d9

Published Instant Preview Packages:

View Commit

} {
try {
const result = compiler.compile(code, {
...context.sourceCode.parserServices.svelteParseContext?.svelteConfig?.compilerOptions,
Copy link
Member

Choose a reason for hiding this comment

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

To avoid unintended behavior, can you please pass only the necessary options?

Since generate: false is different from the compiler used by the user, I think it is highly likely that the user's defined compilerOptions cannot be used as is.

Copy link
Member Author

Choose a reason for hiding this comment

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

Could you explain this in a bit more detail?
If generate: false is specified, the Svelte compiler just skips the transform phase, so I don’t think it would be a problem to overwrite the user’s settings for generate. Also, options that are only used in the transform phase would simply go unused, so I don’t think they would have any side effects.

https://github.com/sveltejs/svelte/blob/main/packages/svelte/src/compiler/phases/3-transform/index.js#L20-L30

Copy link
Member

Choose a reason for hiding this comment

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

Compiler options have many properties, and I don't think we understand how they affect linting. Also, I don't think users set compiler options with linting in mind.
Therefore, I think it's better to avoid passing them directly.
I think it's better to pass only the necessary properties that we understand.
https://svelte.dev/docs/svelte/svelte-compiler#CompileOptions
https://svelte.dev/docs/svelte/svelte-compiler#ModuleCompileOptions

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think we understand how they affect linting

I believe I understand your concern. I have no objection to making the fix.
However, in this particular case, do we really need to worry about the affect? Wouldn’t it be fine to simply compile exactly as the user specified and then display whatever warnings are generated to the user? If something strange happens, wouldn’t that just mean the user’s configuration was wrong?

Copy link
Member

Choose a reason for hiding this comment

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

The reason I'm concerned may be because I don't know the internals of the compiler, so I don't have the information to not worry 😓

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.

Rule valid-compile doesn't report when runes: true
2 participants