Skip to content

Change Request: internal rule.meta.docs.recommended type is leaked #234

@kirkwaiblinger

Description

@kirkwaiblinger

Which packages would you like to change?

  • @eslint/compat
  • @eslint/config-array
  • @eslint/config-helpers
  • @eslint/core
  • @eslint/mcp
  • @eslint/migrate-config
  • @eslint/object-schema
  • @eslint/plugin-kit

What problem do you want to solve?

According to the docs, there is no reason to think plugins are obligated to provide a simple boolean to rule.meta.docs.recommended; the docs simply indicate that a boolean is used internally by eslint. However, this is encoded into the type system here:

/**
* Indicates if the rule is generally recommended for all users.
*/
recommended?: boolean | undefined;

typescript-eslint uses this field differently (see typescript-eslint/typescript-eslint#10899 (comment)), which causes a type-level incompatibility with defineConfig(), even though there is no runtime problem.

What do you think is the correct solution?

One of the following

  • Omit this field from the types entirely
  • Put the type as unknown (and, optionally add a jsdoc note that eslint internally will always use a boolean)
  • Provide some union type that similarly has the effect of allowing recommended to be any type when used with defineConfig().

Participation

  • I am willing to submit a pull request for this change.

Additional comments

This is a blocker for typescript-eslint/typescript-eslint#10899.

Metadata

Metadata

Labels

Type

No type

Projects

Status

Implementing

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions