0.0.1 • Published 2 years ago

eslint-plugin-function-body v0.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

eslint-plugin-function-body

An eslint plugin to check if two different function have same body

Installation

You'll first need to install ESlint:

npm i eslint --save-dev

Next, install eslint-plugin-function-body:

npm install eslint-plugin-function-body --save-dev

Usage

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

{
  "plugin": [
    "function-body"
  ],
  "rules": {
    "function-body/function-body-check": "error"
  }
}

Demo

function foo() {
  const a = 1;
}

function bod() {
  const b = 1;
}

class Test {
  c() {
    const a = 1;
  }
}
10:3 error Two different function c and foo should not have same body
* 1 problem (1 error, 0 warnings)