Skip to content

Eslint parse token error with class properties #179

Open

Description

@Nukiloco

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
	}
}

Activity

  1. dummdidumm commented on Apr 14, 2022

    @dummdidumm
    Member

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

  2. Nukiloco commented on Apr 14, 2022

    @Nukiloco
    Author
    <script lang="ts">
    	class Apple {
    		seeds: number
    	}
    </script>
    

    This is the minimal reproduction that causes the eslint error.

  3. nsmaciej commented on Feb 13, 2023

    @nsmaciej

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions