Skip to content

Apply to JavaScript files #267

Closed as not planned
Closed as not planned
@magnusriga

Description

@magnusriga

The eslint-plugin-import and eslint-import-resolver-typescript docs are quite clear that the latter is needed to support tsconfig @-rules (compilerOptions.path).

I have set it up correctly, with these:

settings: {
    "import/parsers": {
       "@typescript-eslint/parser": [".ts", ".tsx"]
    },
    "import/resolver": {
       typescript: {
         project,
       },
    }
}

Where project is resolved as such:

const project = resolve(process.cwd(), "tsconfig.json");

I know that works, it comes from turborepo's examples.

The issue is when I use JavaScript files (as opposed to TypeScript). import/no-unresolved then throws an error.

Any way to fix this? Ideally, the typescript resolver should also be applied to the JavaScript files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions