Invalid ExpressionStatement
node when using a custom actions with parameters
#583
Labels
Milestone
ExpressionStatement
node when using a custom actions with parameters
#583
Before You File a Bug Report Please Confirm You Have Done The Following...
What version of ESLint are you using?
8.49.0
What version of
eslint-plugin-svelte
are you using?2.33.1
What did you do?
I encountered an interesting ESLint crash that appears to be an bad interaction between
eslint-plugin-svelte
,eslint-plugin-sonarjs
, and@typescript-eslint/parser
. Since the crash is primarily triggered by passing an argument to a Svelte action, I decided to file the issue here, though the actual cause may lie elsewhere!With the sonarjs/no-unused-collection rule enabled, if the following conditions are met, ESLint will crash:
lang="ts"
import
's a custom actionThe particular SonarJS rule above (to paraphrase) runs:
However, the following node gets passed to the rule:
Since
expression
isnull
,expression.type
crashes ESLint withTypeError: Cannot read properties of null (reading 'type')
. I do not believeexpression
is allowed to benull
, but I cannot figure out what exactly is producing this node.What did you expect to happen?
Passing an argument to an imported custom Svelte action should not cause an ESLint crash, regardless of the plugins and rules I'm using.
What actually happened?
Link to GitHub Repo with Minimal Reproducible Example
https://github.com/mcous/eslint-svelte-null-expression-repro
Additional comments
I'd be interested in narrowing this reproduction down further if it was helpful (e.g. with
svelte-eslint-parser
directly), but I'm having trouble figuring out how the Svelte parser interacts with@typescript-eslint/parser
The text was updated successfully, but these errors were encountered: