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

Deprecate no-type-alias #6036

Closed
JoshuaKGoldberg opened this issue Nov 19, 2022 · 5 comments
Closed

Deprecate no-type-alias #6036

JoshuaKGoldberg opened this issue Nov 19, 2022 · 5 comments
Labels
accepting prs Go ahead, send a pull request that resolves this issue enhancement New feature or request package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Milestone

Comments

@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commented Nov 19, 2022

Overview

There are two issues with @typescript-eslint/no-type-alias as it exists today:

Proposal: let's deprecate the rule in v6, and remove it in v7?

@JoshuaKGoldberg JoshuaKGoldberg added enhancement New feature or request package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Nov 19, 2022
@bradzacher
Copy link
Member

The big question for me to answer when considering whether a rule should be done in user-land with no-restricted-syntax or with a stand-alone rule is really "can we do more than no-restricted-syntax?"

By default no-type-alias really just acts like no-restricted-syntax - it bans all usages of a type alias.
But we do go further by providing options to granularly allow specific type aliases. Now in their most basic form most of the options could be handled with (all be it complex) selectors in no-restricted-syntax, but the in-union style options would be pretty much impossible to do with a pure selector.


In terms of intersecting with consistent-type-definitions - there's only a little bit of overlap TBH. CTD specifically only applies to object types - really it should be called consistent-object-type-definitions.

Also no-type-alias should really be thought of a rule which allowlists the types that a codebase should alias - i.e. pushing you to inline types more.


I agree that the standard it enforces is of dubious value at best. Should we remove it? It's really hard to say without more information from the community. I don't know if people actually use the rule. This is one of the hardest parts of this project - 99% of our users are silent consumers.

@JoshuaKGoldberg
Copy link
Member Author

JoshuaKGoldberg commented Nov 28, 2022

Sourcegraph can help inform this!

Looking at other long-standing rules not in preset configs:

Queries are inherently slightly inaccurate because of dynamic and multi-line values.

Given that only ~160 results show up for enabling the rule and it mostly overlaps with with no-restricted-syntax, I'm a good bit more in favor of removing it.

Aside: I kind of want to create a whole dashboard for all rules on Sourcegraph. But that's for another time 😄

@JoshuaKGoldberg JoshuaKGoldberg added accepting prs Go ahead, send a pull request that resolves this issue and removed triage Waiting for maintainers to take a look labels Nov 28, 2022
@JoshuaKGoldberg JoshuaKGoldberg changed the title Consider deprecating no-type-alias Deprecate no-type-alias Nov 28, 2022
@bradzacher
Copy link
Member

The thing to look for is eslint-config-standard-with-typescript and eslint-config-airbnb-typescript.

Double check what those configs use and how many people use them.
Most users go down the path of using configs so need to take that into account!

@JoshuaKGoldberg
Copy link
Member Author

Ah good point, thanks!

I also tested these with ESLint's --print-config locally.

@JoshuaKGoldberg
Copy link
Member Author

Fixed in #6229. It'll be available in v6. 🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 25, 2023
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 enhancement New feature or request package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

No branches or pull requests

2 participants