Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

svelte-check doesn't ignore node_modules/ when I ask it to #1100

Closed
cor opened this issue Jul 16, 2021 · 1 comment
Closed

svelte-check doesn't ignore node_modules/ when I ask it to #1100

cor opened this issue Jul 16, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@cor
Copy link
Contributor

cor commented Jul 16, 2021

My tsconfig.json is pretty much the default for a SvelteKit project, with an added exclude property:

{
	"compilerOptions": {
		"strict": true,
		"noEmitOnError": true,
		"moduleResolution": "node",
		"module": "es2020",
		"lib": ["es2020"],
		"target": "es2019",
		"importsNotUsedAsValues": "error",
		"isolatedModules": true,
		"resolveJsonModule": true,
		"sourceMap": true,
		"esModuleInterop": true,
		"skipLibCheck": true,
		"forceConsistentCasingInFileNames": true,
		"baseUrl": ".",
		"allowJs": true,
		"checkJs": true,
		"paths": {
			"$lib": ["src/lib"],
			"$lib/*": ["src/lib/*"]
		}
	},
	"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.ts", "src/**/*.svelte"],
	"exclude": ["node_modules/", ".svelte-kit/"],
}

I'm also using the --ignore flag in my package.json:

"scripts": {
    "dev": "svelte-kit dev",
    "build": "svelte-kit build",
    "preview": "svelte-kit preview",
    "check": "svelte-check --tsconfig ./tsconfig.json --ignore \".svelte-kit,node_modules\"",
    "check:watch": "svelte-check --tsconfig ./tsconfig.json --watch --ignore \".svelte-kit,node_modules\"",
    "lint": "prettier --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
    "format": "prettier --write --plugin-search-dir=. ."
},

However, when I run npm run check, I still get the following errors, which originate from node_modules/:

/Users/cor/Developer/project/node_modules/svelte-fa/src/fa.svelte:86:9
Error: This condition will always return 'false' since the types 'boolean' and 'string' have no overlap. (js)
    let flipY = 1;
    if (flip == 'horizontal') {
      flipX = -1;


/Users/cor/Developer/project/node_modules/svelte-fa/src/fa.svelte:88:16
Error: This condition will always return 'false' since the types 'boolean' and 'string' have no overlap. (js)
      flipX = -1;
    } else if (flip == 'vertical') {
      flipY = -1;


/Users/cor/Developer/project/node_modules/svelte-fa/src/fa.svelte:104:6
Error: Variable 'i' implicitly has an 'any' type. (js)

{#if i[4]}
  <svg


/Users/cor/Developer/project/node_modules/svelte-fa/src/fa.svelte:108:12
Error: Variable 's' implicitly has an 'any' type. (js)
    class={clazz}
    style={s}
    viewBox={`0 0 ${i[0]} ${i[1]}`}


/Users/cor/Developer/project/node_modules/svelte-fa/src/fa.svelte:109:21
Error: Variable 'i' implicitly has an 'any' type. (js)
    style={s}
    viewBox={`0 0 ${i[0]} ${i[1]}`}
    aria-hidden="true"


/Users/cor/Developer/project/node_modules/svelte-fa/src/fa.svelte:109:29
Error: Variable 'i' implicitly has an 'any' type. (js)
    style={s}
    viewBox={`0 0 ${i[0]} ${i[1]}`}
    aria-hidden="true"


... and many more

They are coming from fa.svelte (svelte-fa), which I'm importing like this:

import Fa from 'svelte-fa/src/fa.svelte';

Why is this happening?

@dummdidumm
Copy link
Member

Duplicate of #1056 and #1074 . Basically, we need to adjust some behavior there to not type-check node_module files.

@dummdidumm dummdidumm added the bug Something isn't working label Jul 16, 2021
dummdidumm pushed a commit to dummdidumm/language-tools that referenced this issue Jul 17, 2021
node_modules are considered read-only and unchangeable, so they should not be diagnosed. Make an exception for src/node_modules as this is a Sapper convention
sveltejs#1056, sveltejs#1100
dummdidumm added a commit that referenced this issue Jul 17, 2021
node_modules are considered read-only and unchangeable, so they should not be diagnosed. Make an exception for src/node_modules as this is a Sapper convention
#1056, #1100

Co-authored-by: cor <cor@pruijs.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants