Skip to content

Getting an error "cannot read properties of undefined reading range" #345

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
Iuriy-Budnikov opened this issue Jun 2, 2023 · 1 comment · Fixed by #354
Closed
2 tasks done

Getting an error "cannot read properties of undefined reading range" #345

Iuriy-Budnikov opened this issue Jun 2, 2023 · 1 comment · Fixed by #354

Comments

@Iuriy-Budnikov
Copy link

Iuriy-Budnikov commented Jun 2, 2023

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

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

2.30.0

What did you do?

``` module.exports = { root: true, extends: [ 'eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:svelte/recommended', 'prettier' ], parser: '@typescript-eslint/parser', plugins: ['@typescript-eslint'], parserOptions: { sourceType: 'module', ecmaVersion: 2020, extraFileExtensions: ['.svelte'] }, env: { browser: true, es2017: true, node: true }, overrides: [ { files: ['*.svelte'], parser: 'svelte-eslint-parser', parserOptions: { parser: '@typescript-eslint/parser' } } ] }; ```
Wrapper.svelte

<slot />

Item.svelte

<script lang="ts">
  import Wrapper from './Wrapper.svelte';
</script>

<Wrapper>
  {@const text = 'text'}
  <button>
    {text}
  </button>
</Wrapper>

What did you expect to happen?

It shouldn't return an error

What actually happened?

eslint .

src/routes/+page.svelte
  0:0  error  Parsing error: Cannot read properties of undefined (reading 'range')

Link to GitHub Repo with Minimal Reproducible Example

https://github.com/Iuriy-Budnikov/eslint-plugin-svelte-bug

Additional comments

It looks like it doesn't support {@const text = 'text'} inside the wrapper component with slot

@baseballyama
Copy link
Member

Thank you for reporting the issue.
I think this is parser bug, so I will transfer the issue to svelte-eslint-parser.

@baseballyama baseballyama transferred this issue from sveltejs/eslint-plugin-svelte Jun 3, 2023
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

Successfully merging a pull request may close this issue.

2 participants