mirror of
https://github.com/pezkuwichain/pezkuwi-apps.git
synced 2026-11-28 08:29:55 +00:00
Move to @pezkuwi/dev 0.86.4 (eslint 10 toolchain)
- dev ^0.86.4 at the root and in packages/apps; directives renamed by pezkuwi-dev-migrate-eslint10. - eslint --fix with the 0.86.4 config; one fix broke syntax (typescript-eslint prefer-optional-chain turned `(isStarted && onStart) && onStart()` into `(isStarted && onStart?.();` in TxButton) and is corrected by hand. - The remaining findings fixed rather than disabled: optional chains (each suggestion reviewed), `cause` on rethrown errors, `if` instead of `a && promise` in effects, parallel instead of sequential awaits in Promise.all, Error rejections, no `delete` on arrays (the storage query cache is a Map; an upload's file list no longer keeps a hole), no `[object Object]` stringification (TFunction's second argument is text or options), dead code removed (referenda's never-shown expand button, react-query's unused CoreDescriptor).
This commit is contained in:
1 parent
c800e9affb
commit
45d479d2ec
325 files changed
+2942
-3531
No files matched your search
@@ -25,7 +25,7 @@ interface Props {
|
||||
function ExtrinsicDisplay ({ className = '', defaultArgs, defaultValue, isDisabled, isError, isPrivate, label, onChange, onEnter, onEscape, withLabel }: Props): React.ReactElement<Props> {
|
||||
const _onChange = useCallback(
|
||||
(value?: SubmittableExtrinsic<'promise'>) =>
|
||||
onChange && onChange({
|
||||
onChange?.({
|
||||
isValid: !!value,
|
||||
value
|
||||
}),
|
||||
|
||||
@@ -26,7 +26,7 @@ function OpaqueCall ({ className = '', defaultValue, isDisabled, isError, label,
|
||||
callData = (value as SubmittableExtrinsic<'promise'>).method.toHex();
|
||||
}
|
||||
|
||||
onChange && onChange({
|
||||
onChange?.({
|
||||
isValid,
|
||||
value: callData
|
||||
});
|
||||
|
||||
@@ -25,7 +25,7 @@ function ProposalDisplay ({ className = '', defaultValue, isDisabled, isError, l
|
||||
proposal = api.createType('Proposal', value);
|
||||
}
|
||||
|
||||
onChange && onChange({
|
||||
onChange?.({
|
||||
isValid,
|
||||
value: proposal
|
||||
});
|
||||
|
||||
@@ -57,7 +57,6 @@ function isExtrinsic (value: unknown): value is IExtrinsic {
|
||||
|
||||
// This is no doubt NOT the way to do things - however there is no other option
|
||||
function getRawSignature (value: IExtrinsic): ExtrinsicSignature | undefined {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any
|
||||
return (value as any)._raw?.signature?.multiSignature as ExtrinsicSignature;
|
||||
}
|
||||
|
||||
|
||||
@@ -89,10 +89,10 @@ function ExtrinsicDisplay ({ defaultArgs, defaultValue, filter, isDisabled, isEr
|
||||
try {
|
||||
method = extrinsic.fn(...values.map(({ value }) => value));
|
||||
} catch (error) {
|
||||
onError && onError(error as Error);
|
||||
onError?.(error as Error);
|
||||
}
|
||||
} else {
|
||||
onError && onError(null);
|
||||
onError?.(null);
|
||||
}
|
||||
|
||||
onChange(method);
|
||||
|
||||
@@ -32,7 +32,7 @@ function Account (props: Props): React.ReactElement<Props> {
|
||||
|
||||
const _onChange = useCallback(
|
||||
(value?: string | null) =>
|
||||
onChange && onChange({
|
||||
onChange?.({
|
||||
isValid: isValidAddress(value),
|
||||
value
|
||||
}),
|
||||
|
||||
@@ -44,7 +44,7 @@ function Amount ({ className = '', defaultValue: { value }, isDisabled, isError,
|
||||
|
||||
const _onChange = useCallback(
|
||||
(value?: BN) =>
|
||||
onChange && onChange({
|
||||
onChange?.({
|
||||
isValid: !isUndefined(value),
|
||||
value
|
||||
}),
|
||||
|
||||
@@ -108,7 +108,7 @@ function BTreeMapParam ({ className = '', defaultValue, isDisabled = false, labe
|
||||
isValid = isValid && entry.isValid;
|
||||
}
|
||||
|
||||
onChange && onChange({
|
||||
onChange?.({
|
||||
isValid,
|
||||
value: output
|
||||
});
|
||||
|
||||
@@ -19,7 +19,7 @@ function Balance ({ className = '', defaultValue: { value }, isDisabled, isError
|
||||
(value?: BN): void => {
|
||||
const isValid = !isError && !!value;
|
||||
|
||||
onChange && onChange({
|
||||
onChange?.({
|
||||
isValid,
|
||||
value
|
||||
});
|
||||
|
||||
@@ -100,7 +100,7 @@ function BaseBytes ({ asHex, children, className = '', defaultValue: { value },
|
||||
value = compactAddLength(value);
|
||||
}
|
||||
|
||||
onChange && onChange({
|
||||
onChange?.({
|
||||
isValid,
|
||||
value: asHex
|
||||
? u8aToHex(value)
|
||||
|
||||
@@ -34,7 +34,7 @@ function BasicAccountIdBase (props: Props): React.ReactElement<Props> {
|
||||
|
||||
const _onChange = useCallback(
|
||||
(value?: string | null) =>
|
||||
onChange && onChange({
|
||||
onChange?.({
|
||||
isValid: isValidAddress(value, bytesLength === 20),
|
||||
value
|
||||
}),
|
||||
|
||||
@@ -28,7 +28,7 @@ function BoolParam ({ className = '', defaultValue: { value }, isDisabled, isErr
|
||||
|
||||
const _onChange = useCallback(
|
||||
(value: boolean) =>
|
||||
onChange && onChange({
|
||||
onChange?.({
|
||||
isValid: true,
|
||||
value
|
||||
}),
|
||||
|
||||
@@ -21,7 +21,7 @@ function Bytes ({ className = '', defaultValue, isDisabled, isError, label, name
|
||||
(value: Uint8Array): void => {
|
||||
const isValid = value.length !== 0;
|
||||
|
||||
onChange && onChange({
|
||||
onChange?.({
|
||||
isValid,
|
||||
value: compactAddLength(value)
|
||||
});
|
||||
|
||||
@@ -29,7 +29,7 @@ function Cid (props: Props): React.ReactElement<Props> {
|
||||
const value = fromIpfsCid(_value);
|
||||
const isValid = !!value;
|
||||
|
||||
onChange && onChange({
|
||||
onChange?.({
|
||||
isValid,
|
||||
value
|
||||
});
|
||||
|
||||
@@ -17,7 +17,7 @@ function Code ({ className = '', defaultValue, isDisabled, isError, label, onCha
|
||||
(value: Uint8Array): void => {
|
||||
const isValid = isWasm(value);
|
||||
|
||||
onChange && onChange({ isValid, value });
|
||||
onChange?.({ isValid, value });
|
||||
setIsValid(isValid);
|
||||
},
|
||||
[onChange]
|
||||
|
||||
@@ -130,7 +130,7 @@ function EnumParam (props: Props): React.ReactElement<Props> {
|
||||
return;
|
||||
}
|
||||
|
||||
current && onChange && onChange({
|
||||
current && onChange?.({
|
||||
isValid,
|
||||
value: { [current[0].name || 'unknown']: value }
|
||||
});
|
||||
|
||||
@@ -22,7 +22,7 @@ function Hash256 ({ className = '', defaultValue, isDisabled, isError, label, na
|
||||
const value = registry.hash(u8a);
|
||||
|
||||
setPlaceholder(u8aToHex(value));
|
||||
onChange && onChange({
|
||||
onChange?.({
|
||||
isValid: true,
|
||||
value
|
||||
});
|
||||
|
||||
@@ -15,7 +15,7 @@ interface StateParam {
|
||||
u8a: Uint8Array;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
// eslint-disable-next-line @typescript-eslint/no-wrapper-object-types
|
||||
export function createParam (hex: string | String, ignoreLength = false): StateParam {
|
||||
let u8a;
|
||||
let isValid = false;
|
||||
@@ -42,7 +42,7 @@ function KeyValue ({ className = '', isDisabled, label, onChange, onEnter, withL
|
||||
useEffect((): void => {
|
||||
const isValid = key.isValid && value.isValid;
|
||||
|
||||
onChange && onChange({
|
||||
onChange?.({
|
||||
isValid,
|
||||
value: u8aConcat(
|
||||
key.u8a,
|
||||
|
||||
@@ -70,7 +70,7 @@ function KeyValueArray ({ className = '', defaultValue, isDisabled, isError, lab
|
||||
setPlaceholder(t('click to select or drag and drop JSON key/value (hex-encoded) file'));
|
||||
}
|
||||
|
||||
onChange && onChange(encoded);
|
||||
onChange?.(encoded);
|
||||
},
|
||||
[onChange, t]
|
||||
);
|
||||
|
||||
@@ -12,7 +12,7 @@ import Amount from './Amount.js';
|
||||
function Moment ({ className = '', defaultValue, isDisabled, isError, label, onChange, onEnter, onEscape, registry, type, withLabel }: Props): React.ReactElement<Props> {
|
||||
const _onChange = useCallback(
|
||||
(value: RawParamOnChangeValue) =>
|
||||
onChange && onChange(value),
|
||||
onChange?.(value),
|
||||
[onChange]
|
||||
);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import React, { useEffect } from 'react';
|
||||
|
||||
function Null ({ onChange }: Props): React.ReactElement<Props> | null {
|
||||
useEffect((): void => {
|
||||
onChange && onChange({
|
||||
onChange?.({
|
||||
isValid: true,
|
||||
value: null
|
||||
});
|
||||
|
||||
@@ -41,7 +41,7 @@ function OptionDisplay ({ className = '', defaultValue: _defaultValue, isDisable
|
||||
);
|
||||
|
||||
useEffect((): void => {
|
||||
!isActive && onChange && onChange({
|
||||
!isActive && onChange?.({
|
||||
isValid: true,
|
||||
value: null
|
||||
});
|
||||
@@ -49,7 +49,7 @@ function OptionDisplay ({ className = '', defaultValue: _defaultValue, isDisable
|
||||
|
||||
const _onChange = useCallback(
|
||||
(value: RawParamOnChangeValue) =>
|
||||
onChange && onChange(
|
||||
onChange?.(
|
||||
value.isValid && isU8a(value.value) && !withOptionActive && isActive
|
||||
? { isValid: true, value: u8aConcat(OPT_PREFIX, value.value) }
|
||||
: value
|
||||
|
||||
@@ -17,7 +17,7 @@ function Raw ({ className = '', defaultValue: { value }, isDisabled, isError, la
|
||||
(value: string): void => {
|
||||
const isValid = value.length !== 0;
|
||||
|
||||
onChange && onChange({
|
||||
onChange?.({
|
||||
isValid,
|
||||
value
|
||||
});
|
||||
|
||||
@@ -29,7 +29,7 @@ function StructParam (props: Props): React.ReactElement<Props> {
|
||||
return;
|
||||
}
|
||||
|
||||
onChange && onChange({
|
||||
onChange?.({
|
||||
isValid: values.reduce((result: boolean, { isValid }) => result && isValid, true),
|
||||
value: params.reduce((value: Record<string, unknown>, { name }, index): Record<string, unknown> => {
|
||||
value[name || 'unknown'] = values[index].value;
|
||||
|
||||
@@ -16,7 +16,7 @@ function Text ({ className = '', defaultValue: { value }, isDisabled, isError, l
|
||||
(value: string): void => {
|
||||
const isValid = value.length !== 0;
|
||||
|
||||
onChange && onChange({
|
||||
onChange?.({
|
||||
isValid,
|
||||
value
|
||||
});
|
||||
|
||||
@@ -28,7 +28,7 @@ function TupleDisplay (props: Props): React.ReactElement<Props> {
|
||||
return;
|
||||
}
|
||||
|
||||
onChange && onChange({
|
||||
onChange?.({
|
||||
isValid: values.reduce<boolean>((result, { isValid }) => result && isValid, true),
|
||||
value: values.map(({ value }) => value)
|
||||
});
|
||||
|
||||
@@ -84,7 +84,7 @@ function Vector ({ className = '', defaultValue, isDisabled = false, label, onCh
|
||||
|
||||
// when our values has changed, alert upstream
|
||||
useEffect((): void => {
|
||||
onChange && onChange({
|
||||
onChange?.({
|
||||
isValid: values.reduce<boolean>((result, { isValid }) => result && isValid, true),
|
||||
value: values.map(({ value }) => value)
|
||||
});
|
||||
|
||||
@@ -47,7 +47,7 @@ function VectorFixed ({ className = '', defaultValue, isDisabled = false, label,
|
||||
|
||||
// when our values has changed, alert upstream
|
||||
useEffect((): void => {
|
||||
onChange && onChange({
|
||||
onChange?.({
|
||||
isValid: values.reduce((result: boolean, { isValid }) => result && isValid, true),
|
||||
value: values.map(({ value }) => value)
|
||||
});
|
||||
|
||||
@@ -28,7 +28,7 @@ export const textMap = options.reduce((textMap, { text, value }): TextMap => {
|
||||
function VoteThresholdParam ({ className = '', defaultValue: { value }, isDisabled, isError, label, onChange, withLabel }: Props): React.ReactElement<Props> {
|
||||
const _onChange = useCallback(
|
||||
(value: number) =>
|
||||
onChange && onChange({
|
||||
onChange?.({
|
||||
isValid: true,
|
||||
value
|
||||
}),
|
||||
@@ -36,7 +36,6 @@ function VoteThresholdParam ({ className = '', defaultValue: { value }, isDisabl
|
||||
);
|
||||
|
||||
const defaultValue = useMemo(
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
() => isFunction((value as BN).toNumber)
|
||||
? (value as BN).toNumber()
|
||||
: bnToBn(value as number).toNumber(),
|
||||
|
||||
@@ -43,7 +43,6 @@ import Vote from './Vote.js';
|
||||
import VoteThreshold from './VoteThreshold.js';
|
||||
|
||||
interface TypeToComponent {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
c: React.ComponentType<any>;
|
||||
t: string[];
|
||||
}
|
||||
@@ -115,7 +114,7 @@ function fromDef ({ displayName, info, lookupName, sub, type }: TypeDef): string
|
||||
return 'Enum';
|
||||
|
||||
case TypeDefInfo.Result: {
|
||||
const [, errSub] = (sub as TypeDef[]);
|
||||
const [, errSub] = sub as TypeDef[];
|
||||
|
||||
return DISPATCH_ERROR.includes(errSub.lookupName || errSub.type)
|
||||
? 'DispatchResult'
|
||||
|
||||
@@ -153,13 +153,13 @@ class Params extends React.PureComponent<Props, State> {
|
||||
return;
|
||||
}
|
||||
|
||||
onChange && onChange(values);
|
||||
onChange?.(values);
|
||||
};
|
||||
|
||||
private onRenderError = (): void => {
|
||||
const { onError } = this.props;
|
||||
|
||||
onError && onError();
|
||||
onError?.();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ export interface Props {
|
||||
onChange?: RawParamOnChange;
|
||||
onEnter?: RawParamOnEnter;
|
||||
onEscape?: RawParamOnEscape;
|
||||
// eslint-disable-next-line no-use-before-define
|
||||
overrides?: ComponentMap;
|
||||
registry: Registry;
|
||||
type: TypeDefExt;
|
||||
|
||||
@@ -34,7 +34,6 @@ function formatKeys (keys: [ValidatorId, Keys][]): string {
|
||||
}
|
||||
|
||||
function toHuman (value: Codec | Codec[]): unknown {
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
return isFunction((value as Codec).toHuman)
|
||||
? (value as Codec).toHuman()
|
||||
: Array.isArray(value)
|
||||
@@ -65,7 +64,6 @@ export default function valueToText (type: string, value: Codec | undefined | nu
|
||||
}
|
||||
|
||||
const renderedValue = (
|
||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
['Bytes', 'Raw', 'Option<Keys>', 'Keys'].includes(type) && isFunction(value.toU8a)
|
||||
? u8aToHex(value.toU8a(true))
|
||||
// HACK Handle Keys as hex-only (this should go away once the node value is
|
||||
|
||||
Reference in new issue
Block a user