Skip to content

Bug: Could not find a declaration file for module 'utils' #7762

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
4 tasks done
LeeMoonki opened this issue Oct 19, 2023 · 2 comments
Closed
4 tasks done

Bug: Could not find a declaration file for module 'utils' #7762

LeeMoonki opened this issue Oct 19, 2023 · 2 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@LeeMoonki
Copy link

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.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Relevant Package

utils

Playground Link

No response

Repro Code

import { ESLintUtils, TSESTree } from '@typescript-eslint/utils';

ESLint Config

No response

tsconfig

{
  "compilerOptions": {
    "target": "es2017",
    "module": "commonjs",
    "outDir": "lib",
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "strict": true,
    "strictNullChecks": true,
    "skipLibCheck": true
  },
  "include": ["src", "index.ts"],
  "watchOptions": {
    "excludeDirectories": ["**/node_modules", "lib", "tests", "tests-etc"]
  }
}

Expected Result

I can use the module of @typescript-eslint/utils.

Actual Result

The following error occurs.

Cannot find module @typescript-eslint/utils or its corresponding type declarations

Additional Info

When I use @typescript-eslint/utils, the error

Cannot find module @typescript-eslint/utils or its corresponding type declarations

occurred.

The project structure is

.
├── packages/
│   └── eslint-plugin-foo/
│       ├── node_modules/
│       │   └── @typescript-eslint/
│       │       └── utils
│       ├── src/
│       │   └── rules/
│       │       └── some-rule.ts
│       └── tsconfig.json
└── tsconfig.json

When I use the package like,

import { ESLintUtils, TSESTree } from '@typescript-eslint/utils/dist';
...

the error disappear. But when I run a test for it, the following error shown

Package subpath './dist' is not defined by "exports" in somepath/packages/eslint-plugin-foo/node_modules/@typescript-eslint/utils/package.json

Versions

package version
@typescript-eslint/utils 6.8.0
@LeeMoonki LeeMoonki added bug Something isn't working triage Waiting for team members to take a look labels Oct 19, 2023
@LeeMoonki
Copy link
Author

LeeMoonki commented Oct 19, 2023

When I add main field of the package utils's package.json like,

{
  "name": "@typescript-eslint/utils",
  "version": "6.8.0",
  "description": "Utilities for working with TypeScript + ESLint together",
  "main": "dist/index.js",
  ...
}

the error disappear.

@bradzacher
Copy link
Member

Duplicate of #7284

@bradzacher bradzacher closed this as not planned Won't fix, can't repro, duplicate, stale Oct 19, 2023
@bradzacher bradzacher added duplicate This issue or pull request already exists and removed triage Waiting for team members to take a look labels Oct 19, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants