Skip to content

Bug: (regression) name should be optional in RuleCreator.withoutDocs #11662

@kirkwaiblinger

Description

@kirkwaiblinger

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I have searched for related issues and found none that matched my issue.
  • I have read the FAQ and my problem is not listed.

Relevant Package

utils

Playground Link

No response

Repro Code

import { RuleCreator } from "@typescript-eslint/utils/eslint-utils";

RuleCreator.withoutDocs({
  meta: {
    messages: {},
    schema: [],
    type: 'problem',
  },
  defaultOptions: [],
  create() { return {}; }
});

ESLint Config

n/a

tsconfig

n/a

Expected Result

I expect there to be no type error

Actual Result

type error because name is now required

Argument of type '{ meta: { messages: {}; schema: never[]; type: "problem"; }; defaultOptions: []; create(context: Readonly<RuleContext<never, []>>): {}; }' is not assignable to parameter of type 'Readonly<RuleWithMeta<[], never, unknown>>'.
  Property 'name' is missing in type '{ meta: { messages: {}; schema: never[]; type: "problem"; }; defaultOptions: []; create(context: Readonly<RuleContext<never, []>>): {}; }' but required in type 'Readonly<RuleWithMeta<[], never, unknown>>'.ts(2345)
RuleCreator.d.ts(12, 5): 'name' is declared here.

Additional Info

name used to be optional but was made required in #11616 (breaking)

cc @y-hsgw

Versions

package version
@typescript-eslint/utils 8.45.0

Metadata

Metadata

Labels

accepting prsGo ahead, send a pull request that resolves this issuebugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions