Skip to content

Resolve import to declared module? #2068

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

Closed
pikeas opened this issue May 14, 2021 · 4 comments
Closed

Resolve import to declared module? #2068

pikeas opened this issue May 14, 2021 · 4 comments

Comments

@pikeas
Copy link

pikeas commented May 14, 2021

SvelteKit has various imports of the form:

import {foo} from "$app/bar"

Everything under $app/* is defined in node_modules/@sveltejs/kit/types/ambient-modules.d.ts:

declare module '$app/env' {
    ...
}

How can I configure eslint-plugin-import so that it resolves $app/* to these definitions? Typescript resolution works, so I'm not sure why ESLint is unable to resolve them.

Related: #1509

@sebastianrothe
Copy link

We do have the same problem.

@ljharb
Copy link
Member

ljharb commented Jan 26, 2022

If it’s configured in tsconfig, then the typescript resolver should resolve it.

If not, then you’d need some kind of svelte resolver.

@sebastianrothe
Copy link

If it’s configured in tsconfig, then the typescript resolver should resolve it.

If not, then you’d need some kind of svelte resolver.

Oh, I see. The paths are configured somewhere else.

I added these to my eslint rules for now:

rules: {
        "import/no-unresolved": [
            "error",
            {
                ignore: ["\\$app.*$", "\\$service-worker.*$"],
            },
        ],
    },

@JounQin
Copy link
Collaborator

JounQin commented Jul 19, 2022

I suppose you did not use https://github.com/import-js/eslint-import-resolver-typescript

@JounQin JounQin closed this as not planned Won't fix, can't repro, duplicate, stale Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants