Skip to content

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

@cor

Description

@cor

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions