eslint-plugin-call-func-with-return

0.1.0 • Public • Published

eslint-plugin-call-func-with-return

中文文档

Call specified functions with return statement.

function jsonRet(data = {}, retCode, retMessage) {
    return {
        data,
        retCode,
        retMessage,
    }
}

function main() {
    jsonRet({ author: 'elvinn' }); // error
    return jsonRet({ author: 'elvin' }); // ok
}

Installation

You'll first need to install ESLint:

$ npm i eslint --save-dev

Next, install eslint-plugin-call-func-with-return:

$ npm install eslint-plugin-call-func-with-return --save-dev

Usage

Add call-func-with-return to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
    "plugins": [
        "call-func-with-return"
    ]
}

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

{
    "rules": {
        "call-func-with-return/call-func-with-return": [2, ["jsonRet", "xmlRet"]]
    }
}

Package Sidebar

Install

npm i eslint-plugin-call-func-with-return

Weekly Downloads

2

Version

0.1.0

License

MIT

Unpacked Size

10.2 kB

Total Files

8

Last publish

Collaborators

  • elvinn