Skip to content

HainanZhao/eslint-plugin-param-inline-comments

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eslint-plugin-param-inline-comments

Description

eslint-plugin-param-inline-comments is an ESLint plugin that enforces inline comments for function parameters. This helps to improve code readability and maintainability by ensuring that the purpose of each parameter is clearly documented.

Installation

To install the plugin, run:

npm install eslint-plugin-param-inline-comments --save-dev

Usage

Add param-inline-comments to the plugins section of your ESLint configuration file, and configure the rule:

module.exports = {
  plugins: [
    "param-inline-comments"
  ],
  rules: {
    "param-inline-comments/param-inline-comments": "warn"
  }
};

On the other hand, If you want to remove the comments added, use the no-param-inline-comments rule instead

    "param-inline-comments/no-param-inline-comments": "warn"

Example

Given the following code:

function test(a, b, c, d) {
  // function body
}

test(1, true, null, false);

The plugin will enforce the following change:

function test(a, b, c, d) {
  // function body
}

test(/* a */ 1, /* b */ true, /* c */ null, /* d */ false);

Contributing Contributions are welcome! Please open an issue or submit a pull request on GitHub.

License

This README provides a clear and concise summary of the ESLint plugin, including installation and usage instructions, an example, and information on contributing and licensing.

About

Eslint plugin for enforcing simple param inline comment

Resources

Stars

Watchers

Forks

Packages

No packages published