-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add no-unneeded-ternary rule #1034
base: main
Are you sure you want to change the base?
Conversation
im new to deno_lint but does this support the "quick fix" option from the LSP |
docs/rules/no_unneeded_ternary.md
Outdated
It's a common mistake to use a conditional expression to select between two | ||
Boolean values instead of using ! to convert the test to a Boolean. | ||
|
||
### Invalid: | ||
|
||
```typescript | ||
const foo = condition ? true : false; | ||
``` | ||
|
||
### Valid: | ||
|
||
```typescript | ||
const foo = condition ? x : y; | ||
const foo = condition ? x : false; | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add more examples? I still don't understand the purpose of this rule just from examples
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I think I need to add some comments to make it more clear.
Closes #1032