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

on mac, incorrect .Svelte extension is accepted. Note the capital. It should not #2613

Open
cognominal opened this issue Dec 3, 2024 · 4 comments
Labels
feature request New feature or request

Comments

@cognominal
Copy link

cognominal commented Dec 3, 2024

Describe the bug

On MacOS, when by mistake one creates a .Svelte file instead a .svelte one, the vscode svelte extension does not complain but vite will and will show the (not so) missing file path that can be nevertheless opened by cmd Enter.

This due to the fact that mac filesystem are insensitive.

Reproduction

create a .Svelte file (note the upper case), import it from another component file.

Expected behaviour

The correct behavior for the svelte extension is to report an error because vite will bail out. Also the same repo with the same .Svelte file will cause an error on an non Mac filesystem.

System Info

Darwin cogs-MacBook-Air.local 24.1.0 Darwin Kernel Version 24.1.0: Tue Sep 17 07:48:04 PDT 2024; root:xnu-11215.40.59~38/RELEASE_ARM64_T8112 arm64
1.95.0-insider
38dc6ac5a771cc94bde1344722bb2d02c80096ea
arm64

Last released
2024-11-22, 21:27:05
Last updated
2024-11-23, 06:43:00
Identifier
svelte.svelte-vscode

Which package is the issue about?

No response

Additional Information, eg. Screenshots

No response

@cognominal cognominal added the bug Something isn't working label Dec 3, 2024
@jasonlyu123
Copy link
Member

jasonlyu123 commented Dec 3, 2024

There should be an error with inconsistent file casing when forceConsistentCasingInFileNames is enabled but the config should be enabled by default. Make sure you didn't explicitly disable it. It does seem like it isn't reliably reported and might be a language server restart to make it work. We can check if it's possible to make it work more reliably.

Edit: Oh. You meant the file extension. Yes, there should also be an error with it.

@cognominal
Copy link
Author

Thx so much for your feedback.
So you are speaking of a typescript setting.
The problem persisted across "Developper: reload window" command use.

I was dabbling extending svelte.dev which I should have said in the first place. And  indeed it has this explicit setting in tsconfig.json

For me the problem is solved but it took me a while to figure out. The two tools, vite and vscode svelte extension, should have a consistent behaviour whatever the setting is.

@cognominal
Copy link
Author

Where is this nice picture of you in your github profile ?

@jasonlyu123
Copy link
Member

I think you might be using a js project without any type-check. Both of the errors mentioned above are coming from the ts type check. If you have checkJs: true or are using typescript. I am not sure we'll want to add a custom check about this because module resolution can be very complex, if we wrote a custom check for it there is a high chance it'll have some false positive. If you want to catch this and don't want to use typescript there is probably an eslint plugin that can do this.

@jasonlyu123 jasonlyu123 added feature request New feature or request and removed bug Something isn't working labels Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants