language-tools icon indicating copy to clipboard operation
language-tools copied to clipboard

Ignore all package paths

Open DavidArchibald opened this issue 1 year ago • 2 comments

This is based off of a real issue I faced; I was getting lints for files in node_modules, specifically in .ts files that I can't change anyways. It also doesn't show up when I run tsc on my own .ts files even if they import the same erroring .ts files and even if I use svelte2tsx to use the same built ts file.

I hope there isn't a reason I'm missing for keeping .ts files. In this code path all node_modules diagnostics are removed already: https://github.com/sveltejs/language-tools/blob/527c2adb2fc6f13674bcc73cf52b63370dc0c8db/packages/language-server/src/plugins/PluginHost.ts#L85-L97

And in tsc itself it ignores items in the commonPackageFolders: https://github.com/microsoft/TypeScript/blob/ec7ff812c1b8e4c8f34901da900f9c933b6dfe2a/src/compiler/utilities.ts#L9353-L9355

So I hope this helps rather than being the wrong fix.

DavidArchibald avatar Jul 24 '24 18:07 DavidArchibald

I don't think the correct fix. tsc does check ts files in the node_modules so the inconsistency might come from another place. Please create an issue first with a reproduction so we can check where the problem is.

jasonlyu123 avatar Jul 25 '24 01:07 jasonlyu123

I figured out that it's because it's inside an internal folder in node_modules.

See https://github.com/sveltejs/language-tools/issues/2446

DavidArchibald avatar Jul 25 '24 06:07 DavidArchibald