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

Enhancement: [no-unsafe-declaration-merging] Switch to scope manager #5854

Closed
4 tasks done
JoshuaKGoldberg opened this issue Oct 20, 2022 · 1 comment · Fixed by #5865
Closed
4 tasks done

Enhancement: [no-unsafe-declaration-merging] Switch to scope manager #5854

JoshuaKGoldberg opened this issue Oct 20, 2022 · 1 comment · Fixed by #5865
Labels
accepting prs Go ahead, send a pull request that resolves this issue package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@JoshuaKGoldberg
Copy link
Member

Before You File a Proposal Please Confirm You Have Done The Following...

My proposal is suitable for this project

  • I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).

Link to the rule's documentation

https://typescript-eslint.io/rules/no-unsafe-declaration-merging/

Description

Per #5840 (comment):

We should actually be able to do this without type info and just with the scope analysis APIs.

Not using type information where possible is preferable for rules. See https://typescript-eslint.io/docs/linting/typed-linting/.

Fail

(same as before)

Pass

(same as before)

Additional Info

This rule is only in the strict config, not one of the recommended ones (yet). So it wouldn't be a breaking change to use the scope manager.

@JoshuaKGoldberg JoshuaKGoldberg added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look enhancement: plugin rule option New rule option for an existing eslint-plugin rule accepting prs Go ahead, send a pull request that resolves this issue and removed triage Waiting for maintainers to take a look enhancement: plugin rule option New rule option for an existing eslint-plugin rule labels Oct 20, 2022
@bradzacher
Copy link
Member

It's worth noting that by switching from type information we won't be able to detect these two cases:

namespace Foo {
  export interface Bar {}
}
namespace Foo {
  export class Bar {}
}
import Foo from './Foo';

namespace Foo {
  export interface Bar {}
}

I don't think that's a huge problem given that it would vastly improve the performance and usability of the rule. Those are pretty rare edge-cases as well.

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 package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
2 participants