Skip to content

Bug: Missing src/util import in @typescript-eslint/eslint-plugin@rc-v8 with skipLibCheck: false #9164

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
JoshuaKGoldberg opened this issue May 28, 2024 · 2 comments
Assignees
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Milestone

Comments

@JoshuaKGoldberg
Copy link
Member

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.

Issue Description

When skipLibCheck isn't enabled, we produce a type error for users because rules.d.ts imports from src/util.

> tsc

node_modules/@typescript-eslint/eslint-plugin/rules.d.ts:40:63 - error TS2307: Cannot find module './src/util' or its corresponding type declarations.

40 import type { ESLintPluginDocs, ESLintPluginRuleModule } from './src/util';
                                                                 ~~~~~~~~~~~~


Found 1 error in node_modules/@typescript-eslint/eslint-plugin/rules.d.ts:40

Note that you need to have the @typescript-eslint/eslint-plugin package imported from (directly or transitively) in your code, so TypeScript knows to type check it. This tripped me up a bit at first. 😄

Reproduction Repository Link

https://github.com/JoshuaKGoldberg/repros/tree/ts-eslint-plugin-src-util-path

Repro Steps

  1. clone the repo
  2. npm i
  3. npm run tsc

Versions

package version
@typescript-eslint/eslint-plugin 8.0.0-alpha.20
TypeScript 5.4.5
node 20.11.0

Originally reported by @voxpelli in Discord (https://discord.com/channels/1026804805894672454/1084238921677946992/1244642021302599691), thanks!

💖

@JoshuaKGoldberg JoshuaKGoldberg added bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin accepting prs Go ahead, send a pull request that resolves this issue labels May 28, 2024
@voxpelli
Copy link

It causes an error when skipLibCheck is set to false, but those types can not be resolved by anyone using the published package, its just that it fails silently for those with skipLibCheck: true

Relevant line:

import type { ESLintPluginDocs, ESLintPluginRuleModule } from './src/util';

Cause:

I believe that *.d.ts files are only copied, never changed, on compilation. So the ./src/util will not be rewritten to ./dist/util.

@JoshuaKGoldberg
Copy link
Member Author

#9339 was merged into v8. Thanks again @voxpelli! ✅

@github-actions github-actions bot added the locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. label Jul 7, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepting prs Go ahead, send a pull request that resolves this issue bug Something isn't working locked due to age Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing. package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

No branches or pull requests

3 participants