[gnome-maps/wip/mattiasb/eslint] Lint: No Extra Boolean Casts
- From: Mattias Bengtsson <mattiasb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/mattiasb/eslint] Lint: No Extra Boolean Casts
- Date: Sat, 30 Jan 2016 20:58:07 +0000 (UTC)
commit 8a5ef01638a77f54a9b92b32860c27e40faf9812
Author: Mattias Bengtsson <mattias jc bengtsson gmail com>
Date: Sat Jan 30 21:35:54 2016 +0100
Lint: No Extra Boolean Casts
Double negation of a variable is a way to explicitly coerce a value to
boolean. This is not needed in a bunch of cases, for example in if- and
while-statements.
Example:
if (!!foo) { // ESLint will throw an error
// ...
}
if (foo) { // This is equivalent to the above, and ok.
// ...
}
.eslintrc.yaml | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/.eslintrc.yaml b/.eslintrc.yaml
index b3a5f20..6a659d6 100644
--- a/.eslintrc.yaml
+++ b/.eslintrc.yaml
@@ -28,3 +28,5 @@ rules:
- 2
no-ex-assign:
- 2
+ no-extra-boolean-cast:
+ - 2
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]