Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-no-comments

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-no-comments

ESLint plugin to disallow comment blocks

  • 1.1.10
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.3K
decreased by-2.77%
Maintainers
1
Weekly downloads
 
Created
Source

eslint-plugin-no-comments

Prevents leaving comment blocks in the file. This plugin will ignore all comments starting from string global or eslint in order to keep eslint local settings safe.

Why?

If the source code is not being processed by a bundler or any other tool, there is a risk of shipping some notes, old code blocks or sensitive information to production environment.

Installation

npm install eslint-plugin-no-comments --save-dev

Configuration

// eslintrc.js
{
    "plugins": ["no-comments"],
    "rules": {
        "no-comments/disallowComments": [
            "error",
            {
                "allow": ["TODO", "FIXME", "NOTE", "DEBUG"],
            }
        ]
    }
}

If allow is not specified, all comments will be disallowed except for eslint and global comments.

Rule details

Fail

// import {Text} from 'react-native'
const {Text, Image} = require('react-native')
/* var price1 = 5;
* var price2 = 6;
var total = price1 + price2;
*/
const {Text, Image} = require('cool-package') // TO-DO fix vulnerability

Pass

/* global MyClass */
// eslint-disable-next-line no-unused-vars

var price1 = 5;
var price2 = 6;
var total = price1 + price2;

if allow is specified, e.g.: ["TODO", "FIXME", "NOTE", "DEBUG"]

const {Text, Image} = require('cool-package') // TODO fix vulnerability

Author

  • Wiktor Wiśniewski

MIT License

Keywords

FAQs

Package last updated on 28 Oct 2022

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc