Socket
Book a DemoInstallSign in
Socket

eslint-plugin-no-blocked-words-plugin

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-no-blocked-words-plugin

Plugin to disallow blocked words from code

latest
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

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
  • Usage

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.

FAQs

Package last updated on 25 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts