Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Enhancement: Support plugin.meta.namespace #11113

Open
@niklaswimmer

Description

@niklaswimmer

Before You File a Proposal Please Confirm You Have Done The Following...

Relevant Package

eslint-plugin

My proposal is suitable for this project

  • I believe my proposal would be useful to the broader TypeScript community (meaning it is not a niche proposal).

Description

Currently, this is an invalid ESLint configuration:

import { defineConfig } from "eslint/config";
import { plugin as ts } from "typescript-eslint";

export default defineConfig(
    {
        plugins: {
            ts,
        },
        extends: ["ts/stylistic"],
        rules: {
            "ts/array-type": "off",
        },
    },
);

This does not work as I would intuitively expect: it does not disable the @typescript-eslint/array-type rule added by the ts/stylistic config. Instead, it disables the ts/array-type rule but leaves the @typescript-eslint/array-type rule enabled.

ESLint recently added the plugin.meta.namespace property. A plugin can use this property to specify the namespace it is using for its rule definitions. As far as I understand, the defineConfig function will then replace this namespace with the user provided namespace (ts in the above example) in all rules of the extended configurations (I think one needs to reference the config via a string, not sure though).

The end result is that the above config should work as one would intuitively expect, i.e. the array-type lint is turned off completely.

Additional Info

I originally opened this as eslint/eslint#19655 as I thought the whole namespace thing is not yet implemented, but I was told that it is and it is now up to the plugins to support it. Hence this enhancement request.

If this enhancement is accepted, I should be able to make the change and send a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesttriageWaiting for team members to take a look

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions