From 30a1a35937a7020809dfae0be84a4712f4fb044d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20G=C3=B3mez?= Date: Sun, 16 Oct 2016 16:13:25 -0400 Subject: [PATCH] Enforce null comparisons to make XO happy (#888) * Remove react/no-eq-null rule from package.json * Enforce null comparison and add type safety on checks --- lib/reducers/ui.js | 12 +++++++----- package.json | 1 - 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/reducers/ui.js b/lib/reducers/ui.js index 5b22d609..6e2ca4b3 100644 --- a/lib/reducers/ui.js +++ b/lib/reducers/ui.js @@ -119,7 +119,8 @@ const reducer = (state = initial, action) => { ret.borderColor = config.borderColor; } - if (config.padding != null) { + if (typeof (config.padding) !== 'undefined' && + config.padding !== null) { ret.padding = config.padding; } @@ -147,7 +148,8 @@ const reducer = (state = initial, action) => { ret.bellSoundURL = config.bellSoundURL || initial.bellSoundURL; } - if (config.copyOnSelect != null) { + if (typeof (config.copyOnSelect) !== 'undefined' && + config.copyOnSelect !== null) { ret.copyOnSelect = config.copyOnSelect; } @@ -302,9 +304,9 @@ const reducer = (state = initial, action) => { } } - if (state.cols != null && state.rows != null && - (state.rows !== state_.rows || - state.cols !== state_.cols)) { + if ((typeof (state.cols) !== 'undefined' && state.cols !== null) && + (typeof (state.rows) !== 'undefined' && state.rows !== null) && + (state.rows !== state_.rows || state.cols !== state_.cols)) { state_ = state_.merge({notifications: {resize: true}}, {deep: true}); } diff --git a/package.json b/package.json index a38c84a8..4b5f117f 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,6 @@ ], "rules": { "eqeqeq": ["error", "allow-null"], - "no-eq-null": 0, "new-cap": 0, "no-warning-comments": 0, "complexity": 0,