From c1a7e38d2b9504fe06716a56a1f6193686026c16 Mon Sep 17 00:00:00 2001 From: fusagiko / takayamaki <24884114+takayamaki@users.noreply.github.com> Date: Thu, 20 Apr 2023 00:46:46 +0900 Subject: [PATCH] Allow `==` when null checking (#24593) --- .eslintrc.js | 2 +- app/javascript/mastodon/components/short_number.jsx | 3 --- app/javascript/mastodon/utils/numbers.js | 1 - 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index bbdfa7de2..a9b02e294 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -71,7 +71,7 @@ module.exports = { 'comma-style': ['warn', 'last'], 'consistent-return': 'error', 'dot-notation': 'error', - eqeqeq: 'error', + eqeqeq: ['error', 'always', { 'null': 'ignore' }], indent: ['warn', 2], 'jsx-quotes': ['error', 'prefer-single'], 'no-case-declarations': 'off', diff --git a/app/javascript/mastodon/components/short_number.jsx b/app/javascript/mastodon/components/short_number.jsx index 535c17727..861d0bc58 100644 --- a/app/javascript/mastodon/components/short_number.jsx +++ b/app/javascript/mastodon/components/short_number.jsx @@ -32,17 +32,14 @@ function ShortNumber({ value, renderer, children }) { const shortNumber = toShortNumber(value); const [, division] = shortNumber; - // eslint-disable-next-line eqeqeq if (children != null && renderer != null) { console.warn('Both renderer prop and renderer as a child provided. This is a mistake and you really should fix that. Only renderer passed as a child will be used.'); } - // eslint-disable-next-line eqeqeq const customRenderer = children != null ? children : renderer; const displayNumber = ; - // eslint-disable-next-line eqeqeq return customRenderer != null ? customRenderer(displayNumber, pluralReady(value, division)) : displayNumber; diff --git a/app/javascript/mastodon/utils/numbers.js b/app/javascript/mastodon/utils/numbers.js index 6ef563ad8..fa3d58fad 100644 --- a/app/javascript/mastodon/utils/numbers.js +++ b/app/javascript/mastodon/utils/numbers.js @@ -60,7 +60,6 @@ export function toShortNumber(sourceNumber) { * // => 1790 */ export function pluralReady(sourceNumber, division) { - // eslint-disable-next-line eqeqeq if (division == null || division < DECIMAL_UNITS.HUNDRED) { return sourceNumber; }