8000 New Rule: ban unsafe declaration merging · Issue #5275 · typescript-eslint/typescript-eslint · GitHub
[go: up one dir, main page]

Skip to content
New Rule: ban unsafe declaration merging #5275
Closed
@bradzacher

Description

@bradzacher

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

My proposal is suitable for this project

  • My proposal specifically checks TypeScript syntax, or it proposes a check that requires type information to be accurate.
  • My proposal is not a "formatting rule"; meaning it does not just enforce how code is formatted (whitespace, brace placement, etc).
  • I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).

Description

I've seen people doing the interface into class declaration merging pattern a few times (like in #5273) and I don't think people understand how unsafe it can be.

I propose a lint rule which detects instances of unsafe declaration merging and warns against it.

Fail Cases

interface Foo {}
class Foo {}

Pass Cases

interface Foo {}
class Bar implements Foo {}

namespace Foo2 {}
namespace Foo2 {}
enum Foo2 {}

namespace Foo3 {}
function Foo3() {}

Additional Info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issueenhancement: new plugin ruleNew rule request for eslint-pluginpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0