diff --git a/lib/Cookie.jsx b/lib/Cookie.jsx index d2ae6f3c..656a5d6c 100644 --- a/lib/Cookie.jsx +++ b/lib/Cookie.jsx @@ -72,7 +72,7 @@ function enabled() { const cookieName = `cookieTest_${Math.floor(Math.random() * 1000)}`; const cookieValue = 'enabled'; set(cookieName, cookieValue, 1); - const result = Boolean(document.cookie.indexOf(cookieName) >= 0) || false; + const result = document.cookie.indexOf(cookieName) >= 0 || false; if (result) { remove(cookieName); } diff --git a/lib/components/form/element/combobox.js b/lib/components/form/element/combobox.js index 53a6e10b..ae482a59 100644 --- a/lib/components/form/element/combobox.js +++ b/lib/components/form/element/combobox.js @@ -485,7 +485,7 @@ class Combobox extends React.Component { const formatOption = (option) => ({ focused: false, - isSelected: option.selected && (isEqual(option.value, currentValue) || Boolean(alreadySelected.find((item) => item.value === option.value))), + isSelected: option.selected && (isEqual(option.value, currentValue) || !!alreadySelected.find((item) => item.value === option.value)), ...option, }); @@ -551,7 +551,7 @@ class Combobox extends React.Component { const deselectOption = (initialOption) => { const option = initialOption; const isSelected = isEqual(option.value, val); - option.isSelected = isSelected || Boolean(this.props.alreadySelectedOptions.find((optionItem) => optionItem.value === option.value)); + option.isSelected = isSelected || !!this.props.alreadySelectedOptions.find((optionItem) => optionItem.value === option.value); return option; }; @@ -655,7 +655,7 @@ class Combobox extends React.Component { } const state = this.getStartState(noDefaultValue, this.options, newAlreadySelectedOptions); const handleDropdownStateChange = () => { - this.props.onDropdownStateChange(Boolean(state.isDropdownOpen)); + this.props.onDropdownStateChange(!!state.isDropdownOpen); }; this.setState(state, handleDropdownStateChange); } @@ -859,8 +859,7 @@ class Combobox extends React.Component { const formatOption = (option) => ({ focused: false, isSelected: - isEqual(option.value ? option.value.toUpperCase : '', value.toUpperCase()) || - Boolean(this.props.alreadySelectedOptions.find((optionItem) => optionItem.value === option.value)), + isEqual(option.value ? option.value.toUpperCase : '', value.toUpperCase()) || !!this.props.alreadySelectedOptions.find((optionItem) => optionItem.value === option.value), ...option, }); diff --git a/lib/str.ts b/lib/str.ts index 210a72f5..1b6af24f 100644 --- a/lib/str.ts +++ b/lib/str.ts @@ -350,7 +350,7 @@ const Str = { * @returns True if the string is a domain name */ isValidDomainName(str: string): boolean { - return Boolean(String(str).match(Constants.CONST.REG_EXP.DOMAIN)); + return !!String(str).match(Constants.CONST.REG_EXP.DOMAIN); }, /** @@ -359,7 +359,7 @@ const Str = { * @returns True if the string is a valid hyperlink */ isValidURL(str: string): boolean { - return Boolean(String(str).match(Constants.CONST.REG_EXP.HYPERLINK)); + return !!String(str).match(Constants.CONST.REG_EXP.HYPERLINK); }, /** @@ -371,7 +371,7 @@ const Str = { * @returns True if the string is an email */ isValidEmail(str: string): boolean { - return Boolean(String(str).match(Constants.CONST.REG_EXP.EMAIL)); + return !!String(str).match(Constants.CONST.REG_EXP.EMAIL); }, /** @@ -382,7 +382,7 @@ const Str = { * @returns True if the string is an valid email created by comment markdown. */ isValidEmailMarkdown(str: string): boolean { - return Boolean(String(str).match(`^${Constants.CONST.REG_EXP.MARKDOWN_EMAIL}$`)); + return !!String(str).match(`^${Constants.CONST.REG_EXP.MARKDOWN_EMAIL}$`); }, /** @@ -818,7 +818,7 @@ const Str = { if (this.isString(value)) { return value.toLowerCase() === 'true'; } - return Boolean(value); + return !!value; }, /** diff --git a/package-lock.json b/package-lock.json index 2ac70ed5..de93bec2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,7 +37,7 @@ "babel-jest": "^29.0.0", "babelify": "10.0.0", "eslint": "^8.57.0", - "eslint-config-expensify": "^2.0.48", + "eslint-config-expensify": "^2.0.50", "eslint-config-prettier": "^8.10.0", "eslint-plugin-jest": "^28.6.0", "eslint-plugin-prettier": "^5.1.3", @@ -5467,10 +5467,11 @@ } }, "node_modules/eslint-config-expensify": { - "version": "2.0.48", - "resolved": "https://registry.npmjs.org/eslint-config-expensify/-/eslint-config-expensify-2.0.48.tgz", - "integrity": "sha512-PFegJ9Wfsiu5tgevhjA1toCxsZ8Etfk6pIjtXAnwpmVj7q4CtB3QDRusJoUDyJ3HrZr8AsFKViz7CU/CBTfwOw==", + "version": "2.0.50", + "resolved": "https://registry.npmjs.org/eslint-config-expensify/-/eslint-config-expensify-2.0.50.tgz", + "integrity": "sha512-I+OMkEprqEWlSCZGJBJxpt2Wg4HQ41/QqpKVfcADiQ3xJ76bZ1mBueqz6DR4jfph1xC6XVRl4dqGNlwbeU/2Rg==", "dev": true, + "license": "ISC", "dependencies": { "@lwc/eslint-plugin-lwc": "^1.7.2", "babel-eslint": "^10.1.0", diff --git a/package.json b/package.json index 0b5c41ca..445e9ad4 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "babel-jest": "^29.0.0", "babelify": "10.0.0", "eslint": "^8.57.0", - "eslint-config-expensify": "^2.0.48", + "eslint-config-expensify": "^2.0.50", "eslint-config-prettier": "^8.10.0", "eslint-plugin-jest": "^28.6.0", "eslint-plugin-prettier": "^5.1.3",