Skip to content
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

New rule: no top level import in .d.ts files #4836

Open
kaytwo opened this issue Jan 6, 2025 · 1 comment
Open

New rule: no top level import in .d.ts files #4836

kaytwo opened this issue Jan 6, 2025 · 1 comment
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Feature Status: new feature to implement

Comments

@kaytwo
Copy link

kaytwo commented Jan 6, 2025

Description

more info: https://stackoverflow.com/a/51114250/12887845

using a top level import in a .d.ts file breaks the entire file because of how TypeScript handles ambient vs. normal modules, and tsc is no help debugging it, it just loses access to the defined types.

A rule that implements "warn on top level import in filename matching /\.d\.ts$/" would suffice.

@dyc3 dyc3 added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Feature Status: new feature to implement labels Jan 6, 2025
@ematipico
Copy link
Member

Thank you @kaytwo for the issue.

I don't know if you intend to contribute by opening a PR, but if you don't, can you please provide more information for whoever wants to contribute?

For example:

  • name of the rule
  • potential group (for the future)
  • reference to other eslint rules that do the same
  • examples of code that violates the rule
  • examples of code that passes the rule
  • some text to explain the error (must adhere the rule pillars https://biomejs.dev/linter/#rule-pillars)

Failing to provide such information would make the issue stale, and we will have to close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Linter Area: linter L-JavaScript Language: JavaScript and super languages S-Feature Status: new feature to implement
Projects
None yet
Development

No branches or pull requests

3 participants