Skip to content

<svelte:element {any props}> not being parsed correctly #437

Closed
sveltejs/svelte-eslint-parser
#316
@JaKXz

Description

@JaKXz

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.38.0

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

2.26.0

What did you do?

I have <svelte:element this="script" /> in my App.svelte and this seems to cause the eslint plugin to fail. If you comment out this line there are no errors. https://github.com/JaKXz/eslint-svelte-repro/blob/461a388de934850df39d7d13b73c4aa2cb3b3b30/src/App.svelte#L32-L33

Minimal .eslintrc.cjs:

module.exports = {
  root: true,
  extends: ["eslint:recommended", "plugin:svelte/recommended"],
  parserOptions: {
    sourceType: "module",
    ecmaVersion: "latest",
  },
  env: {
    browser: true,
  },
};

What did you expect to happen?

eslint should pass without issues in the minimal repro repo.

What actually happened?

> eslint-svelte-repro@0.0.0 lint /Users/jasonkurian/src/github.com/jakxz/eslint-svelte-repro
> eslint .


/Users/jasonkurian/src/github.com/jakxz/eslint-svelte-repro/src/App.svelte
  0:0  error  Parsing error: Cannot use 'in' operator to search for 'range' in script

Link to GitHub Repo with Minimal Reproducible Example

https://github.com/JaKXz/eslint-svelte-repro

Additional comments

No response

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