https://github.com/miguelripoll23/explicit-boolean-comparison-plugin
A Deno lint plugin that enforces explicit boolean comparisons
https://github.com/miguelripoll23/explicit-boolean-comparison-plugin
deno lint plugin
Last synced: 3 months ago
JSON representation
A Deno lint plugin that enforces explicit boolean comparisons
- Host: GitHub
- URL: https://github.com/miguelripoll23/explicit-boolean-comparison-plugin
- Owner: MiguelRipoll23
- License: mit
- Created: 2025-03-01T13:10:21.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-01T14:15:51.000Z (over 1 year ago)
- Last Synced: 2025-03-01T14:26:54.152Z (over 1 year ago)
- Topics: deno, lint, plugin
- Language: TypeScript
- Homepage: https://jsr.io/@miguelripoll23/explicit-boolean-comparison-plugin
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# explicit-boolean-comparison-plugin
A Deno lint plugin that enforces explicit boolean comparisons by disallowing the
use of the ! shorthand for boolean negation. This rule helps improve code
readability by requiring an explicit comparison (e.g., variable === false) in
conditional statements.
> [!NOTE]
> If it were up to me, I’d launch a strike to wipe out the ! shorthand that
> turns code into unreadable chaos. But until I can secure the necessary
> military funding, here’s a lint plugin as a peace offering.
## Example
```js
if (!flag) { // ⚠️ Avoid using '!' shorthand for boolean negation to improve readability. Use an explicit comparison instead (e.g., flag === false).
console.log("Flag is false");
}
```
## Usage
Add the following block to your `deno.json` file:
```json
{
"lint": {
"plugins": [
"jsr:@miguelripoll23/explicit-boolean-comparison-plugin"
]
}
}
```