Skip to content

Parsing error when using dot notation in use directive. #248

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
4 tasks done
thenbe opened this issue Nov 23, 2022 · 1 comment · Fixed by #249
Closed
4 tasks done

Parsing error when using dot notation in use directive. #248

thenbe opened this issue Nov 23, 2022 · 1 comment · Fixed by #249
Labels
bug Something isn't working

Comments

@thenbe
Copy link

thenbe commented Nov 23, 2022

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I'm using eslint-plugin-svelte. (*.svelte file linting does not work with the parser alone. You should also use eslint-plugin-svelte with it.)
  • I'm sure the problem is a parser problem. (If you are not sure, search for the issue in eslint-plugin-svelte repo and open the issue in eslint-plugin-svelte repo if there is no solution.
  • 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.28.0

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

What did you do?

Configuration
<!-- Paste your configuration here -->

Playground minimal reproduction here.

Same example in svelte REPL to show this is valid svelte syntax: link

<script>
  function myaction(n) {};

  const myobj = { myaction };
</script>

<!-- works -->
<div use:myaction />

<!-- Parsing error: Expected JS identifier.ESLint(FATAL) -->
<div use:myobj.myaction />

What did you expect to happen?

Parsed without error.

What actually happened?

Error: Parsing error: Expected JS identifier.ESLint(FATAL)

Link to GitHub Repo with Minimal Reproducible Example

https://ota-meshi.github.io/eslint-plugin-svelte/playground/#eJxVjkELgkAQhf/K5EkPm3ezwIMdwkNg0MWLraNM6KzsrlKI/721wuj2Zt7j45s8qSr0Ii/eCAFXbKXqEKwCNC2xFX07NMTCjNhaBCEOBcdGauqtSwD1wNKSYuie5Tv4HMA0F7yUUrGxrlG3O+xhWjcw7xwlXDHuqGiEwWC0TsLPf5E6l9oQN4BaKx1B+uhRWqzglANVyJZqQr1N88z5+sfkkmTBV/RHdQrbP7Y3vwCISlaj

Additional comments

Use case: HeadlessUI library

@ota-meshi
Copy link
Member

Thank you for posting issue.
I didn't know we could use member expressions for names. I will check and fix other directives as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants