All Projects → remithomas → eslint-plugin-ban

remithomas / eslint-plugin-ban

Licence: ISC license
Ban some methods and functions

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to eslint-plugin-ban

eslint-plugin-svelte
ESLint plugin for Svelte using AST
Stars: ✭ 22 (-4.35%)
Mutual labels:  eslint, eslint-plugin
eslint-plugin-react-hook-form
ESLint plugin for react-hook-form
Stars: ✭ 27 (+17.39%)
Mutual labels:  eslint, eslint-plugin
Eslint Plugin Lodash
ESLint rules for lodash
Stars: ✭ 208 (+804.35%)
Mutual labels:  eslint, eslint-plugin
Eslint Import Resolver Alias
a simple Node behavior import resolution plugin for eslint-plugin-import, supporting module alias
Stars: ✭ 121 (+426.09%)
Mutual labels:  eslint, eslint-plugin
html-eslint
ESLint plugin for linting HTML
Stars: ✭ 72 (+213.04%)
Mutual labels:  eslint, eslint-plugin
Eslint Plugin Unicorn
Various awesome ESLint rules
Stars: ✭ 2,157 (+9278.26%)
Mutual labels:  eslint, eslint-plugin
Eslint Plugin Eslint Comments
Additional ESLint rules for directive comments of ESLint.
Stars: ✭ 221 (+860.87%)
Mutual labels:  eslint, eslint-plugin
Eslint Mdx
ESLint Parser/Plugin for MDX
Stars: ✭ 89 (+286.96%)
Mutual labels:  eslint, eslint-plugin
eslint-plugin-pug
An ESLint plugin for linting inline scripts in Pug files
Stars: ✭ 17 (-26.09%)
Mutual labels:  eslint, eslint-plugin
Eslint Plugin Mocha
ESLint rules for mocha
Stars: ✭ 249 (+982.61%)
Mutual labels:  eslint, eslint-plugin
Eslint Plugin Css Modules
Project status: NOT MAINTAINED; Checks that you are using the existent css/scss classes, no more no less
Stars: ✭ 115 (+400%)
Mutual labels:  eslint, eslint-plugin
eslint-plugin-editorconfig
An ESLint plugin to enforce EditorConfig rules
Stars: ✭ 22 (-4.35%)
Mutual labels:  eslint, eslint-plugin
Eslint Plugin I18n Json
Fully extendable eslint plugin for JSON i18n translation files.
Stars: ✭ 101 (+339.13%)
Mutual labels:  eslint, eslint-plugin
Eslint Plugin Boundaries
Eslint plugin checking architecture boundaries between elements
Stars: ✭ 157 (+582.61%)
Mutual labels:  eslint, eslint-plugin
Typescript Eslint
✨ Monorepo for all the tooling which enables ESLint to support TypeScript
Stars: ✭ 10,831 (+46991.3%)
Mutual labels:  eslint, eslint-plugin
Eslint Plugin Ava
ESLint rules for AVA
Stars: ✭ 209 (+808.7%)
Mutual labels:  eslint, eslint-plugin
Eslint Plugin Monorepo
ESLint Plugin for monorepos
Stars: ✭ 56 (+143.48%)
Mutual labels:  eslint, eslint-plugin
Sowing Machine
🌱A React UI toolchain & JSX alternative
Stars: ✭ 64 (+178.26%)
Mutual labels:  eslint, eslint-plugin
Eslint Plugin Ember
An ESlint plugin that provides set of rules for Ember Applications based on commonly known good practices.
Stars: ✭ 240 (+943.48%)
Mutual labels:  eslint, eslint-plugin
eslint-plugin-rulesdir
An ESLint plugin to load project-specific ESLint rules
Stars: ✭ 28 (+21.74%)
Mutual labels:  eslint, eslint-plugin

eslint-plugin-ban Build Status npm version

Allows you to bannish some methods or functions.. Inspired by tslint ban rule

Installation

You'll first need to install ESLint:

$ npm i eslint --save-dev

Next, install eslint-plugin-ban:

$ npm install eslint-plugin-ban --save-dev

Note: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-ban globally.

Usage

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

{
  "plugins": ["ban"]
}

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

{
  "rules": {
    "ban/ban": [
      2,
      { "name": "functionName", "message": "Prefer use functionName2" }
    ]
  }
}

Some examples

An error

{
  "rules": {
    "ban/ban": [
      2,
      {
        "name": ["*", "push"],
        "message": "Prefer use es6 spread like [...items, newItem]"
      }
    ]
  }
}

A simple warning

{
  "rules": {
    "ban/ban": [
      1,
      {
        "name": "api",
        "message": "This function is deprecated, please use api.call()"
      }
    ]
  }
}

Multiple errors

{
  "rules": {
    "ban/ban": [
      "error",
      {
        "name": "api",
        "message": "This function is deprecated, please use api.call()"
      },
      {
        "name": ["*", "push"],
        "message": "Prefer use es6 spread like [...items, newItem]"
      },
      { "name": "functionName", "message": "Prefer use functionName2" }
    ]
  }
}

Widcard

{
  "rules": {
    "ban/ban": [
      2,
      { "name": ["console", "*"], "message": "Please use our logger" }
    ]
  }
}

Todo

  • Possibility to add errorand warning at same time

Contributing

Please feel free to submit, comment anything on this repo :)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].