Skip to content

*.svelte.(ts|js) files are not checked for Svelte compiler warnings (svelte-check / language tools) #2891

@ampled

Description

@ampled

Describe the bug

I have been trying to get "Svelte for VS Code" to emit Svelte warnings for *.svelte.(ts|js)-files with no luck.

Example:

// somefile.svelte.ts
let current = $state('')

// Expecting state_referenced_locally warning here
if (current) {
	//
}

The equivalent works in a normal .svelte-file.

Compiler warnings are emitted by vite-plugin-svelte for files like these when running build, but not when running svelte-check.

I noticed this works fine in the Svelte REPL, so I figured I'd missed something simple to get this working in VS Code, but to me it seems like only .svelte-files are picked up by the extension and svelte-check.

I could not find another issue or documentation about this, so sorry if this is a duplicate.

Reproduction

  • Create new / blank VSCode profile
  • Install "Svelte for VS Code" extension
  • Enable TypeScript plugin when extension prompts for it
  • Specify project should use workspace TypeScript version (VS Code setting)
  • Initialize new SvelteKit Project (add TypeScript, ESLint, Prettier)
  • Create file with .svelte.ts extension and add sample code

Sample code in REPL: https://svelte.dev/playground/be495e6d6e6c4c19a200ccead58f2e49?version=latest

Expected behaviour

*.svelte.(js|ts)-files should be checked for compiler warnings in IDE and when running svelte-check.

System Info

  • OS: macOS 15.6.1
  • IDE: VSCode

Which package is the issue about?

Svelte for VS Code extension

Additional Information, eg. Screenshots

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions