Skip to content

error TS2307: Cannot find module 'node_modules/@eslint/core/dist/cjs/types.d.cts' or its corresponding type declarations #508

@andersk

Description

@andersk

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.

What version of ESLint are you using?

9.38.0

What version of eslint-plugin-astro are you using?

1.4.0

What did you do?

tsconfig.json

{
  "compilerOptions": {
    "allowJs": true,
    "module": "nodenext",
    "noEmit": true
  }
}

eslint.config.mjs

// @ts-check
import { defineConfig } from "eslint/config";
import astro from "eslint-plugin-astro";

export default defineConfig(astro.configs.recommended);

What did you expect to happen?

No error.

What actually happened?

$ npm i eslint eslint-plugin-astro typescript
$ npx tsc
node_modules/eslint-plugin-astro/lib/index.d.mts:1:65 - error TS2307: Cannot find module 'node_modules/@eslint/core/dist/cjs/types.d.cts' or its corresponding type declarations.

1 import * as node_modules__eslint_core_dist_cjs_types_d_cts from 'node_modules/@eslint/core/dist/cjs/types.d.cts';
                                                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 1 error in node_modules/eslint-plugin-astro/lib/index.d.mts:1

Link to Minimal Reproducible Example

https://gist.github.com/andersk/6198afe11e0079b744f5f9e9eb4d55d2

Additional comments

node_modules/@eslint/core/dist/cjs/types.d.cts exists, but it cannot be referenced directly because node_modules/@eslint/core/package.json has an exports field as of @eslint/core ≥ 0.4.0. It needs to be referenced via simply import … from '@eslint/core' rather than import … from 'node_modules/@eslint/core/dist/cjs/types.d.cts'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions