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

Drop @typescript-eslint/consistent-type-definitions rule #63

Closed
fregante opened this issue Aug 1, 2022 · 4 comments
Closed

Drop @typescript-eslint/consistent-type-definitions rule #63

fregante opened this issue Aug 1, 2022 · 4 comments

Comments

@fregante
Copy link
Member

fregante commented Aug 1, 2022

Related:

This rule’s autofix breaks code like declaration merging, it's not safe nor it is particularly useful other than enforcing a specific style.

Also:

@EdJoPaTo
Copy link

EdJoPaTo commented Aug 1, 2022

Just to bring it up… how about using '@typescript-eslint/consistent-type-definitions': ['error', 'interface'] instead?

As far as I understand it should migrate interfaces written as types to interfaces? I have not tested it nor have I checked what breakage might be resulted from that.

I am quite sure writing all the interfaces as types can break a lot but most projects I know of dont use types of interface style declarations anyway.

(I am in support of dropping this rule with 'type', but I would consider thinking about 'interface' before dropping it completely)

@sindresorhus
Copy link
Member

This rule’s autofix breaks code like declaration merging, it's not safe nor it is particularly useful other than enforcing a specific style.

This is a problem with the rule itself and should be opened on https://github.com/typescript-eslint/typescript-eslint

@sindresorhus
Copy link
Member

sindresorhus commented Aug 1, 2022

Enforcing a specific style is literally one of the reasons this repo exists. Declaration merging is IMHO an anti-pattern that should be used sparingly (the best analogy for it is modifying String.prototype). Yes, it makes sense to use sometimes to fix bad types, but in general, I think type is better.

@fregante
Copy link
Member Author

fregante commented Aug 1, 2022

I'm literally this close to publishing eslint-config-like-xo-but-less-idealistic

image

@fregante fregante closed this as not planned Won't fix, can't repro, duplicate, stale Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants