-
-
Notifications
You must be signed in to change notification settings - Fork 25
Closed as not planned
Description
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.44.0
What version of eslint-plugin-svelte
and svelte-eslint-parser
are you using?
- svelte-eslint-parser@0.32.1
- eslint-plugin-svelte@2.32.2
What did you do?
Example repo: https://github.com/molily/jest-test
eslint config: https://github.com/molily/jest-test/blob/main/.eslintrc.cjs
Svelte component: https://github.com/molily/jest-test/blob/main/src/HelloWorld.svelte
The component does something like:
<script>
import { isString } from "./isString.js";
</script>
<p>{isString(undefined)}</p>
isString
looks like this:
/**
* Returns whether a value is a string.
*
* @param {any} value
* @returns {value is string}
*/
export const isString = (value) =>
typeof value === 'string'
What did you expect to happen?
eslint runs without parsing error.
What actually happened?
npx eslint src/HelloWorld.svelte
returns a parse error:
Error while parsing /Users/molily/projekte/jest-test/src/isString.js
Line 5, column 19: Expected }
`parseForESLint` from parser `/Users/molily/projekte/jest-test/node_modules/svelte-eslint-parser/lib/index.js` is invalid and will just be ignored
The reason for the error is this JSDoc line (which is a TypeScript type annotation):
* @returns {value is string}
If I remove this line, the parsing error is gone.
Link to GitHub Repo with Minimal Reproducible Example
https://github.com/molily/jest-test
Additional comments
No response
Metadata
Metadata
Assignees
Labels
No labels