import-js / import-js/eslint-plugin-import
Error when importing .svelte files in .ts files
- Dominant language
- JavaScript
- Stars
- 5.9k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I am currently trying to migrate from `eslint-plugin-svelte3` to `eslint-plugin-svelte`. Most things are working, but when I import a `.svelte` file from a `.ts` file (for example in unit tests), I get two errors from `eslint-plugin-import` (at least I think the errors comes from this plugin).
```
Error while parsing C:\pathToRepo\src\routes\Counter.svelte
Line 10, column 19: Unexpected token :
`parseForESLint` from parser `svelte-eslint-parser` is invalid and will just be ignored
```
and
```
C:\pathToRepo\svelte-eslint-import-error\src\routes\Counter.test.ts
2:21 warning Parse errors in imported module './Counter.svelte': parser.parse is not a function (undefined:undefined) import/no-named-as-default
```
I created a reproduction repo https://github.com/vekunz/svelte-eslint-import-error. Probably I still have a configuration issue somewhere, but after several hours of reading documentation and GitHub Issues, I could not find any solution to this.
Contributor guide
Research direction
Start with the linked reproduction repository and the reported import/no-named-as-default warning in Counter.test.ts when it imports Counter.svelte. Trace how the imported .svelte file is parsed and how svelte-eslint-parser is handled, then verify that linting the reproduction no longer reports the parser errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- eslint, javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100