1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Linting fixups

This commit is contained in:
Zachary Belford 2022-06-07 16:04:59 -07:00
parent 93ee67eb01
commit 8b09f84502
No known key found for this signature in database
GPG Key ID: CC6C9E5B7B8D6059
3 changed files with 33 additions and 15 deletions

View File

@ -20,8 +20,10 @@ export default function UpdateNicknamePopover({
}) {
const t = useContext(I18nContext);
const [nicknameInput, setNicknameInput] = useState(nickname === null ? "" : nickname);
const [memoInput, setMemoInput] = useState(memo === null ? "" : memo);
const [nicknameInput, setNicknameInput] = useState(
nickname === null ? '' : nickname,
);
const [memoInput, setMemoInput] = useState(memo === null ? '' : memo);
const handleNicknameChange = (event) => {
setNicknameInput(event.target.value);

View File

@ -85,26 +85,39 @@ const AssetOptions = ({
);
};
const isntFunc = (p) => {
return typeof p !== 'function';
};
AssetOptions.propTypes = {
isEthNetwork: PropTypes.bool,
isNativeAsset: PropTypes.bool,
onClickBlockExplorer: PropTypes.func.isRequired,
onViewAccountDetails: PropTypes.func.isRequired,
onRemove: (props, propName, componentName) => {
if (props.isNativeAsset === false && typeof(props.onRemove) !== "function") {
throw new Error("When isNativeAsset is true, onRemove is a required prop");
onRemove: (props) => {
if (props.isNativeAsset === false && isntFunc(props.onRemove)) {
throw new Error(
'When isNativeAsset is true, onRemove is a required prop',
);
}
},
onViewTokenDetails: (props, propName, componentName) => {
if (props.isNativeAsset === false && typeof(props.onViewTokenDetails) !== "function") {
throw new Error("When isNativeAsset is true, onViewTokenDetails is a required prop");
onViewTokenDetails: (props) => {
if (props.isNativeAsset === false && isntFunc(props.onViewTokenDetails)) {
throw new Error(
'When isNativeAsset is true, onViewTokenDetails is a required prop',
);
}
},
tokenSymbol: (props, propName, componentName) => {
if (props.isNativeAsset === false && typeof(props.tokenSymbol) !== "string") {
throw new Error("When isNativeAsset is true, tokenSymbol is a required prop");
tokenSymbol: (props) => {
if (
props.isNativeAsset === false &&
typeof props.tokenSymbol !== 'string'
) {
throw new Error(
'When isNativeAsset is true, tokenSymbol is a required prop',
);
}
}
},
};
export default AssetOptions;

View File

@ -123,10 +123,13 @@ export default class Home extends PureComponent {
showRecoveryPhraseReminder: PropTypes.bool.isRequired,
setRecoveryPhraseReminderHasBeenShown: PropTypes.func.isRequired,
setRecoveryPhraseReminderLastShown: PropTypes.func.isRequired,
seedPhraseBackedUp: (props, propName, componentName) => {
if (props.seedPhraseBackedUp !== null && typeof(props.seedPhraseBackedUp) !== "boolean") {
seedPhraseBackedUp: (props) => {
if (
props.seedPhraseBackedUp !== null &&
typeof props.seedPhraseBackedUp !== 'boolean'
) {
throw new Error(
`seedPhraseBackedUp is required to be null or boolean. Received ${props.seedPhraseBackedUp}`
`seedPhraseBackedUp is required to be null or boolean. Received ${props.seedPhraseBackedUp}`,
);
}
},