You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
9.3.0
What version of eslint-plugin-svelte and svelte-eslint-parser are you using?
// test.js/** @param {number} x */functiontest(x){returnx+1}
npx eslint src
test.js
2:10 error 'test' is defined but never used @typescript-eslint/no-unused-vars
test.svelte
3:12 error 'test' is defined but never used @typescript-eslint/no-unused-vars
4:5 error Unsafe return of an `any` typed value @typescript-eslint/no-unsafe-return
5:12 error Invalid operand for a '+' operation. Operands must each be a number or string. Got `any` @typescript-eslint/restrict-plus-operands
What did you expect to happen?
I expected the same code to produce the same warnings, irrespective of appearing in a .svelte or .js file.
What actually happened?
It seems like the typescript-eslint parser cannot parse type information from the code in the .svelte files. Maybe the svelte-parser strips JSDoc comments from the code before forwarding it to the typescript parser?
Link to GitHub Repo with Minimal Reproducible Example
Before You File a Bug Report Please Confirm You Have Done The Following...
*.svelte
file linting does not work with the parser alone. You should also use eslint-plugin-svelte with it.)What version of ESLint are you using?
9.3.0
What version of
eslint-plugin-svelte
andsvelte-eslint-parser
are you using?What did you do?
Configuration
While both .svelte and .js files are scanned by ESLint the same function yields different results:
npx eslint src
What did you expect to happen?
I expected the same code to produce the same warnings, irrespective of appearing in a .svelte or .js file.
What actually happened?
It seems like the typescript-eslint parser cannot parse type information from the code in the .svelte files. Maybe the svelte-parser strips JSDoc comments from the code before forwarding it to the typescript parser?
Link to GitHub Repo with Minimal Reproducible Example
https://github.com/falco467/svelte-jsdoc-typescript-example
Additional comments
Migrated from eslint-plugin-svelte since it is a parser problem: sveltejs/eslint-plugin-svelte#767
The text was updated successfully, but these errors were encountered: