Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kantord/eslint-plugin-write-good-comments
ESLint rule that forces you to write good comments
https://github.com/kantord/eslint-plugin-write-good-comments
Last synced: 8 days ago
JSON representation
ESLint rule that forces you to write good comments
- Host: GitHub
- URL: https://github.com/kantord/eslint-plugin-write-good-comments
- Owner: kantord
- License: mit
- Created: 2021-04-01T07:09:31.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-12-15T05:37:33.000Z (11 months ago)
- Last Synced: 2024-10-19T20:27:55.105Z (20 days ago)
- Language: JavaScript
- Size: 102 KB
- Stars: 36
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-eslint - eslint-plugin-write-good-comments - Enforce good writing style in comments. (Plugins / Practices and Specific ES Features)
README
eslint-plugin-write-good-comments
Installation ✴️
Usage ✴️
ExamplesEnforce 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](http://eslint.org):
```bash
npm i eslint --save-dev
```Next, install `eslint-plugin-write-good-comments`:
```bash
npm install eslint-plugin-write-good-comments --save-dev
```_Shameless plug_: I created this rule while working on my main pet-project, [LibreLingo](https://github.com/kantord/LibreLingo).
## Usage
Add `write-good-comments` to the plugins section of your `.eslintrc`
configuration file. You can omit the `eslint-plugin-` prefix:```json
{
"plugins": [
"write-good-comments"
]
}
```Then configure the rules you want to use under the rules section.
```json
{
"rules": {
"write-good-comments/write-good-comments": "warn"
}
}
```You can also disable or enable [checks](https://github.com/btford/write-good#checks) and whitelist words.
```json
{
"rules": {
"write-good-comments/write-good-comments": [
"warn",
{
"passive": false,
"whitelist": ["read-only"]
}
]
}
}
```## Examples
This plugin checks your writing using [write-good](https://github.com/btford/write-good).
Check their documentation for a full list of what it checks for.### Passive voice
Checks for the usage of passive voice.
❌ **Bad**:
```javascript
// files are handled by loadContent()
```✔️ **Good**:
```javascript
// loadContent() handles files
```### Illusion
Checks for cases when a word is repeated.
❌ **Bad**:
```javascript
// loadContent() handles the files that the
// the plugin system doesn't support
```✔️ **Good**:
```javascript
// loadContent() handles the files that the
// plugin system doesn't support
```### Weasel words
Weasel words are words that are ambiguous or misleading.
❌ **Bad**:
```javascript
// loadContent() handles the files that the
// plugin system probably doesn't support
```✔️ **Good**:
```javascript
// loadContent() handles the files that the
// plugin system doesn't support
```### Wordy expressions
Expressions or words that are too lengthy and complicated.
❌ **Bad**:
```javascript
// by virtue of the fact that if there's no token, the user must be logged out
```✔️ **Good**:
```javascript
// because if there's no token, the user must be logged out
```