Skip to content
This repository has been archived by the owner on Dec 12, 2020. It is now read-only.

miangraham/eslint-plugin-max-comments-per-function

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eslint-plugin-max-comments-per-function

Rule to limit the number of comments in a function body.

Experimental. A dumb heuristic to reduce line noise. Comments as percentage of line count might be a smarter choice.

Based on max-lines-per-function from the ESLint core rules, originally by Pete Ward. LICENSE (MIT) preserved.

Installation

$ npm install --save-dev eslint-plugin-max-comments-per-function
# or
$ yarn add -D eslint-plugin-max-comments-per-function

Configuration

.eslintrc additions:

---
plugins:
  - max-comments-per-function
rules:
  - max-comments-per-function/max-comments-per-function:
    - error
    - 3

Disallowed

function foo() {
  // I
  const a = 1;

  // love
  let b = 2;

  // comments
  b++;

  // so much
  return b;
}

Allowed

function foo() {
  // I love
  const a = 1;

  // comments
  let b = 2;

  // a bit
  b++;
  return b;
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published