import-js / eslint-plugin-import

ESLint plugin with rules that help validate proper imports.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is this parsing the entire node_modules?

hugotox opened this issue · comments

Hello!

I'm using eslint on my sveltekit project, and when I added the eslint-plugin-import, I noticed some errors coming from files in node_modules, e.g.

Error while parsing /Users/hugo/Projects/stickmonkey/node_modules/@supabase/supabase-js/dist/module/index.js
Line 3, column 87: Unexpected token
`parseForESLint` from parser `/Users/hugo/Projects/stickmonkey/node_modules/svelte-eslint-parser/lib/index.js` is invalid and will just be ignored

I already have node_modules in my .eslintignore file so I'm really confused about this error.
Removing the plugin fixes the error. What I'm doing wrong?

eslintignore controls what files are linted; some of the rules in this plugin need to parse every file that's imported regardless of those eslintignore settings.

You can disable this using https://github.com/import-js/eslint-plugin-import?tab=readme-ov-file#importignore, but doing this for all of node_modules drastically decreases the value of this plugin.

I see, thank you.
So what is this error telling me? I have a misconfig for svelte parser or is this expected and non actionable?

In this specific case, it's complaining because https://unpkg.com/browse/@supabase/supabase-js@2.39.7/package.json has its "main" pointing to https://unpkg.com/browse/@supabase/supabase-js@2.39.7/dist/main/index.js, and svelte-eslint-parser seems unable to handle it. (the version number of supabase-js might be different, in which case, edit the URL and see if it makes sense).

The bug is in svelte-eslint-parser, though.