1.0.0 • Published 10 months ago

eslint-plugin-no-comment v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

eslint-plugin-no-comment 🫢

Disable use of comment style, either '//' or '/*'

Usage

• Add package yarn add -D eslint-plugin-no-comment or npm install --save-dev eslint-plugin-no-comment

Enable plugin, Add no-comment to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
    "plugins": [
        "no-comment"
    ]
}

Enable rule Then configure the rules under the rules section.

{
    "rules": {
        "no-comment/no-comment-line": "error"
    }
}

Reasoning

All modern editors provide keyboard shortcuts to turn an existing line of code into a comment typically Cmd+'/' the problem is that this change can be forgotten about & maybe missed during a pull-request review leaving commented out code into the main branch & without reasoning why it was there.

Adding eslint-no-comment/no-comment-line will flag this & provided eslint is executed during the commit/deployment stage this will be flagged & addressed before delivery

Example

Demo project showing rule in use: demo-eslint-plugin-no-comment

Notes

• No auto fix functionality is provided & should not be. Based on the reasoning above, doing so would not help resolve the underlying issue

• eslint-no-comment/no-comment-block Added too, however unlikely to be used based on #reasoning above

NameDescription
no-comment-blockDisable use of /* comment blocks
no-comment-lineDisable use of // line comments

Development

yarn lint static analysis of module

yarn test verify linting rules

yarn publish using NPM_PUBLISH_TOKEN, publish to npmjs.com

Licensing

MIT

Attribution

• Project built using yeoman generator yo eslint:plugin & yo eslint:rule

1.0.0

10 months ago

0.1.1

10 months ago

0.1.0

10 months ago