Skip to content

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

Open
@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 ESLintneeds designImportant details about this change need to be discussed

Type

No type

Projects

Status

RFC Opened

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