eslint-plugin-no-blocked-words-plugin
v1.0.3
Published
Plugin to disallow blocked words from code
Downloads
4
Readme
eslint-plugin-no-blocked-words-plugin
- This custom ESLint plugin is used to disallow the use of certain words which might be insensitive or blocked due to security policies.
- This will detect the words used as any type of identifiers or strings and throw an error when the blocked words are used at any place in the code.
- It takes an array of strings which you want to block from your code.
Table of Contents
Installation and Configuration
yarn add --dev eslint eslint-plugin-no-blocked-words-plugin
Note: If you installed ESLint globally then you must also install
eslint-plugin-no-blocked-words-plugin
globally.
Usage
- Add the plugin name in the plugins array of .eslintrc.js file of your Project directory like this:
{
"plugins": ["eslint-plugin-no-blocked-words-plugin"]
}
- Add this rule in rules section of .eslintrc.js file of your Project directory like this:
{
"rules": {
"no-blocked-words-plugin/no-blocked-words": ["error", ["blockedWord1", "blockedWord2"]]
}
}
- Run yarn eslint and the Project code will be analyzed for any words containing these strings and eslint will fail showing the errors.
- This will also detect the words containing these strings like the word SomethingblockedWord1Something will also throw error.