Skip to content

Enhancement: Add defaults for TSESLint.RuleContext type parameters #8147

Closed as not planned
@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

Right now, RuleContext doesn't provide defaults for its type parameters:

interface RuleContext<
TMessageIds extends string,
TOptions extends readonly unknown[],
> {

That means if you want to describe any arbitrary rule context the way e.g. #8146 does, you have to explicitly type out RuleContext<string, unknown[]>. It's a little inconvenient.

Proposal: let's add defaults to make referring to an "unknown" rule context a little easier?

interface RuleContext<
  TMessageIds extends string = string,
  TOptions extends readonly unknown[] = unknown[],
> {

Additional Info

#8148 is a draft PR showing the changes internally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesttriageWaiting for team members to take a look

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions