Allow `==` when null checking (#24593)
parent
e98c86050a
commit
c1a7e38d2b
|
@ -71,7 +71,7 @@ module.exports = {
|
||||||
'comma-style': ['warn', 'last'],
|
'comma-style': ['warn', 'last'],
|
||||||
'consistent-return': 'error',
|
'consistent-return': 'error',
|
||||||
'dot-notation': 'error',
|
'dot-notation': 'error',
|
||||||
eqeqeq: 'error',
|
eqeqeq: ['error', 'always', { 'null': 'ignore' }],
|
||||||
indent: ['warn', 2],
|
indent: ['warn', 2],
|
||||||
'jsx-quotes': ['error', 'prefer-single'],
|
'jsx-quotes': ['error', 'prefer-single'],
|
||||||
'no-case-declarations': 'off',
|
'no-case-declarations': 'off',
|
||||||
|
|
|
@ -32,17 +32,14 @@ function ShortNumber({ value, renderer, children }) {
|
||||||
const shortNumber = toShortNumber(value);
|
const shortNumber = toShortNumber(value);
|
||||||
const [, division] = shortNumber;
|
const [, division] = shortNumber;
|
||||||
|
|
||||||
// eslint-disable-next-line eqeqeq
|
|
||||||
if (children != null && renderer != null) {
|
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.');
|
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 customRenderer = children != null ? children : renderer;
|
||||||
|
|
||||||
const displayNumber = <ShortNumberCounter value={shortNumber} />;
|
const displayNumber = <ShortNumberCounter value={shortNumber} />;
|
||||||
|
|
||||||
// eslint-disable-next-line eqeqeq
|
|
||||||
return customRenderer != null
|
return customRenderer != null
|
||||||
? customRenderer(displayNumber, pluralReady(value, division))
|
? customRenderer(displayNumber, pluralReady(value, division))
|
||||||
: displayNumber;
|
: displayNumber;
|
||||||
|
|
|
@ -60,7 +60,6 @@ export function toShortNumber(sourceNumber) {
|
||||||
* // => 1790
|
* // => 1790
|
||||||
*/
|
*/
|
||||||
export function pluralReady(sourceNumber, division) {
|
export function pluralReady(sourceNumber, division) {
|
||||||
// eslint-disable-next-line eqeqeq
|
|
||||||
if (division == null || division < DECIMAL_UNITS.HUNDRED) {
|
if (division == null || division < DECIMAL_UNITS.HUNDRED) {
|
||||||
return sourceNumber;
|
return sourceNumber;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue