Giter VIP home page Giter VIP logo

eslint-plugin-write-good-comments's Introduction

eslint-plugin-write-good-comments

Installation ✴️ Usage ✴️ Examples

Enforce good writing style in your comments.

Using better writing style gives you more concise and expressive comments.

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-write-good-comments:

npm install eslint-plugin-write-good-comments --save-dev

Shameless plug: I created this rule while working on my main pet-project, LibreLingo.

Usage

Add write-good-comments to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
    "plugins": [
        "write-good-comments"
    ]
}

Then configure the rules you want to use under the rules section.

{
    "rules": {
        "write-good-comments/write-good-comments": "warn"
    }
}

You can also disable or enable checks and whitelist words.

{
    "rules": {
        "write-good-comments/write-good-comments": [
            "warn", 
            {
                "passive": false,
                "whitelist": ["read-only"]
            }
        ]
    }
}

Examples

This plugin checks your writing using write-good. Check their documentation for a full list of what it checks for.

Passive voice

Checks for the usage of passive voice.

Bad:

// files are handled by loadContent()

✔️ Good:

// loadContent() handles files

Illusion

Checks for cases when a word is repeated.

Bad:

// loadContent() handles the files that the
// the plugin system doesn't support

✔️ Good:

// loadContent() handles the files that the
// plugin system doesn't support

Weasel words

Weasel words are words that are ambiguous or misleading.

Bad:

// loadContent() handles the files that the
// plugin system probably doesn't support

✔️ Good:

// loadContent() handles the files that the
// plugin system doesn't support

Wordy expressions

Expressions or words that are too lengthy and complicated.

Bad:

// by virtue of the fact that if there's no token, the user must be logged out

✔️ Good:

// because if there's no token, the user must be logged out

eslint-plugin-write-good-comments's People

Contributors

dangm96 avatar kantord avatar v-zhzhou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

eslint-plugin-write-good-comments's Issues

Can't install

I followed the instructions but when running eslint I get

1:1  error  Definition for rule 'write-good-comments/write-good-comments' was not found  write-good-comments/write-good-comments

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.