Nautical Pirate Moustache

    eslint-plugin-arguments

    1.0.5 • Public • Published

    eslint-plugin-arguments

    npm version Build Status Coverage Status StackShare

    eslint plugin to disallow calling method with inline literals as arguments

    Supported Rules

    no-literal-arguments

    Methods array: array with the method names that you want to check.

    {
        "rules": {
            "arguments/no-literal-arguments": [
                "error", 
                [
                    "foo"
                ]
            ]
        }
    }

    When this rule is defined:

    foo(); \\ OK  
    foo(x); \\ OK  
    foo(A.x); \\ OK
    goo('x'); \\OK
    bar.foo(x); \\ OK
     
    foo('x'); \\ BAD 
    foo("x"); \\ BAD  
    foo(10); \\ BAD
    bar.foo('x'); \\ BAD

    Common Usage: you need to block somthing like props.getProp('id') in order to use only props.getProp(constants.ID)

    Installation

    npm i -D eslint eslint-plugin-arguments
    

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

    Usage

    Add arguments to the plugins section of your .eslintrc.json configuration file. (You can omit the eslint-plugin- prefix):

    {
        "plugins": [
            "arguments"
        ]
    }

    Keywords

    Install

    npm i eslint-plugin-arguments

    DownloadsWeekly Downloads

    2

    Version

    1.0.5

    License

    MIT

    Last publish

    Collaborators

    • ronapelbaum