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: Consider making custom rule 'recommended' field generic #6467

Closed
4 tasks done
JoshuaKGoldberg opened this issue Feb 14, 2023 · 1 comment
Closed
4 tasks done
Labels
accepting prs Go ahead, send a pull request that resolves this issue enhancement New feature or request package: utils Issues related to the @typescript-eslint/utils package

Comments

@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commented Feb 14, 2023

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

Relevant Package

utils

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).

Description

Our ESLintUtils.RuleCreator function's parameter includes a recommended property. Relative to #5251:

  • Previously, that was recommended: 'error' | 'strict' | 'warn' | false property.
  • In that PR it became optional, recommended?: 'recommended' | 'strict' | 'stylistic'.

Having it optional is nicer for users because they don't have to provide one. Many users writing custom rules don't care about the recommended property. They might be writing one-of rules for a single repo, or for configs that they always configure in roughly the same way(s). No need for a recommendation.

But for users who are writing very reusable rules that should have a recommended property, they're still locked into using our 'recommended' | 'strict' | 'stylistic' type. Which might not correspond to how they organize their rule recommendations.

@bradzacher suggested in https://github.com/typescript-eslint/typescript-eslint/pull/5251/files#r1103977719:

Do we want to make this a generic and just make it default to the old value?
In our createRule function we can overwrite it with our own type so we only do this locally.

I like that strategy!

Additional Info

I don't 100% have a code example to suggest here. A bit of investigation required. 😉

@JoshuaKGoldberg JoshuaKGoldberg added enhancement New feature or request package: utils Issues related to the @typescript-eslint/utils package accepting prs Go ahead, send a pull request that resolves this issue labels Feb 14, 2023
@JoshuaKGoldberg
Copy link
Member Author

This ended up being a subset of #8695, which was fixed by #9025 in the v8 branch. ✅

@JoshuaKGoldberg JoshuaKGoldberg closed this as not planned Won't fix, can't repro, duplicate, stale Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepting prs Go ahead, send a pull request that resolves this issue enhancement New feature or request package: utils Issues related to the @typescript-eslint/utils package
Projects
None yet
Development

No branches or pull requests

1 participant