Skip to content

Change Request: Allow rules to specify the languages/dialects they work on #19462

@nzakas

Description

@nzakas

ESLint version

HEAD

What problem do you want to solve?

Currently, a rule has no way to indicate if it works on any given language. This information would be helpful for two reasons:

  1. Documentation purposes - being able to see which JS rules have been updated to support TS syntax.
  2. Runtime purposes - automatically turning off rules that don't apply to the given language (for instance, turning off JS rules when linting CSS files)

What do you think is the correct solution?

In the 2025-02-20 TSC meeting, we discussed adding two properties to meta:

  1. meta.language - a string, such as "javascript", "css"
  2. meta.dialects - an array of strings, such as ["javascript", "typescript"]

@JoshuaKGoldberg suggested merging both properties into a single object instead.

It's probably worth putting together an RFC that takes into account the two use cases (documentation and runtime) as well as finalizing what the meta info should look like.

Participation

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

Additional comments

No response

Metadata

Metadata

Assignees

Labels

acceptedThere is consensus among the team that this change meets the criteria for inclusioncoreRelates to ESLint's core APIs and featuresenhancementThis change enhances an existing feature of ESLint

Type

No type

Projects

Status

Complete

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions