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

Appearance settings

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

Copy link
Copy link
Closed as not planned
@JoshuaKGoldberg

Description

@JoshuaKGoldberg
Issue body actions

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 requestNew feature or requesttriageWaiting for team members to take a lookWaiting 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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.