sveltejs / eslint-plugin-svelte3

An ESLint plugin for Svelte v3 components.
MIT License
374 stars 43 forks source link

Eslint parse token error with class properties #179

Open Nukiloco opened 2 years ago

Nukiloco commented 2 years ago

Reproduction code:

class Apple {
         v ---> this will cause vscode to say ``Unexpected tokeneslint(ParseError)``
    seeds: number
}

Configuration file:

module.exports = {
    parser: '@typescript-eslint/parser', // add the TypeScript parser
    plugins: [
        'svelte3',
        '@typescript-eslint', // add the TypeScript plugin
    ],
    overrides: [ // this stays the same
        {
            files: ['*.svelte'],
            processor: 'svelte3/svelte3'
        },
    ],
    rules: {
        'indent': [
            'error',
            'tab',
            {'SwitchCase': 1}
        ],
        'linebreak-style': [
            'error',
            'windows'
        ],
        'quotes': [
            'error',
            'single'
        ],
        'semi': [
            'error',
            'never'
        ],
        'yoda': [
            'error',
            'never'
        ],
    },
    settings: {
        'svelte3/typescript': () => require('typescript'), // pass the TypeScript package to the Svelte plugin
    }
}
dummdidumm commented 2 years ago

Please post the whole code snippet including the <script> tag, the given snippet isn't valid if copied as is into a Svelte file

Nukiloco commented 2 years ago
<script lang="ts">
    class Apple {
        seeds: number
    }
</script>

This is the minimal reproduction that causes the eslint error.

nsmaciej commented 1 year ago

This is still an issue. Has anyone found a workaround?