Skip to content

Enabling typescript-eslint type-checked rules causes files which use svelte-modals to have spurious lint errors. #39

Open
@bmcbarron

Description

@bmcbarron

Describe the bug
When I migrated from svelte 4 to 5, I began to get eslint errors always involving any or "error typed value". After a lot of debugging, I discovered that this issues were limited to files that imported from 'svelte-modals'. I tried to understand why this was the case, but couldn't make progress.

Reproduction

  1. Create a svelte project with eslint enabled using npx sv.
  2. Utilize svelte-modals (svelte 5 api, not legacy).
  3. Enable type-checked linting. The modified eslint.config.js will look similar to excerpt below.
  4. Open .svelte or .ts files that import and utilize svelte-modals apis. There will be spurious eslint errors, but the code still works and typescript intellisense still understands the types.
import prettier from 'eslint-config-prettier';
import js from '@eslint/js';
import svelte from 'eslint-plugin-svelte';
import globals from 'globals';
import ts from 'typescript-eslint';

export default ts.config(
	js.configs.recommended,
	...ts.configs.recommendedTypeChecked,
	...svelte.configs['flat/recommended'],
	prettier,
	...svelte.configs['flat/prettier'],
	{
		languageOptions: {
			globals: {
				...globals.browser,
				...globals.node
			},
			parserOptions: {
				projectService: true,
				tsconfigRootDir: import.meta.dirname,
				extraFileExtensions: ['.svelte'],
			},
		}
	},
	{
		files: ['**/*.svelte'],

		languageOptions: {
			parserOptions: {
				parser: ts.parser
			}
		}
	},
	{
		ignores: ['build/', '.svelte-kit/', 'dist/']
	}
);

Additional context
Note that my repository is a monorepo, but based on my analysis it does not seem related to this issue.

Awesome tool btw! I've been using it for more than a year.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions