We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
8.23.1
eslint-plugin-svelte
2.8.0
module.exports = { root: true, parser: '@typescript-eslint/parser', extends: [ 'eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:@typescript-eslint/recommended-requiring-type-checking', 'plugin:import/recommended', 'plugin:import/typescript', 'plugin:svelte/recommended', 'plugin:svelte/prettier', 'prettier' ], plugins: ['unused-imports', '@typescript-eslint', 'import'], ignorePatterns: ['*.cjs', 'svelte.config.js', 'tailwind.config.cjs', 'postcss.config.cjs'], overrides: [ { files: ['*.svelte'], parser: 'svelte-eslint-parser', parserOptions: { parser: '@typescript-eslint/parser' } } ], settings: { 'svelte3/typescript': () => require('typescript'), 'import/resolver': { typescript: {} }, 'import/parsers': { '@typescript-eslint/parser': ['.ts', '.tsx'] } }, parserOptions: { sourceType: 'module', ecmaVersion: 2020, project: ['./tsconfig.json'], extraFileExtensions: ['.svelte'] }, env: { browser: true, es2017: true, node: true }, rules: { 'no-unused-vars': 'off', '@typescript-eslint/no-unused-vars': 'off', 'unused-imports/no-unused-vars': [ 'warn', { vars: 'all', varsIgnorePattern: '^_', args: 'after-used', argsIgnorePattern: '^_' } ], 'unused-imports/no-unused-imports': 'error' } }
<script lang="ts"> // this works: const something = (e:any) => e </script> <!-- this does not --> <div on:click={(e : any) => e}>Click</div>
I expect on:click={(e : any) => e} on the div to work.
on:click={(e : any) => e}
div
eslint complains that the : would be an unexpected token. As soon as I remove the type annotations, things work great.
:
Parsing error: Unexpected token (eslint)
EXAMPLE
No response
The text was updated successfully, but these errors were encountered:
Is that valid syntax for Svelte itself?
Sorry, something went wrong.
Hm, good question. 🤔 But I just found this: sveltejs/svelte#5403 Could it be that it's not...?
Svelte's compiler does not allow TypeScript inside HTML templates. Please follow sveltejs/svelte#4701.
No branches or pull requests
Before You File a Bug Report Please Confirm You Have Done The Following...
What version of ESLint are you using?
8.23.1
What version of
eslint-plugin-svelte
are you using?2.8.0
What did you do?
Configuration
What did you expect to happen?
I expect
on:click={(e : any) => e}
on thediv
to work.What actually happened?
eslint complains that the
:
would be an unexpected token. As soon as I remove the type annotations, things work great.Link to Minimal Reproducible Example
EXAMPLE
Additional comments
No response
The text was updated successfully, but these errors were encountered: