coffeelint-forbidden-regex

CoffeeLint rule that forbids specified regular expressions.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
coffeelint-forbidden-regex
100.1.17 years ago8 years agoMinified + gzip package size for coffeelint-forbidden-regex in KB

Readme

coffeelint-forbidden-regex ============================== NPM Version A CoffeeLint rule that searches for specified regular expressions in code and fails when it founds them. Installation -----------
npm install coffeelint-forbidden-regex
Configuration ----------- Add the following entry to your coffeelint.json file:
"forbidden_regex": {
"module": "coffeelint-forbidden-regex",
"level": "error",
"regexList": [
"sampleForbiddenRegex1",
"sampleForbiddenRegex2"
]
}
Example ----------- If you want to reject alert('something') or alert 'something' calls, add a forbidden regular expression for coffeelint:
"forbidden_regex": {
"module": "coffeelint-forbidden-regex",
"level": "error",
"regexList": [
"\\balert[\\s\\(]"
]
}
\\b is the word boundary in regexps. Rejecting the console.log calls ----------- Keep in mind that forbidding the console calls should be done with the no_debugger checker since CoffeeLint 1.10.0: ``` "nodebugger": { "level": "error", "console": true } ``` You should use the coffeelint-forbidden-regex for more sophisticated purposes. Also, keep in mind that ----------- it can slow down your linting process noticeably.