javascript - ESLint: How to set "new-cap" rule's "capIsNewExceptions" option within a file? -
here attempt set eslint's new-cap rule accept "s" allowed function name:
/*eslint new-cap : [capisnewexceptions : ["s"]] */ var s = require("string"); var lines = s(text).lines(); // <-- eslint still gives warning cap 's'! my eslint parser (within intellij) continues give me new-cap warning, noted.
i have tried apply eslint documentation carefully.
from here, see example rule, looks this: /*eslint quotes: [2, "double"], curly: 2*/, in gather quotes , curly rules being set, , quotes rule contains 2 options, therefore contained in brackets because documentation says if rule has additional options, can specify them using array literal syntax (it says right above example).
then, the actual documentation new-cap, find capisnewexceptions provided option, , value of option should array of desired function names - i've tried in code, above.
but doesn't work. still receive eslint warning.
what correct syntax support use of customizing capisnewexceptions option new-cap rule inside javascript file use eslint?
try
/*eslint new-cap: [2, {capisnewexceptions: ["s"]}]*/ var s = require("string"); var lines = s(text).lines(); now, why work way?
you're right passing options rule using array, in the docs mention first element of array “rule id”: number 0 2, defines how rule applied:
0 — disables rule,
1 — makes warning,
2 — makes error.
i'm lazy check, assume rest of array passed rule options property of context. source code of new-cap rule, looks expects 1 option object possible configuration properties capisnewexceptions, newiscap, etc.
Comments
Post a Comment