eslint-plugin-banned-expressions

0.1.0 • Public • Published

eslint-plugin-banned-expressions

Set your regex expression to ban some undesired keyword and give a suggestion to replace

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-banned-expressions:

npm install eslint-plugin-banned-expressions --save-dev

Usage

Add banned-expressions to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
    "plugins": ["banned-expressions"]
}

Then configure the rules you want to use under the rules section.

{
    "rules": {
        "banned-expressions/banned-expressions": "error"
    }
}

You should define your banned expressions (and their suggestions) under settings section.

{
    "settings": {
        "bannedExpressions": [
            { "value": ".forEach", "exp": ".forEach((.{0,}))", "suggestion": "use .map" },
            { "value": "new Date", "exp": "new Date((.{0,}))", "suggestion": "use Temporal" },
        ],
    }
}

Package Sidebar

Install

npm i eslint-plugin-banned-expressions

Weekly Downloads

784

Version

0.1.0

License

ISC

Unpacked Size

4.56 kB

Total Files

5

Last publish

Collaborators

  • yurireeis