Skip to content

Repo: Rule [options] parameter should be non-nullable if defaultOptions exists #5439

@JoshuaKGoldberg

Description

@JoshuaKGoldberg

Suggestion

Right now, if a rule is created through util.createRule with defaultOptions, the create function's second parameter is an array whose first element is still Options | undefined. That means folks have to !. For example, in #5327:

create(context, [_options]) {
const options = _options!;

Unless I've grossly misinterpreted the rule options, those ! should be unnecessary, right?

Edit: here's a TypeScript playground with an isolated repro.

Metadata

Metadata

Assignees

No one assigned

    Labels

    blocked by external APIBlocked by a tool we depend on exposing an API, such as TypeScript's Type Relationship APIenhancementNew feature or requestpackage: utilsIssues related to the @typescript-eslint/utils packagerepo maintenancethings to do with maintenance of the repo, and not with code/docs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy