Skip to content

Parsing error: Unexpected token and disallow props other than data or errors in v3.0.0-next.17 #1050

New issue

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

Closed
2 tasks done
mato-a opened this issue Feb 3, 2025 · 2 comments
Closed
2 tasks done

Comments

@mato-a
Copy link

mato-a commented Feb 3, 2025

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?

9.18.0

What version of eslint-plugin-svelte are you using?

3.0.0-next.17

What did you do?

Configuration

generate new project using sv

$ deno -A npm:sv create test
┌  Welcome to the Svelte CLI! (v0.6.16)
│
◇  Which template would you like?
│  SvelteKit minimal
│
◇  Add type checking with Typescript?
│  Yes, using Typescript syntax
│
◆  Project created
│
◇  What would you like to add to your project? (use arrow keys / space bar)
│  prettier, eslint, vitest, playwright, tailwindcss, sveltekit-adapter, mdsvex
│
◇  tailwindcss: Which plugins would you like to add?
│  none
│
◇  sveltekit-adapter: Which SvelteKit adapter would you like to use?
│  node
│
◇  Which package manager do you want to install dependencies with?
│  deno
│
◆  Successfully setup add-ons
│
◆  Successfully installed dependencies
│
◇  Successfully formatted modified files
│
◇  Project next steps ─────────────────────────────────────────────────────╮
│                                                                          │
│  1: cd test                                                              │
│  2: git init && git add -A && git commit -m "Initial commit" (optional)  │
│  3: deno task dev --open                                                 │
│                                                                          │
│  To close the dev server, hit Ctrl-C                                     │
│                                                                          │
│  Stuck? Visit us at https://svelte.dev/chat                              │
│                                                                          │
├──────────────────────────────────────────────────────────────────────────╯
│
└  You're all set!
update to "eslint-plugin-svelte": "^3.0.0-next.17",

and add class T with static readonly member
class T {
	static readonly f = 'test';
}

What did you expect to happen?

no parsing errors, no errors when running deno task lint

What actually happened?

$ deno task lint
Task lint prettier --check . && eslint .
Checking formatting...
All matched files use Prettier code style!

/home/mato/test/src/lib/t.svelte.ts
2:18 error Parsing error: Unexpected token f

/home/mato/test/src/routes/+layout.svelte
3:8 error disallow props other than data or errors in SvelteKit page components svelte/valid-prop-names-in-kit-pages

✖ 2 problems (2 errors, 0 warnings)

Link to GitHub Repo with Minimal Reproducible Example

https://github.com/mato-a/test

Additional comments

I am using 3.0.0-next.17 because of this issue - #968

since I use svelte:boundary in my app I have to use 3.0.0-next.5 or higher

@ota-meshi
Copy link
Member

Thanks for posting this issue.

You need to configure it like this:

	{
-		files: ['**/*.svelte'],
+		files: ['**/*.svelte', "**/*.svelte.ts"],

		languageOptions: {
			parserOptions: {
				parser: ts.parser
			}
		}
	},

https://github.com/sveltejs/svelte-eslint-parser?tab=readme-ov-file#runes-support

@mato-a
Copy link
Author

mato-a commented Feb 3, 2025

Thanks, it worked. 👍
The second error was fixed by upgrading to v3.0.0-next.18.

@mato-a mato-a closed this as completed Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants