eslint plugin to disallow calling method with inline literals as 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 onlyprops.getProp(constants.ID)
npm i -D eslint eslint-plugin-arguments
Note: If you installed
eslint
globally (using the-g
flag) then you must also installeslint-plugin-arguments
globally.
Add arguments
to the plugins section of your .eslintrc.json
configuration file. (You can omit the eslint-plugin-
prefix):
{
"plugins": [
"arguments"
]
}