https://github.com/didaquis/eslint-plugin-no-lenght
Ensures you never write lenght instead of length
https://github.com/didaquis/eslint-plugin-no-lenght
Last synced: about 2 months ago
JSON representation
Ensures you never write lenght instead of length
- Host: GitHub
- URL: https://github.com/didaquis/eslint-plugin-no-lenght
- Owner: didaquis
- Created: 2021-06-21T23:04:06.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-04-01T00:39:22.000Z (about 2 years ago)
- Last Synced: 2025-03-11T03:47:27.097Z (about 2 months ago)
- Language: JavaScript
- Homepage:
- Size: 133 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# eslint-plugin-no-lenght
This plugin was created to avoid misspelling the "length" property.
## Why?
Many non-English speakers make the mistake of writing the word "lenght" when they want to write "length". This plugin allows to detect that mistake.
## Installation and Usage
1. Install the plugin using this command: `npm install @didaquis/eslint-plugin-no-lenght --save-dev`
2. Add this configuration on your eslintrc file:
```
{
"plugins": [
"@didaquis/no-lenght"
],
"rules": {
"@didaquis/no-lenght/no-lenght": "error"
}
}
```Available setting for the rule:
* `"off"` - turn the rule off.
* `"warn"` - turn the rule on as a warning (doesn’t affect exit code).
* `"error"` - turn the rule on as an error (exit code is 1 when triggered).
**Note:** This plugin requires `eslint` configured in your project.## Rule Details
Examples of **CORRECT** code for this rule:
```js
const fruits = [];if (fruits.length) {
// ...
}
```Examples of **INCORRECT** code for this rule:
```js
const fruits = [];if (fruits.lenght) { // throws an eslint error!
// ...
}
```
```js
const size = {
length: 200,
width: 50
};if (size.lenght > 100) { // throws an eslint error!
// ...
}
```## Credit
> This project is a refactored fork of [this project](https://www.npmjs.com/package/eslint-plugin-no-lenght).
> Original author: @enapupe (Iacami Gevaerd)