Closed
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
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
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>
What did you expect to happen?
I expect on:click={(e : any) => e}
on the div
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.
Parsing error: Unexpected token (eslint)
Link to Minimal Reproducible Example
Additional comments
No response
Metadata
Metadata
Assignees
Labels
No labels