Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Enhancement: Consider making custom rule 'recommended' field generic #6467

Closed as not planned
Labels
accepting prsGo ahead, send a pull request that resolves this issueenhancementNew feature or requestlocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: utilsIssues related to the @typescript-eslint/utils package
@JoshuaKGoldberg

Description

@JoshuaKGoldberg

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

OurESLintUtils.RuleCreator function's parameter includes arecommended property. Relative to#5251:

  • Previously, that wasrecommended: '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 therecommended 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 thatshould have arecommended 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 inhttps://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. 😉

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issueenhancementNew feature or requestlocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: utilsIssues related to the @typescript-eslint/utils package

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp