Skip to content

Change Request: Export WithExit helper type from @eslint/core #318

@jaymarvelz

Description

@jaymarvelz

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?

All ESLint languages — JavaScript, JSON, CSS, and Markdown — require handling both entry and exit visitors for AST nodes. Currently we have to reimplement a helper type like this in each language:

type WithExit<RuleVisitorType extends RuleVisitor> = {
  [Key in keyof RuleVisitorType as
    | Key
    | `${Key & string}:exit`]: RuleVisitorType[Key];
};

What do you think is the correct solution?

It would be useful for @eslint/core to export a WithExit helper type. This should eliminate repeated boilerplate across languages.

Participation

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

Additional comments

No response

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

Status

Feedback Needed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions