From 45d479d2ec3c42b99b8807b2392466bed814bf15 Mon Sep 17 00:00:00 2001 From: Satoshi Qazi Muhammed Date: Sat, 10 Oct 2026 02:00:36 +0400 Subject: [PATCH] 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). --- package.json | 2 +- packages/apps-config/src/api/spec/acala.ts | 1 - packages/apps-config/src/api/spec/ajuna.ts | 1 - packages/apps-config/src/api/spec/apron.ts | 1 - packages/apps-config/src/api/spec/bajun.ts | 1 - .../apps-config/src/api/spec/coinversation.ts | 1 - .../apps-config/src/api/spec/contracts.ts | 1 - packages/apps-config/src/api/spec/crust.ts | 1 - .../src/api/spec/cumulus-test-parachain.ts | 1 - packages/apps-config/src/api/spec/fantour.ts | 1 - packages/apps-config/src/api/spec/heima.ts | 1 - packages/apps-config/src/api/spec/idavoll.ts | 1 - packages/apps-config/src/api/spec/index.ts | 2 - .../apps-config/src/api/spec/integritee.ts | 1 - packages/apps-config/src/api/spec/interbtc.ts | 3 - packages/apps-config/src/api/spec/konomi.ts | 1 - packages/apps-config/src/api/spec/kpron.ts | 1 - packages/apps-config/src/api/spec/laminar.ts | 1 - packages/apps-config/src/api/spec/mangata.ts | 3 - packages/apps-config/src/api/spec/muse.ts | 1 - packages/apps-config/src/api/spec/mythos.ts | 1 - packages/apps-config/src/api/spec/neuroweb.ts | 1 - packages/apps-config/src/api/spec/nftmart.ts | 1 - packages/apps-config/src/api/spec/oak.ts | 1 - .../apps-config/src/api/spec/oz-template.ts | 1 - packages/apps-config/src/api/spec/parallel.ts | 1 - packages/apps-config/src/api/spec/parami.ts | 1 - packages/apps-config/src/api/spec/phoenix.ts | 1 - packages/apps-config/src/api/spec/plasm.ts | 1 - packages/apps-config/src/api/spec/polimec.ts | 1 - packages/apps-config/src/api/spec/prism.ts | 1 - .../apps-config/src/api/spec/spreehafen.ts | 1 - packages/apps-config/src/api/spec/stafi.ts | 1 - packages/apps-config/src/api/spec/subdao.ts | 1 - packages/apps-config/src/api/spec/subspace.ts | 2 - .../src/api/spec/substrateContractsNode.ts | 1 - .../apps-config/src/api/spec/tanganika.ts | 1 - .../apps-config/src/api/spec/trustbase.ts | 1 - packages/apps-config/src/api/spec/turing.ts | 1 - .../apps-config/src/api/spec/unitnetwork.ts | 1 - packages/apps-config/src/api/spec/unitv.ts | 1 - packages/apps-config/src/api/spec/vodka.ts | 1 - packages/apps-config/src/api/spec/watr.ts | 1 - .../apps-config/src/api/typesBundle.spec.ts | 4 +- packages/apps-config/src/api/typesBundle.ts | 4 +- .../apps-config/src/ci/chainEndpoints.spec.ts | 2 +- .../apps-config/src/endpoints/development.ts | 1 - packages/apps-config/src/endpoints/index.ts | 11 +- packages/apps-routing/src/democracy.ts | 1 - packages/apps-routing/src/staking.ts | 2 - packages/apps-routing/src/staking2.ts | 2 - packages/apps/package.json | 2 +- .../apps/src/Content/BrowserCheckAlert.tsx | 2 +- packages/apps/src/Endpoints/Group.tsx | 2 +- packages/apps/src/Endpoints/index.tsx | 6 +- packages/apps/src/Endpoints/types.ts | 2 +- packages/apps/src/Endpoints/utils.ts | 2 +- .../page-accounts/src/Accounts/Account.tsx | 2 +- .../src/Accounts/useMultisigApprovals.ts | 22 +- .../page-accounts/src/Accounts/useProxies.ts | 3 +- packages/page-accounts/src/modals/Backup.tsx | 2 +- packages/page-accounts/src/modals/Create.tsx | 2 +- .../page-accounts/src/modals/ExportAll.tsx | 4 +- .../src/modals/ExternalWarning.tsx | 2 +- .../page-accounts/src/modals/IdentityMain.tsx | 12 +- .../page-accounts/src/modals/ImportAll.tsx | 2 +- packages/page-accounts/src/modals/Ledger.tsx | 2 +- .../src/modals/MultisigApprove.tsx | 2 - .../src/modals/ProxyOverview.tsx | 2 +- packages/page-accounts/src/util.tsx | 2 +- .../page-addresses/src/Contacts/Export.tsx | 2 +- .../page-addresses/src/Contacts/Import.tsx | 2 +- packages/page-addresses/src/Contacts/types.ts | 2 +- packages/page-alliance/src/useMemberInfo.ts | 2 +- packages/page-assets/src/Balances/Asset.tsx | 2 +- packages/page-assets/src/Balances/index.tsx | 3 +- .../page-assets/src/Overview/Mint/Mint.tsx | 2 +- packages/page-assets/src/Overview/Query.tsx | 2 +- packages/page-assets/src/index.tsx | 2 +- .../page-assets/src/useForeignAssetInfos.ts | 2 +- packages/page-bounties/src/Bounties.spec.ts | 4 +- .../src/BountyExtraActions/index.tsx | 4 +- .../helpers/determineUnassignCuratorAction.ts | 2 +- packages/page-bounties/src/types.ts | 2 +- .../page-bounties/test/pages/bountiesPage.tsx | 4 +- packages/page-broker/src/Overview/Filters.tsx | 4 +- .../src/Overview/Summary/RegionLength.tsx | 2 +- .../page-broker/src/Overview/Workload.tsx | 4 +- packages/page-broker/src/Overview/index.tsx | 4 +- packages/page-calendar/src/DayItem.tsx | 2 +- packages/page-calendar/src/types.ts | 2 +- packages/page-claims/src/Warning.tsx | 2 +- packages/page-claims/src/index.tsx | 4 +- .../src/react-copy-to-clipboard.d.ts | 2 +- packages/page-contracts/src/Codes/Code.tsx | 2 +- packages/page-contracts/src/Codes/Upload.tsx | 1 - .../page-contracts/src/Codes/ValidateCode.tsx | 2 - .../page-contracts/src/Contracts/Call.tsx | 4 +- .../page-contracts/src/Contracts/Deploy.tsx | 2 +- packages/page-contracts/src/RemoveABI.tsx | 2 +- .../page-contracts/src/shared/Message.tsx | 2 +- .../page-contracts/src/shared/Messages.tsx | 2 +- packages/page-contracts/src/store.ts | 4 +- packages/page-contracts/src/useWeight.ts | 6 +- .../src/Overview/filters/useSearchFilter.tsx | 4 +- .../src/Sale/SaleDetailsView.tsx | 4 +- packages/page-coretime/src/types.ts | 2 +- packages/page-coretime/src/utils/index.ts | 4 +- packages/page-coretime/src/utils/sale.ts | 2 +- .../src/Motions/ProposeExternal.tsx | 1 - packages/page-council/src/Overview/Vote.tsx | 4 +- packages/page-explorer/src/BlockHeader.tsx | 2 +- .../page-explorer/src/BlockInfo/ByHash.tsx | 10 +- packages/page-explorer/src/Events.tsx | 6 +- packages/page-explorer/src/Forks.tsx | 6 +- packages/page-files/src/CrustFiles.tsx | 11 +- packages/page-files/src/UploadModal.tsx | 11 +- packages/page-js/src/Playground.tsx | 7 +- packages/page-nfts/src/AccountItems/index.tsx | 4 +- packages/page-nfts/src/index.tsx | 2 +- packages/page-nfts/src/useCollectionInfos.ts | 2 +- packages/page-poll/src/index.tsx | 2 +- .../page-preimages/src/Preimages/Call.tsx | 4 +- .../src/Preimages/userPreimages/Preimage.tsx | 2 +- packages/page-ranked/src/useMembers.ts | 2 +- .../page-referenda/src/Referenda/Group.tsx | 27 +- .../src/Referenda/Submit/useTrackOptions.tsx | 3 +- .../src/Referenda/Vote/index.tsx | 3 +- .../page-referenda/src/Referenda/useVotes.ts | 2 +- packages/page-referenda/src/types.ts | 2 +- .../page-referenda/src/useAccountLocks.ts | 2 +- packages/page-referenda/src/useReferenda.ts | 4 +- packages/page-referenda/src/useSummary.ts | 2 +- packages/page-settings/src/Developer.tsx | 2 +- packages/page-settings/src/I18n/index.tsx | 2 +- .../src/Metadata/NetworkSpecs.tsx | 2 +- packages/page-settings/src/useRawMetadata.ts | 12 +- packages/page-settings/src/util.tsx | 1 - packages/page-signing/src/Sign.tsx | 2 +- packages/page-signing/src/Unlock.tsx | 2 +- .../page-society/src/Overview/Summary.tsx | 2 +- .../src/Actions/Account/InjectKeys.tsx | 1 - .../src/Actions/Account/WarnBond.tsx | 2 +- .../src/Actions/Account/index.tsx | 2 +- .../src/Actions/Pool/useAccountInfo.ts | 3 +- .../src/Actions/partials/Validate.tsx | 1 - .../src/Actions/useInactives.ts | 4 +- .../src/Actions/useUnbondDuration.ts | 2 +- .../src/CommandCenter/ah.tsx | 4 +- .../src/CommandCenter/index.tsx | 13 +- .../src/Validators/Address/StakeOther.tsx | 2 +- .../src/Validators/StakingAsyncOverview.tsx | 6 +- .../src/Validators/Summary.tsx | 1 - .../src/Validators/index.tsx | 2 +- .../src/Actions/Account/InjectKeys.tsx | 1 - .../src/Actions/Account/WarnBond.tsx | 2 +- .../src/Actions/Account/index.tsx | 2 +- .../src/Actions/Pool/useAccountInfo.ts | 3 +- .../src/Actions/partials/Validate.tsx | 1 - .../src/Actions/useInactives.ts | 2 +- .../src/Actions/useUnbondDuration.ts | 2 +- packages/page-staking-legacy/src/Bags/Bag.tsx | 2 +- .../src/Bags/useBagEntries.tsx | 2 +- .../src/Bags/useBagsList.ts | 2 +- .../src/Payouts/useEraBlocks.ts | 2 +- .../src/Query/useBlockCounts.tsx | 2 +- .../page-staking-legacy/src/Slashes/Row.tsx | 2 +- .../page-staking-legacy/src/Targets/index.tsx | 3 +- .../src/Validators/Address/StakeOther.tsx | 2 +- .../src/Validators/index.tsx | 2 +- .../src/useSortedTargets.ts | 6 +- .../src/Actions/Account/InjectKeys.tsx | 1 - .../src/Actions/Account/WarnBond.tsx | 2 +- .../src/Actions/Account/index.tsx | 2 +- .../src/Actions/Pool/useAccountInfo.ts | 3 +- .../src/Actions/partials/Validate.tsx | 1 - .../page-staking/src/Actions/useInactives.ts | 14 +- .../src/Actions/useUnbondDuration.ts | 2 +- packages/page-staking/src/Bags/Bag.tsx | 2 +- .../page-staking/src/Bags/useBagEntries.tsx | 2 +- packages/page-staking/src/Bags/useBagsList.ts | 2 +- .../page-staking/src/Payouts/useEraBlocks.ts | 2 +- .../page-staking/src/Query/useBlockCounts.tsx | 2 +- packages/page-staking/src/Slashes/Row.tsx | 2 +- packages/page-staking/src/Targets/index.tsx | 3 +- .../src/Validators/Address/StakeOther.tsx | 2 +- .../page-staking/src/Validators/index.tsx | 2 +- packages/page-staking/src/useSortedTargets.ts | 6 +- .../src/Validators/Active/Status.tsx | 2 +- packages/page-storage/src/Query.tsx | 15 +- .../page-storage/src/Selection/Modules.tsx | 4 +- .../src/Crowdloan/Contribute.tsx | 2 +- .../page-teyrchains/src/Crowdloan/Fund.tsx | 2 +- .../src/Overview/Teyrchain.tsx | 2 +- .../page-teyrchains/src/Overview/useEvents.ts | 2 +- .../src/Overview/useValidators.ts | 2 +- .../src/Parathreads/DeregisterId.tsx | 2 +- .../src/Parathreads/RegisterThread.tsx | 2 +- .../src/Proposals/useProposal.ts | 2 +- packages/page-teyrchains/src/Teleport.tsx | 6 +- packages/page-teyrchains/src/useFunds.ts | 2 +- packages/react-api/src/Api.tsx | 2 - packages/react-api/src/hoc/api.tsx | 1 - packages/react-api/src/hoc/call.tsx | 6 - packages/react-api/src/hoc/callDiv.tsx | 2 - packages/react-api/src/hoc/observable.tsx | 1 - packages/react-api/src/hoc/onlyOn.tsx | 1 - packages/react-api/src/util/getEnvironment.ts | 2 +- .../src/AccountSidebar/AccountMenuButtons.tsx | 4 +- .../src/AccountSidebar/Identity.tsx | 4 +- .../src/AccountSidebar/UserIcon.tsx | 1 - packages/react-components/src/AddressInfo.tsx | 2 +- .../react-components/src/AddressToggle.tsx | 2 +- .../react-components/src/Chart/HorizBar.tsx | 2 - packages/react-components/src/Chart/Line.tsx | 1 - packages/react-components/src/Checkbox.tsx | 2 +- .../src/ConvictionDropdown.tsx | 2 +- packages/react-components/src/CopyButton.tsx | 2 +- .../react-components/src/DemocracyLocks.tsx | 2 +- packages/react-components/src/Dropdown.tsx | 6 +- packages/react-components/src/Editor.tsx | 6 +- .../react-components/src/ErrorBoundary.tsx | 2 +- packages/react-components/src/Expander.tsx | 2 +- .../src/IdentityIcon/index.tsx | 1 - packages/react-components/src/Input.tsx | 16 +- .../src/InputAddress/index.tsx | 2 +- .../src/InputAddressSimple.tsx | 2 +- .../react-components/src/InputCalls/index.tsx | 2 +- .../src/InputConsts/index.tsx | 2 +- .../src/InputConsts/options/key.tsx | 2 +- .../src/InputExtrinsic/index.tsx | 2 +- packages/react-components/src/InputFile.tsx | 2 +- packages/react-components/src/InputNumber.tsx | 2 +- .../react-components/src/InputRpc/index.tsx | 2 +- .../src/InputStorage/SelectKey.tsx | 1 - .../src/InputStorage/index.tsx | 2 +- packages/react-components/src/InputTags.tsx | 2 +- packages/react-components/src/Modal/index.tsx | 2 +- packages/react-components/src/ParaLink.tsx | 4 +- packages/react-components/src/Popup/types.ts | 4 +- packages/react-components/src/Row.tsx | 2 +- packages/react-components/src/Tags.tsx | 4 +- packages/react-components/src/TextArea.tsx | 2 +- packages/react-components/src/Toggle.tsx | 2 +- packages/react-components/src/TxButton.tsx | 8 +- packages/react-components/src/index.ts | 1 - .../src/react-copy-to-clipboard.d.ts | 2 +- packages/react-components/src/types.ts | 2 +- packages/react-hooks/src/constants.ts | 4 +- packages/react-hooks/src/createNamedHook.ts | 3 +- packages/react-hooks/src/ctx/Keyring.tsx | 2 +- packages/react-hooks/src/ctx/Queue.tsx | 2 +- packages/react-hooks/src/ctx/StakingAsync.tsx | 4 +- packages/react-hooks/src/ctx/types.ts | 2 +- packages/react-hooks/src/types.ts | 5 +- packages/react-hooks/src/useAccountId.ts | 2 +- .../react-hooks/src/useAvailableSlashes.ts | 2 +- .../src/useBrokerPotentialRenewals.ts | 2 +- .../react-hooks/src/useCoretimeEndpoint.ts | 2 +- packages/react-hooks/src/useEndpoint.ts | 2 +- packages/react-hooks/src/useIncrement.ts | 2 +- packages/react-hooks/src/useIpfs.ts | 2 +- packages/react-hooks/src/useLedger.ts | 2 +- packages/react-hooks/src/useMapEntries.ts | 2 +- packages/react-hooks/src/useMapKeys.ts | 2 +- packages/react-hooks/src/useMemoValue.ts | 2 +- packages/react-hooks/src/useMetadataFetch.ts | 4 +- packages/react-hooks/src/useModal.ts | 4 +- packages/react-hooks/src/useOutsideClick.ts | 3 +- packages/react-hooks/src/useOwnStashInfos.ts | 2 +- packages/react-hooks/src/useParaEndpoints.ts | 2 +- packages/react-hooks/src/usePeopleEndpoint.ts | 2 +- packages/react-hooks/src/usePreimage.ts | 4 +- packages/react-hooks/src/useTeleport.ts | 2 +- packages/react-hooks/src/useToggle.ts | 2 +- packages/react-hooks/src/useTreasury.ts | 2 +- packages/react-hooks/src/useTxBatch.ts | 2 +- packages/react-hooks/src/useWeight.ts | 1 - packages/react-params/src/Extra/Extrinsic.tsx | 2 +- .../react-params/src/Extra/OpaqueCall.tsx | 2 +- packages/react-params/src/Extra/Proposal.tsx | 2 +- packages/react-params/src/Named/Call.tsx | 1 - packages/react-params/src/Named/Extrinsic.tsx | 4 +- packages/react-params/src/Param/Account.tsx | 2 +- packages/react-params/src/Param/Amount.tsx | 2 +- packages/react-params/src/Param/BTreeMap.tsx | 2 +- packages/react-params/src/Param/Balance.tsx | 2 +- packages/react-params/src/Param/BaseBytes.tsx | 2 +- .../src/Param/BasicAccountIdBase.tsx | 2 +- packages/react-params/src/Param/Bool.tsx | 2 +- packages/react-params/src/Param/Bytes.tsx | 2 +- packages/react-params/src/Param/Cid.tsx | 2 +- packages/react-params/src/Param/Code.tsx | 2 +- packages/react-params/src/Param/Enum.tsx | 2 +- packages/react-params/src/Param/Hash256.tsx | 2 +- packages/react-params/src/Param/KeyValue.tsx | 4 +- .../react-params/src/Param/KeyValueArray.tsx | 2 +- packages/react-params/src/Param/Moment.tsx | 2 +- packages/react-params/src/Param/Null.tsx | 2 +- packages/react-params/src/Param/Option.tsx | 4 +- packages/react-params/src/Param/Raw.tsx | 2 +- packages/react-params/src/Param/Struct.tsx | 2 +- packages/react-params/src/Param/Text.tsx | 2 +- packages/react-params/src/Param/Tuple.tsx | 2 +- packages/react-params/src/Param/Vector.tsx | 2 +- .../react-params/src/Param/VectorFixed.tsx | 2 +- .../react-params/src/Param/VoteThreshold.tsx | 3 +- .../react-params/src/Param/findComponent.ts | 3 +- packages/react-params/src/index.tsx | 4 +- packages/react-params/src/types.ts | 1 - packages/react-params/src/valueToText.tsx | 2 - packages/react-query/src/CoreDescriptor.tsx | 29 - packages/react-query/src/FormatBalance.tsx | 2 +- packages/react-signer/src/PaymentInfo.tsx | 5 +- packages/react-signer/src/TxSigned.tsx | 11 +- packages/react-signer/src/TxUnsigned.tsx | 4 +- packages/react-signer/src/index.tsx | 1 - .../react-signer/src/signers/LedgerSigner.ts | 2 +- .../src/api/createAugmentedApi.ts | 2 +- packages/test-support/src/creation/staking.ts | 1 - packages/test-support/src/pages/Page.tsx | 3 +- packages/test-support/src/react/apiInTests.ts | 3 +- packages/test-support/src/types.ts | 2 +- .../test-support/src/utils/accountDefaults.ts | 2 +- yarn.lock | 5550 ++++++++--------- 325 files changed, 2942 insertions(+), 3531 deletions(-) delete mode 100644 packages/react-query/src/CoreDescriptor.tsx diff --git a/package.json b/package.json index fb03013..bf7e9a3 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "test:skipped": "echo 'tests skipped'" }, "devDependencies": { - "@pezkuwi/dev": "^0.85.12", + "@pezkuwi/dev": "^0.86.4", "@pezkuwi/extension-dapp": "^0.62.27", "@pezkuwi/extension-inject": "^0.62.27", "@types/chart.js": "^2.9.41", diff --git a/packages/apps-config/src/api/spec/acala.ts b/packages/apps-config/src/api/spec/acala.ts index ecfe02a..555c159 100644 --- a/packages/apps-config/src/api/spec/acala.ts +++ b/packages/apps-config/src/api/spec/acala.ts @@ -6,5 +6,4 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; import { typesBundleForPolkadot as typesBundleForPezkuwi } from '@acala-network/type-definitions'; // External package types, cast to proper type for compatibility -// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access export default ((typesBundleForPezkuwi as Record).spec || {}) as Record; diff --git a/packages/apps-config/src/api/spec/ajuna.ts b/packages/apps-config/src/api/spec/ajuna.ts index 92422fe..3495bac 100644 --- a/packages/apps-config/src/api/spec/ajuna.ts +++ b/packages/apps-config/src/api/spec/ajuna.ts @@ -3,7 +3,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ { diff --git a/packages/apps-config/src/api/spec/apron.ts b/packages/apps-config/src/api/spec/apron.ts index 7f746ab..3c548dc 100644 --- a/packages/apps-config/src/api/spec/apron.ts +++ b/packages/apps-config/src/api/spec/apron.ts @@ -4,7 +4,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; // structs need to be in order -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ diff --git a/packages/apps-config/src/api/spec/bajun.ts b/packages/apps-config/src/api/spec/bajun.ts index 92422fe..3495bac 100644 --- a/packages/apps-config/src/api/spec/bajun.ts +++ b/packages/apps-config/src/api/spec/bajun.ts @@ -3,7 +3,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ { diff --git a/packages/apps-config/src/api/spec/coinversation.ts b/packages/apps-config/src/api/spec/coinversation.ts index 7f746ab..3c548dc 100644 --- a/packages/apps-config/src/api/spec/coinversation.ts +++ b/packages/apps-config/src/api/spec/coinversation.ts @@ -4,7 +4,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; // structs need to be in order -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ diff --git a/packages/apps-config/src/api/spec/contracts.ts b/packages/apps-config/src/api/spec/contracts.ts index b9c5974..9e8efe7 100644 --- a/packages/apps-config/src/api/spec/contracts.ts +++ b/packages/apps-config/src/api/spec/contracts.ts @@ -4,7 +4,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; // structs need to be in order -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ diff --git a/packages/apps-config/src/api/spec/crust.ts b/packages/apps-config/src/api/spec/crust.ts index 08933ab..9945fba 100644 --- a/packages/apps-config/src/api/spec/crust.ts +++ b/packages/apps-config/src/api/spec/crust.ts @@ -5,5 +5,4 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; import { typesBundleForPolkadot as typesBundleForPezkuwi } from '@crustio/type-definitions'; -// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access export default (typesBundleForPezkuwi as Record>).spec.crust as OverrideBundleDefinition; diff --git a/packages/apps-config/src/api/spec/cumulus-test-parachain.ts b/packages/apps-config/src/api/spec/cumulus-test-parachain.ts index 7f746ab..3c548dc 100644 --- a/packages/apps-config/src/api/spec/cumulus-test-parachain.ts +++ b/packages/apps-config/src/api/spec/cumulus-test-parachain.ts @@ -4,7 +4,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; // structs need to be in order -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ diff --git a/packages/apps-config/src/api/spec/fantour.ts b/packages/apps-config/src/api/spec/fantour.ts index 3b9bf63..c1d12af 100644 --- a/packages/apps-config/src/api/spec/fantour.ts +++ b/packages/apps-config/src/api/spec/fantour.ts @@ -3,7 +3,6 @@ // structs need to be in order /* eslint-disable sort-keys */ -/* eslint-disable camelcase */ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; diff --git a/packages/apps-config/src/api/spec/heima.ts b/packages/apps-config/src/api/spec/heima.ts index 7f746ab..3c548dc 100644 --- a/packages/apps-config/src/api/spec/heima.ts +++ b/packages/apps-config/src/api/spec/heima.ts @@ -4,7 +4,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; // structs need to be in order -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ diff --git a/packages/apps-config/src/api/spec/idavoll.ts b/packages/apps-config/src/api/spec/idavoll.ts index 7f746ab..3c548dc 100644 --- a/packages/apps-config/src/api/spec/idavoll.ts +++ b/packages/apps-config/src/api/spec/idavoll.ts @@ -4,7 +4,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; // structs need to be in order -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ diff --git a/packages/apps-config/src/api/spec/index.ts b/packages/apps-config/src/api/spec/index.ts index 4845c08..0cdd7f5 100644 --- a/packages/apps-config/src/api/spec/index.ts +++ b/packages/apps-config/src/api/spec/index.ts @@ -1,8 +1,6 @@ // Copyright 2017-2026 @pezkuwi/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 -/* eslint-disable @typescript-eslint/no-unsafe-assignment */ - import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; import acala from './acala.js'; diff --git a/packages/apps-config/src/api/spec/integritee.ts b/packages/apps-config/src/api/spec/integritee.ts index c7ccb33..22528a8 100644 --- a/packages/apps-config/src/api/spec/integritee.ts +++ b/packages/apps-config/src/api/spec/integritee.ts @@ -4,7 +4,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; // structs need to be in order -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ diff --git a/packages/apps-config/src/api/spec/interbtc.ts b/packages/apps-config/src/api/spec/interbtc.ts index 3135ba8..31d86af 100644 --- a/packages/apps-config/src/api/spec/interbtc.ts +++ b/packages/apps-config/src/api/spec/interbtc.ts @@ -1,8 +1,6 @@ // Copyright 2017-2026 @pezkuwi/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 -/* eslint-disable @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment */ - import type { Observable } from 'rxjs'; import type { ApiInterfaceRx } from '@pezkuwi/api/types'; import type { DeriveBalancesAll } from '@pezkuwi/api-derive/types'; @@ -21,7 +19,6 @@ function balanceOf (number: number | string): U128 { } function defaultAccountBalance (): DeriveBalancesAll { - // eslint-disable-next-line @typescript-eslint/no-unsafe-return return { accountNonce: new BN(1), additional: [], diff --git a/packages/apps-config/src/api/spec/konomi.ts b/packages/apps-config/src/api/spec/konomi.ts index 7f746ab..3c548dc 100644 --- a/packages/apps-config/src/api/spec/konomi.ts +++ b/packages/apps-config/src/api/spec/konomi.ts @@ -4,7 +4,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; // structs need to be in order -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ diff --git a/packages/apps-config/src/api/spec/kpron.ts b/packages/apps-config/src/api/spec/kpron.ts index 7f746ab..3c548dc 100644 --- a/packages/apps-config/src/api/spec/kpron.ts +++ b/packages/apps-config/src/api/spec/kpron.ts @@ -4,7 +4,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; // structs need to be in order -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ diff --git a/packages/apps-config/src/api/spec/laminar.ts b/packages/apps-config/src/api/spec/laminar.ts index 374724e..6a26147 100644 --- a/packages/apps-config/src/api/spec/laminar.ts +++ b/packages/apps-config/src/api/spec/laminar.ts @@ -5,5 +5,4 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; import { typesBundleForPolkadot as typesBundleForPezkuwi } from '@laminar/type-definitions'; -// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access export default (typesBundleForPezkuwi as Record>).spec.laminar as OverrideBundleDefinition; diff --git a/packages/apps-config/src/api/spec/mangata.ts b/packages/apps-config/src/api/spec/mangata.ts index 2e9a887..77193e6 100644 --- a/packages/apps-config/src/api/spec/mangata.ts +++ b/packages/apps-config/src/api/spec/mangata.ts @@ -2,7 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // structs need to be in order -/* eslint-disable sort-keys, @typescript-eslint/no-unsafe-assignment */ import type { Observable } from 'rxjs'; import type { ApiInterfaceRx } from '@pezkuwi/api/types'; @@ -22,7 +21,6 @@ function balanceOf (number: number | string): U128 { } function defaultAccountBalance (): DeriveBalancesAll { - // eslint-disable-next-line @typescript-eslint/no-unsafe-return return { accountNonce: new BN(1), additional: [], @@ -54,7 +52,6 @@ export function getBalance ( return { ...defaultAccountBalance(), accountId: api.registry.createType('AccountId', account), - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access accountNonce: systemAccount.nonce, availableBalance: api.registry.createType('Balance', data.free.sub(data.frozen)), freeBalance: data.free, diff --git a/packages/apps-config/src/api/spec/muse.ts b/packages/apps-config/src/api/spec/muse.ts index 2311e65..6f932eb 100644 --- a/packages/apps-config/src/api/spec/muse.ts +++ b/packages/apps-config/src/api/spec/muse.ts @@ -4,7 +4,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; // structs need to be in order -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ diff --git a/packages/apps-config/src/api/spec/mythos.ts b/packages/apps-config/src/api/spec/mythos.ts index 2311e65..6f932eb 100644 --- a/packages/apps-config/src/api/spec/mythos.ts +++ b/packages/apps-config/src/api/spec/mythos.ts @@ -4,7 +4,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; // structs need to be in order -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ diff --git a/packages/apps-config/src/api/spec/neuroweb.ts b/packages/apps-config/src/api/spec/neuroweb.ts index 7f746ab..3c548dc 100644 --- a/packages/apps-config/src/api/spec/neuroweb.ts +++ b/packages/apps-config/src/api/spec/neuroweb.ts @@ -4,7 +4,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; // structs need to be in order -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ diff --git a/packages/apps-config/src/api/spec/nftmart.ts b/packages/apps-config/src/api/spec/nftmart.ts index 454cc40..f1725da 100644 --- a/packages/apps-config/src/api/spec/nftmart.ts +++ b/packages/apps-config/src/api/spec/nftmart.ts @@ -3,7 +3,6 @@ // structs need to be in order /* eslint-disable sort-keys */ -/* eslint-disable camelcase */ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; diff --git a/packages/apps-config/src/api/spec/oak.ts b/packages/apps-config/src/api/spec/oak.ts index c9e22fc..f7c1fb9 100644 --- a/packages/apps-config/src/api/spec/oak.ts +++ b/packages/apps-config/src/api/spec/oak.ts @@ -4,7 +4,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; // structs need to be in order -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ diff --git a/packages/apps-config/src/api/spec/oz-template.ts b/packages/apps-config/src/api/spec/oz-template.ts index 7f746ab..3c548dc 100644 --- a/packages/apps-config/src/api/spec/oz-template.ts +++ b/packages/apps-config/src/api/spec/oz-template.ts @@ -4,7 +4,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; // structs need to be in order -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ diff --git a/packages/apps-config/src/api/spec/parallel.ts b/packages/apps-config/src/api/spec/parallel.ts index 59c5566..6b7ba89 100644 --- a/packages/apps-config/src/api/spec/parallel.ts +++ b/packages/apps-config/src/api/spec/parallel.ts @@ -6,5 +6,4 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; import { typesBundleForPolkadot as typesBundleForPezkuwi } from '@parallel-finance/type-definitions'; // External package types, cast to proper type for compatibility -// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access export default ((typesBundleForPezkuwi as Record).spec || {}) as Record; diff --git a/packages/apps-config/src/api/spec/parami.ts b/packages/apps-config/src/api/spec/parami.ts index c9e22fc..f7c1fb9 100644 --- a/packages/apps-config/src/api/spec/parami.ts +++ b/packages/apps-config/src/api/spec/parami.ts @@ -4,7 +4,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; // structs need to be in order -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ diff --git a/packages/apps-config/src/api/spec/phoenix.ts b/packages/apps-config/src/api/spec/phoenix.ts index 2899926..8725ed7 100644 --- a/packages/apps-config/src/api/spec/phoenix.ts +++ b/packages/apps-config/src/api/spec/phoenix.ts @@ -4,7 +4,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; // structs need to be in order -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ diff --git a/packages/apps-config/src/api/spec/plasm.ts b/packages/apps-config/src/api/spec/plasm.ts index bf3e07e..3660445 100644 --- a/packages/apps-config/src/api/spec/plasm.ts +++ b/packages/apps-config/src/api/spec/plasm.ts @@ -4,7 +4,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; // structs need to be in order -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ diff --git a/packages/apps-config/src/api/spec/polimec.ts b/packages/apps-config/src/api/spec/polimec.ts index 7f746ab..3c548dc 100644 --- a/packages/apps-config/src/api/spec/polimec.ts +++ b/packages/apps-config/src/api/spec/polimec.ts @@ -4,7 +4,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; // structs need to be in order -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ diff --git a/packages/apps-config/src/api/spec/prism.ts b/packages/apps-config/src/api/spec/prism.ts index 7f746ab..3c548dc 100644 --- a/packages/apps-config/src/api/spec/prism.ts +++ b/packages/apps-config/src/api/spec/prism.ts @@ -4,7 +4,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; // structs need to be in order -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ diff --git a/packages/apps-config/src/api/spec/spreehafen.ts b/packages/apps-config/src/api/spec/spreehafen.ts index c9e22fc..f7c1fb9 100644 --- a/packages/apps-config/src/api/spec/spreehafen.ts +++ b/packages/apps-config/src/api/spec/spreehafen.ts @@ -4,7 +4,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; // structs need to be in order -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ diff --git a/packages/apps-config/src/api/spec/stafi.ts b/packages/apps-config/src/api/spec/stafi.ts index 3d076e6..c3f8554 100644 --- a/packages/apps-config/src/api/spec/stafi.ts +++ b/packages/apps-config/src/api/spec/stafi.ts @@ -4,7 +4,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; // structs need to be in order -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ diff --git a/packages/apps-config/src/api/spec/subdao.ts b/packages/apps-config/src/api/spec/subdao.ts index c9e22fc..f7c1fb9 100644 --- a/packages/apps-config/src/api/spec/subdao.ts +++ b/packages/apps-config/src/api/spec/subdao.ts @@ -4,7 +4,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; // structs need to be in order -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ diff --git a/packages/apps-config/src/api/spec/subspace.ts b/packages/apps-config/src/api/spec/subspace.ts index d97e7ba..8be5a0f 100644 --- a/packages/apps-config/src/api/spec/subspace.ts +++ b/packages/apps-config/src/api/spec/subspace.ts @@ -2,7 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 // structs need to be in order -/* eslint-disable sort-keys */ import type { Observable } from 'rxjs'; import type { ApiInterfaceRx } from '@pezkuwi/api/types'; @@ -52,7 +51,6 @@ function createHeaderExtended ( api: ApiInterfaceRx ): HeaderExtended { // HeaderBase is dynamically created at runtime, so we need type assertions - // eslint-disable-next-line @typescript-eslint/no-explicit-any const HeaderBase = registry.createClass('Header') as any; class SubHeaderExtended extends HeaderBase { diff --git a/packages/apps-config/src/api/spec/substrateContractsNode.ts b/packages/apps-config/src/api/spec/substrateContractsNode.ts index 61c712d..3d48699 100644 --- a/packages/apps-config/src/api/spec/substrateContractsNode.ts +++ b/packages/apps-config/src/api/spec/substrateContractsNode.ts @@ -4,7 +4,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; // structs need to be in order -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ diff --git a/packages/apps-config/src/api/spec/tanganika.ts b/packages/apps-config/src/api/spec/tanganika.ts index c9e22fc..f7c1fb9 100644 --- a/packages/apps-config/src/api/spec/tanganika.ts +++ b/packages/apps-config/src/api/spec/tanganika.ts @@ -4,7 +4,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; // structs need to be in order -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ diff --git a/packages/apps-config/src/api/spec/trustbase.ts b/packages/apps-config/src/api/spec/trustbase.ts index 7f746ab..3c548dc 100644 --- a/packages/apps-config/src/api/spec/trustbase.ts +++ b/packages/apps-config/src/api/spec/trustbase.ts @@ -4,7 +4,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; // structs need to be in order -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ diff --git a/packages/apps-config/src/api/spec/turing.ts b/packages/apps-config/src/api/spec/turing.ts index c9e22fc..f7c1fb9 100644 --- a/packages/apps-config/src/api/spec/turing.ts +++ b/packages/apps-config/src/api/spec/turing.ts @@ -4,7 +4,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; // structs need to be in order -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ diff --git a/packages/apps-config/src/api/spec/unitnetwork.ts b/packages/apps-config/src/api/spec/unitnetwork.ts index c9e22fc..f7c1fb9 100644 --- a/packages/apps-config/src/api/spec/unitnetwork.ts +++ b/packages/apps-config/src/api/spec/unitnetwork.ts @@ -4,7 +4,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; // structs need to be in order -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ diff --git a/packages/apps-config/src/api/spec/unitv.ts b/packages/apps-config/src/api/spec/unitv.ts index 3d076e6..c3f8554 100644 --- a/packages/apps-config/src/api/spec/unitv.ts +++ b/packages/apps-config/src/api/spec/unitv.ts @@ -4,7 +4,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; // structs need to be in order -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ diff --git a/packages/apps-config/src/api/spec/vodka.ts b/packages/apps-config/src/api/spec/vodka.ts index 47afd2f..f8b49d7 100644 --- a/packages/apps-config/src/api/spec/vodka.ts +++ b/packages/apps-config/src/api/spec/vodka.ts @@ -4,7 +4,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; // structs need to be in order -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ diff --git a/packages/apps-config/src/api/spec/watr.ts b/packages/apps-config/src/api/spec/watr.ts index 7f746ab..3c548dc 100644 --- a/packages/apps-config/src/api/spec/watr.ts +++ b/packages/apps-config/src/api/spec/watr.ts @@ -4,7 +4,6 @@ import type { OverrideBundleDefinition } from '@pezkuwi/types/types'; // structs need to be in order -/* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ diff --git a/packages/apps-config/src/api/typesBundle.spec.ts b/packages/apps-config/src/api/typesBundle.spec.ts index 4083201..8a9f42e 100644 --- a/packages/apps-config/src/api/typesBundle.spec.ts +++ b/packages/apps-config/src/api/typesBundle.spec.ts @@ -27,8 +27,8 @@ describe('typesBundle', (): void => { import type { OverrideBundleType } from '@pezkuwi/types/types'; -/* eslint-disable quotes */ -/* eslint-disable quote-props */ +/* eslint-disable @stylistic/quotes */ +/* eslint-disable @stylistic/quote-props */ /* eslint-disable sort-keys */ export const typesBundle = ${JSON.stringify(typesBundle, null, 2)} as unknown as OverrideBundleType; diff --git a/packages/apps-config/src/api/typesBundle.ts b/packages/apps-config/src/api/typesBundle.ts index 852a03b..dc57e42 100644 --- a/packages/apps-config/src/api/typesBundle.ts +++ b/packages/apps-config/src/api/typesBundle.ts @@ -5,8 +5,8 @@ import type { OverrideBundleType } from '@pezkuwi/types/types'; -/* eslint-disable quotes */ -/* eslint-disable quote-props */ +/* eslint-disable @stylistic/quotes */ +/* eslint-disable @stylistic/quote-props */ /* eslint-disable sort-keys */ export const typesBundle = { diff --git a/packages/apps-config/src/ci/chainEndpoints.spec.ts b/packages/apps-config/src/ci/chainEndpoints.spec.ts index d0df637..0f47e28 100644 --- a/packages/apps-config/src/ci/chainEndpoints.spec.ts +++ b/packages/apps-config/src/ci/chainEndpoints.spec.ts @@ -77,7 +77,7 @@ describe('check endpoints', (): void => { assert(result?.startsWith('0x'), 'Invalid/non-hex response'); resolve(result); } catch (e) { - reject(e); + reject(e instanceof Error ? e : new Error(String(e))); } }; diff --git a/packages/apps-config/src/endpoints/development.ts b/packages/apps-config/src/endpoints/development.ts index fd6e216..fa9e283 100644 --- a/packages/apps-config/src/endpoints/development.ts +++ b/packages/apps-config/src/endpoints/development.ts @@ -7,7 +7,6 @@ import type { LinkOption } from './types.js'; export const CUSTOM_ENDPOINT_KEY = 'pezkuwi-app-custom-endpoints'; interface EnvWindow { - // eslint-disable-next-line camelcase process_env?: { WS_URL: string; } diff --git a/packages/apps-config/src/endpoints/index.ts b/packages/apps-config/src/endpoints/index.ts index 585adb8..87029ac 100644 --- a/packages/apps-config/src/endpoints/index.ts +++ b/packages/apps-config/src/endpoints/index.ts @@ -13,10 +13,15 @@ export { CUSTOM_ENDPOINT_KEY } from './development.js'; export * from './production.js'; export * from './testing.js'; -function defaultT (keyOrText: string, text?: string | TOptions, options?: TOptions): string { +function defaultT (keyOrText: string, textOrOptions?: string | TOptions, options?: TOptions): string { + // as TFunction: the second argument is either the default text or the options + const [text, opts] = typeof textOrOptions === 'string' + ? [textOrOptions, options] + : [undefined, textOrOptions]; + return ( - (options?.replace?.host as string) || - text?.toString() || + (opts?.replace?.host as string) || + text || keyOrText ); } diff --git a/packages/apps-routing/src/democracy.ts b/packages/apps-routing/src/democracy.ts index d8a1f10..9ec7db1 100644 --- a/packages/apps-routing/src/democracy.ts +++ b/packages/apps-routing/src/democracy.ts @@ -9,7 +9,6 @@ import Component, { useCounter } from '@pezkuwi/app-democracy'; function needsApiCheck (api: ApiPromise): boolean { try { // we need to be able to create an actual vote - // eslint-disable-next-line @typescript-eslint/no-explicit-any api.tx.democracy.vote(1, { Standard: { balance: 1, vote: { aye: true, conviction: 1 } } } as any); return true; diff --git a/packages/apps-routing/src/staking.ts b/packages/apps-routing/src/staking.ts index e14e8cd..3cd0b3d 100644 --- a/packages/apps-routing/src/staking.ts +++ b/packages/apps-routing/src/staking.ts @@ -19,13 +19,11 @@ function needsApiCheck (api: ApiPromise): boolean { } // we need a known Exposure type - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const { nominatorCount, own, pageCount, total } = api.registry.createType( unwrapStorageType(api.registry, api.query.staking.erasStakersOverview.creator.meta.type), { nominatorCount: BN_ONE, own: BN_ONE, pageCount: BN_ONE, total: BN_ONE } ); - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call assert(total && own && nominatorCount && pageCount && total.eq(BN_ONE) && own.eq(BN_ONE), 'Needs a known Exposure type'); } catch { console.warn('Unable to create known-shape Exposure type, disabling staking route'); diff --git a/packages/apps-routing/src/staking2.ts b/packages/apps-routing/src/staking2.ts index 80ea635..c468df4 100644 --- a/packages/apps-routing/src/staking2.ts +++ b/packages/apps-routing/src/staking2.ts @@ -13,13 +13,11 @@ import { assert, BN_ONE } from '@pezkuwi/util'; function needsApiCheck (api: ApiPromise): boolean { try { // we need a known Exposure type - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const { others: [{ value, who }], own, total } = api.registry.createType( unwrapStorageType(api.registry, api.query.staking.erasStakers.creator.meta.type), { others: [{ value: BN_ONE, who: ZERO_ACCOUNT }], own: BN_ONE, total: BN_ONE } ); - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call assert(total && own && value && who && total.eq(BN_ONE) && own.eq(BN_ONE) && value.eq(BN_ONE), 'Needs a known Exposure type'); } catch { console.warn('Unable to create known-shape Exposure type, disabling staking route'); diff --git a/packages/apps/package.json b/packages/apps/package.json index 5f56baf..4896dd1 100644 --- a/packages/apps/package.json +++ b/packages/apps/package.json @@ -19,7 +19,7 @@ "@acala-network/chopsticks-core": "^1.2.1", "@pezkuwi/apps-config": "^1.0.2-1-x", "@pezkuwi/apps-routing": "^1.0.2-1-x", - "@pezkuwi/dev": "^0.85.2", + "@pezkuwi/dev": "^0.86.4", "@pezkuwi/react-api": "^1.0.2-1-x", "@pezkuwi/react-components": "^1.0.2-1-x", "@pezkuwi/react-hooks": "^1.0.2-1-x", diff --git a/packages/apps/src/Content/BrowserCheckAlert.tsx b/packages/apps/src/Content/BrowserCheckAlert.tsx index 5265b0c..c3718df 100644 --- a/packages/apps/src/Content/BrowserCheckAlert.tsx +++ b/packages/apps/src/Content/BrowserCheckAlert.tsx @@ -12,7 +12,7 @@ const BrowserCheckAlert: React.FC = () => { const ua = navigator.userAgent; // Detect Firefox - const firefoxMatch = ua.match(/Firefox\/(\d+\.\d+)/); + const firefoxMatch = /Firefox\/(\d+\.\d+)/.exec(ua); if (firefoxMatch) { // Check for Firefox 145.0 specifically diff --git a/packages/apps/src/Endpoints/Group.tsx b/packages/apps/src/Endpoints/Group.tsx index fb64e58..33d4f25 100644 --- a/packages/apps/src/Endpoints/Group.tsx +++ b/packages/apps/src/Endpoints/Group.tsx @@ -31,7 +31,7 @@ function GroupDisplay ({ affinities, apiUrl, children, className = '', favoriteC [index, isSelected, setGroup] ); - const isFavoriteHeader = useMemo(() => header?.toString().includes('Favorite'), [header]); + const isFavoriteHeader = useMemo(() => typeof header === 'string' && header.includes('Favorite'), [header]); const filtered = useMemo( () => networks.filter(({ isUnreachable }) => !isUnreachable), diff --git a/packages/apps/src/Endpoints/index.tsx b/packages/apps/src/Endpoints/index.tsx index 0e1aea1..7c339a4 100644 --- a/packages/apps/src/Endpoints/index.tsx +++ b/packages/apps/src/Endpoints/index.tsx @@ -63,9 +63,9 @@ function combineEndpoints (endpoints: LinkOption[]): Group[] { const prov = { isLightClient: e.isLightClient, name: e.textBy, url: e.value }; const isFavorite = isFavoriteChain(favoriteChains, - { chainName: e.text?.toString() ?? '', + { chainName: typeof e.text === 'string' ? e.text : '', paraId: e.paraId, - relay: e.textRelay?.toString() }); + relay: typeof e.textRelay === 'string' ? e.textRelay : undefined }); if (isFavorite && favoriteGroupIndex !== -1 && !e.isUnreachable) { const favGroup = result[favoriteGroupIndex]; @@ -106,7 +106,7 @@ function combineEndpoints (endpoints: LinkOption[]): Group[] { // Swap first two items in `networks` if first item is relay chain combinedEndpoints.forEach((r) => { - if (r.networks.length >= 2 && r.networks[0].isRelay && r.header?.toString().includes('teyrchains')) { + if (r.networks.length >= 2 && r.networks[0].isRelay && typeof r.header === 'string' && r.header.includes('teyrchains')) { [r.networks[0], r.networks[1]] = [r.networks[1], r.networks[0]]; } }); diff --git a/packages/apps/src/Endpoints/types.ts b/packages/apps/src/Endpoints/types.ts index b4c6cc3..4923ab6 100644 --- a/packages/apps/src/Endpoints/types.ts +++ b/packages/apps/src/Endpoints/types.ts @@ -9,7 +9,7 @@ export interface IFavoriteChainProps { paraId?: number; } -export type IFavoriteChainsStorage = Record +export type IFavoriteChainsStorage = Record; export interface Network { isChild?: boolean; diff --git a/packages/apps/src/Endpoints/utils.ts b/packages/apps/src/Endpoints/utils.ts index aabeb75..98ad564 100644 --- a/packages/apps/src/Endpoints/utils.ts +++ b/packages/apps/src/Endpoints/utils.ts @@ -6,7 +6,7 @@ import type { IFavoriteChainProps, IFavoriteChainsStorage } from './types.js'; import { createWsEndpoints } from '@pezkuwi/apps-config'; export const FAVORITE_CHAINS_KEY = 'pezkuwi-app-favorite-chains'; -const chainsConfig = createWsEndpoints((k, v) => v?.toString() || k); +const chainsConfig = createWsEndpoints((k, v) => (typeof v === 'string' && v) || k); export const toggleFavoriteChain = ( chainInfo: IFavoriteChainProps diff --git a/packages/page-accounts/src/Accounts/Account.tsx b/packages/page-accounts/src/Accounts/Account.tsx index 217ec60..f68a007 100644 --- a/packages/page-accounts/src/Accounts/Account.tsx +++ b/packages/page-accounts/src/Accounts/Account.tsx @@ -3,7 +3,7 @@ // This is for the use of `Ledger` // -/* eslint-disable deprecation/deprecation */ +/* eslint-disable @typescript-eslint/no-deprecated */ import type { ApiPromise } from '@pezkuwi/api'; import type { SubmittableExtrinsic } from '@pezkuwi/api/types'; diff --git a/packages/page-accounts/src/Accounts/useMultisigApprovals.ts b/packages/page-accounts/src/Accounts/useMultisigApprovals.ts index 0f84442..06cb8e7 100644 --- a/packages/page-accounts/src/Accounts/useMultisigApprovals.ts +++ b/packages/page-accounts/src/Accounts/useMultisigApprovals.ts @@ -41,16 +41,18 @@ function useMultisigApprovalsImpl (address: string): [H256, Multisig][] | undefi // query all the entries for the multisig, extracting approvals with their hash useEffect((): void => { - trigger && api.query.multisig?.multisigs && api.query.multisig?.multisigs - .entries(address) - .then((infos: [StorageKey, Option][]): void => { - mountedRef.current && setMultiInfos( - infos - .filter(([, opt]) => opt.isSome) - .map(([key, opt]) => [key.args[1] as H256, opt.unwrap()]) - ); - }) - .catch(console.error); + if (trigger) { + api.query.multisig?.multisigs + .entries(address) + .then((infos: [StorageKey, Option][]): void => { + mountedRef.current && setMultiInfos( + infos + .filter(([, opt]) => opt.isSome) + .map(([key, opt]) => [key.args[1] as H256, opt.unwrap()]) + ); + }) + .catch(console.error); + } }, [address, api, mountedRef, trigger]); return multiInfos; diff --git a/packages/page-accounts/src/Accounts/useProxies.ts b/packages/page-accounts/src/Accounts/useProxies.ts index 020bde0..523672f 100644 --- a/packages/page-accounts/src/Accounts/useProxies.ts +++ b/packages/page-accounts/src/Accounts/useProxies.ts @@ -45,7 +45,7 @@ function useProxiesImpl (address?: string | null): State | null { useEffect((): void => { setState(null); - address && + if (address) { api.query.proxy ?.proxies | PezpalletProxyProxyDefinition>, BalanceOf]>>(address) .then(([_proxies]): void => { @@ -65,6 +65,7 @@ function useProxiesImpl (address?: string | null): State | null { }); }) .catch(console.error); + } }, [allAccounts, api, address, mountedRef]); return known; diff --git a/packages/page-accounts/src/modals/Backup.tsx b/packages/page-accounts/src/modals/Backup.tsx index 64a11c6..1c0f7d3 100644 --- a/packages/page-accounts/src/modals/Backup.tsx +++ b/packages/page-accounts/src/modals/Backup.tsx @@ -39,7 +39,7 @@ function Backup ({ address, onClose }: Props): React.ReactElement { const json = addressKeyring && keyring.backupAccount(addressKeyring, password); const blob = new Blob([JSON.stringify(json)], { type: 'application/json; charset=utf-8' }); - // eslint-disable-next-line deprecation/deprecation + // eslint-disable-next-line @typescript-eslint/no-deprecated FileSaver.saveAs(blob, `${address}.json`); } catch (error) { setBackupFailed(true); diff --git a/packages/page-accounts/src/modals/Create.tsx b/packages/page-accounts/src/modals/Create.tsx index 0d698cf..b7abcec 100644 --- a/packages/page-accounts/src/modals/Create.tsx +++ b/packages/page-accounts/src/modals/Create.tsx @@ -106,7 +106,7 @@ function generateSeed (_seed: string | undefined | null, derivePath: string, see function updateAddress (seed: string, derivePath: string, seedType: SeedType, pairType: PairType): AddressState { let address: string | null = null; let deriveValidation: DeriveValidationOutput = deriveValidate(seed, seedType, derivePath, pairType); - let isSeedValid = false; + let isSeedValid: boolean; if (seedType === 'raw') { isSeedValid = rawValidate(seed); diff --git a/packages/page-accounts/src/modals/ExportAll.tsx b/packages/page-accounts/src/modals/ExportAll.tsx index 31dc811..c5e0d09 100644 --- a/packages/page-accounts/src/modals/ExportAll.tsx +++ b/packages/page-accounts/src/modals/ExportAll.tsx @@ -68,7 +68,7 @@ function ExportAll ({ accountsByGroup, className, onClose, onStatusChange }: Pro const blob = new Blob([JSON.stringify(accounts, null, 2)], { type: 'application/json; charset=utf-8' }); - // eslint-disable-next-line deprecation/deprecation + // eslint-disable-next-line @typescript-eslint/no-deprecated FileSaver.saveAs(blob, `batch_exported_accounts_${new Date().getTime()}.json`); status.status = 'success'; @@ -138,7 +138,7 @@ function ExportAll ({ accountsByGroup, className, onClose, onStatusChange }: Pro ); } -const BrowserAccounts = ({ accounts, allPassword, setAllPassword }: {accounts: string[], allPassword: TPassword[], setAllPassword: React.Dispatch>}) => { +const BrowserAccounts = ({ accounts, allPassword, setAllPassword }: { accounts: string[], allPassword: TPassword[], setAllPassword: React.Dispatch> }) => { const { t } = useTranslation(); const _onChangePass = useCallback( diff --git a/packages/page-accounts/src/modals/ExternalWarning.tsx b/packages/page-accounts/src/modals/ExternalWarning.tsx index 32f0449..8aec71c 100644 --- a/packages/page-accounts/src/modals/ExternalWarning.tsx +++ b/packages/page-accounts/src/modals/ExternalWarning.tsx @@ -7,7 +7,7 @@ import { MarkWarning } from '@pezkuwi/react-components'; import { useTranslation } from '../translate.js'; -const isElectron = navigator.userAgent.toLowerCase().indexOf(' electron/') > -1; +const isElectron = navigator.userAgent.toLowerCase().includes(' electron/'); function ExternalWarning (): React.ReactElement | null { const { t } = useTranslation(); diff --git a/packages/page-accounts/src/modals/IdentityMain.tsx b/packages/page-accounts/src/modals/IdentityMain.tsx index 0837430..5c401af 100644 --- a/packages/page-accounts/src/modals/IdentityMain.tsx +++ b/packages/page-accounts/src/modals/IdentityMain.tsx @@ -53,8 +53,8 @@ interface PeopleIdentityInfo extends Struct { const WHITESPACE = [' ', '\t']; function setData (data: Data, setActive: null | ((isActive: boolean) => void), setVal: (val: string) => void): void { - if (data && data.isRaw) { - setActive && setActive(true); + if (data?.isRaw) { + setActive?.(true); setVal(u8aToString(data.asRaw.toU8a(true))); } } @@ -64,7 +64,7 @@ function setAdditionalFieldData (api: ApiPromise, info: IdentityInfo, key: strin const dataNone = api.registry.createType('Data', ''); const value = info.additional.find((v) => v[0].eq(dataKey))?.[1] || dataNone; - if (value && value.isRaw) { + if (value?.isRaw) { setData(value, setActive, setVal); } @@ -73,7 +73,7 @@ function setAdditionalFieldData (api: ApiPromise, info: IdentityInfo, key: strin function setDiscordFieldData (info: PeopleIdentityInfo, setActive: null | ((isActive: boolean) => void), setVal: (val: string) => void): Data { if (info.discord && !info.discord.isNone) { - setActive && setActive(true); + setActive?.(true); setVal(u8aToString(info.discord.asRaw.toU8a(true))); } @@ -124,7 +124,7 @@ function IdentityMain ({ address, className = '', onClose }: Props): React.React const [isPalletChecked, setIsPalletChecked] = useState(false); useEffect((): void => { - if (identityOpt && identityOpt.isSome) { + if (identityOpt?.isSome) { const identity = identityOpt.unwrap(); const foundInfo = Array.isArray(identity) ? identity[0].info : (identity as Registration).info; @@ -150,7 +150,7 @@ function IdentityMain ({ address, className = '', onClose }: Props): React.React : [foundInfo.display, foundInfo.email, (foundInfo as unknown as PeopleIdentityInfo).github, foundInfo.legal, (foundInfo as unknown as PeopleIdentityInfo).matrix, foundInfo.twitter, infoDiscord, foundInfo.web]; previousKeys.some((info: Data | null) => { - if (info && info.isRaw) { + if (info?.isRaw) { setGotPreviousIdentity(true); return true; diff --git a/packages/page-accounts/src/modals/ImportAll.tsx b/packages/page-accounts/src/modals/ImportAll.tsx index 7b794cb..8640767 100644 --- a/packages/page-accounts/src/modals/ImportAll.tsx +++ b/packages/page-accounts/src/modals/ImportAll.tsx @@ -26,7 +26,7 @@ interface TPassword { type FileAccount = (KeyringPair$Json | KeyringPair); -type File = FileAccount[] +type File = FileAccount[]; const acceptedFormats = ['application/json']; diff --git a/packages/page-accounts/src/modals/Ledger.tsx b/packages/page-accounts/src/modals/Ledger.tsx index c618d1e..b026967 100644 --- a/packages/page-accounts/src/modals/Ledger.tsx +++ b/packages/page-accounts/src/modals/Ledger.tsx @@ -3,7 +3,7 @@ // This is for the use of `Ledger` // -/* eslint-disable deprecation/deprecation */ +/* eslint-disable @typescript-eslint/no-deprecated */ import type { ApiPromise } from '@pezkuwi/api'; import type { Ledger, LedgerGeneric } from '@pezkuwi/hw-ledger'; diff --git a/packages/page-accounts/src/modals/MultisigApprove.tsx b/packages/page-accounts/src/modals/MultisigApprove.tsx index cf52c15..bd3a69e 100644 --- a/packages/page-accounts/src/modals/MultisigApprove.tsx +++ b/packages/page-accounts/src/modals/MultisigApprove.tsx @@ -140,7 +140,6 @@ function MultisigApprove ({ className = '', onClose, ongoing, threshold = 0, who ? isMultiCall && isCallOverride ? callData ? multiMod.asMulti.meta.args.length === 5 - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument ? multiMod.asMulti(threshold, others as any, multisig.when, callData.toHex(), weight as any) : multiMod.asMulti.meta.args.length === 6 // eslint-disable-next-line @typescript-eslint/ban-ts-comment @@ -151,7 +150,6 @@ function MultisigApprove ({ className = '', onClose, ongoing, threshold = 0, who : multiMod.asMulti(threshold, others as any, multisig.when, callData) : null : multiMod.approveAsMulti.meta.args.length === 5 - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument ? multiMod.approveAsMulti(threshold, others as any, multisig.when, hash, weight as any) // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore diff --git a/packages/page-accounts/src/modals/ProxyOverview.tsx b/packages/page-accounts/src/modals/ProxyOverview.tsx index ee2a68f..b8c76c2 100644 --- a/packages/page-accounts/src/modals/ProxyOverview.tsx +++ b/packages/page-accounts/src/modals/ProxyOverview.tsx @@ -245,7 +245,7 @@ function ProxyOverview ({ className, onClose, previousProxy: [existing] = EMPTY_ [api] ); - const isSameAdd = added.some(([accountId]) => accountId && accountId.eq(proxiedAccount)); + const isSameAdd = added.some(([accountId]) => accountId?.eq(proxiedAccount)); return ( { const blob = new Blob([JSON.stringify(accounts, null, 2)], { type: 'application/json; charset=utf-8' }); - // eslint-disable-next-line deprecation/deprecation + // eslint-disable-next-line @typescript-eslint/no-deprecated FileSaver.saveAs(blob, `batch_exported_address_book_${new Date().getTime()}.json`); /** ********************* ************** ************************/ diff --git a/packages/page-addresses/src/Contacts/Import.tsx b/packages/page-addresses/src/Contacts/Import.tsx index 55358f2..98c1313 100644 --- a/packages/page-addresses/src/Contacts/Import.tsx +++ b/packages/page-addresses/src/Contacts/Import.tsx @@ -34,7 +34,7 @@ function Import ({ favorites, onStatusChange, toggleFavorite }: Props): React.Re status }); }, - [onStatusChange, t] + [onStatusChange, t] ); const validateAccountInfo = useCallback(({ address: addressInput, name }: SaveFile) => { diff --git a/packages/page-addresses/src/Contacts/types.ts b/packages/page-addresses/src/Contacts/types.ts index f078993..1f018a9 100644 --- a/packages/page-addresses/src/Contacts/types.ts +++ b/packages/page-addresses/src/Contacts/types.ts @@ -7,4 +7,4 @@ export interface SortedAddress { address: string; isFavorite: boolean, isVisible export interface SaveFile { address: string; isFavorite: boolean, name: string } -export type FunInputFile = (e: React.ChangeEvent) => void +export type FunInputFile = (e: React.ChangeEvent) => void; diff --git a/packages/page-alliance/src/useMemberInfo.ts b/packages/page-alliance/src/useMemberInfo.ts index 96b79db..6a04d2b 100644 --- a/packages/page-alliance/src/useMemberInfo.ts +++ b/packages/page-alliance/src/useMemberInfo.ts @@ -18,7 +18,7 @@ function useMemberInfoImpl (accountId: string): MemberInfo | undefined { () => depositOf && { accountId, deposit: depositOf.unwrapOr(null), - isUpForKicking: upForKicking && upForKicking.isTrue, + isUpForKicking: upForKicking?.isTrue, retiringAt: retiringAt?.unwrapOr(null) }, [accountId, depositOf, retiringAt, upForKicking] diff --git a/packages/page-assets/src/Balances/Asset.tsx b/packages/page-assets/src/Balances/Asset.tsx index e85cc2c..af1c8ba 100644 --- a/packages/page-assets/src/Balances/Asset.tsx +++ b/packages/page-assets/src/Balances/Asset.tsx @@ -62,7 +62,7 @@ const BASE_BORDER = 0.125; const BORDER_TOP = `${BASE_BORDER * 3}rem solid var(--bg-page)`; const BORDER_RADIUS = `${BASE_BORDER * 4}rem`; -const StyledTr = styled.tr<{isFirstItem: boolean; isLastItem: boolean}>` +const StyledTr = styled.tr<{ isFirstItem: boolean; isLastItem: boolean }>` td { border-top: ${(props) => props.isFirstItem && BORDER_TOP}; border-radius: 0rem !important; diff --git a/packages/page-assets/src/Balances/index.tsx b/packages/page-assets/src/Balances/index.tsx index 41f50e9..f4ba428 100644 --- a/packages/page-assets/src/Balances/index.tsx +++ b/packages/page-assets/src/Balances/index.tsx @@ -34,8 +34,7 @@ function Balances ({ className, infos = [] }: Props): React.ReactElement const completeAssets = useMemo( () => infos - .filter((i): i is AssetInfoComplete => !!(i.details && i.metadata) && !i.details.supply.isZero()) - , + .filter((i): i is AssetInfoComplete => !!(i.details && i.metadata) && !i.details.supply.isZero()), [infos] ); diff --git a/packages/page-assets/src/Overview/Mint/Mint.tsx b/packages/page-assets/src/Overview/Mint/Mint.tsx index 6c405cd..a7031e2 100644 --- a/packages/page-assets/src/Overview/Mint/Mint.tsx +++ b/packages/page-assets/src/Overview/Mint/Mint.tsx @@ -26,7 +26,7 @@ function Mint ({ className, details: { issuer, minBalance }, id, metadata, onClo const [recipientId, setRecipientId] = useState(null); const isAmountValid = useMemo( - () => amount && amount.gte(minBalance), + () => amount?.gte(minBalance), [amount, minBalance] ); diff --git a/packages/page-assets/src/Overview/Query.tsx b/packages/page-assets/src/Overview/Query.tsx index 9bec161..b8b58e0 100644 --- a/packages/page-assets/src/Overview/Query.tsx +++ b/packages/page-assets/src/Overview/Query.tsx @@ -23,7 +23,7 @@ function Query ({ className = '', onQuery }: Props): React.ReactElement { const _onQuery = useCallback( (): void => { - onQuery && onQuery(input); + onQuery?.(input); }, [input, onQuery] ); diff --git a/packages/page-assets/src/index.tsx b/packages/page-assets/src/index.tsx index 945e78e..97ba0c5 100644 --- a/packages/page-assets/src/index.tsx +++ b/packages/page-assets/src/index.tsx @@ -77,7 +77,7 @@ function AssetApp ({ basePath, className }: Props): React.ReactElement { ]); const showForeignAssetsTab = useMemo(() => !!foreignAssetLocations.length, [foreignAssetLocations.length]); - const showBalancesTab = useMemo(() => hasAccounts && infos && infos.some(({ details, metadata }) => !!(details && metadata)), [hasAccounts, infos]); + const showBalancesTab = useMemo(() => hasAccounts && infos?.some(({ details, metadata }) => !!(details && metadata)), [hasAccounts, infos]); const hidden = useMemo( () => diff --git a/packages/page-assets/src/useForeignAssetInfos.ts b/packages/page-assets/src/useForeignAssetInfos.ts index 99ad598..b487fd5 100644 --- a/packages/page-assets/src/useForeignAssetInfos.ts +++ b/packages/page-assets/src/useForeignAssetInfos.ts @@ -68,7 +68,7 @@ function useForeignAssetInfosImpl (locations?: StagingXcmV3MultiLocation[]): For const [state, setState] = useState(); useEffect((): void => { - details && metadata && (details[0][0].length === metadata[0][0].length) && + details && details[0][0].length === metadata?.[0][0].length && setState( details[0][0].map((location, index) => extractInfo(allAccounts, location, details[1][index], metadata[1][index]) diff --git a/packages/page-bounties/src/Bounties.spec.ts b/packages/page-bounties/src/Bounties.spec.ts index f4184d4..21bbf60 100644 --- a/packages/page-bounties/src/Bounties.spec.ts +++ b/packages/page-bounties/src/Bounties.spec.ts @@ -52,9 +52,9 @@ jest.mock('./hooks/useBounties', () => ({ let aProposal: (extrinsic: SubmittableExtrinsic<'promise'>, ayes?: string[], nays?: string[]) => DeriveCollectiveProposal; let augmentedApi: any; -let aBounty: ({ status, value }?: Partial) => PezpalletBountiesBounty; +let aBounty: (bounty?: Partial) => PezpalletBountiesBounty; let aBountyIndex: (index?: number) => BountyIndex; -let bountyStatusWith: ({ curator, status, updateDue }: { curator?: string, status?: string, updateDue?: number}) => PezpalletBountiesBountyStatus; +let bountyStatusWith: ({ curator, status, updateDue }: { curator?: string, status?: string, updateDue?: number }) => PezpalletBountiesBountyStatus; let bountyWith: ({ status, value }: { status?: string, value?: number }) => PezpalletBountiesBounty; describe('Bounties', () => { diff --git a/packages/page-bounties/src/BountyExtraActions/index.tsx b/packages/page-bounties/src/BountyExtraActions/index.tsx index 6aa1113..b4a4064 100644 --- a/packages/page-bounties/src/BountyExtraActions/index.tsx +++ b/packages/page-bounties/src/BountyExtraActions/index.tsx @@ -53,14 +53,14 @@ function Index ({ bestNumber, className, description, index, proposals, status } const existingCloseBountyProposal = useMemo( () => proposals?.find(({ proposal }) => - proposal && proposal.method === 'closeBounty' + proposal?.method === 'closeBounty' ), [proposals] ); const existingUnassignCuratorProposal = useMemo( () => proposals?.find(({ proposal }) => - proposal && proposal.method === 'unassignCurator' + proposal?.method === 'unassignCurator' ), [proposals] ); diff --git a/packages/page-bounties/src/helpers/determineUnassignCuratorAction.ts b/packages/page-bounties/src/helpers/determineUnassignCuratorAction.ts index 09e18da..0341fab 100644 --- a/packages/page-bounties/src/helpers/determineUnassignCuratorAction.ts +++ b/packages/page-bounties/src/helpers/determineUnassignCuratorAction.ts @@ -19,7 +19,7 @@ export function determineUnassignCuratorAction (roles: UserRole[], status: Pezpa actions.push('SlashCuratorMotion'); } - if (roles.includes('User') && blocksUntilUpdate && blocksUntilUpdate.lt(BN_ZERO)) { + if (roles.includes('User') && blocksUntilUpdate?.lt(BN_ZERO)) { actions.push('SlashCuratorAction'); } } diff --git a/packages/page-bounties/src/types.ts b/packages/page-bounties/src/types.ts index 3fe9fe3..839dbf2 100644 --- a/packages/page-bounties/src/types.ts +++ b/packages/page-bounties/src/types.ts @@ -14,7 +14,7 @@ export interface BountyStatusType { export type HelpMessages = Record; export type StatusName = 'Active' | 'Approved' | 'CuratorProposed' | 'Funded' | 'PendingPayout' | 'Proposed'; -export type BountyVotingStatuses = { [status in StatusName]: string[] }; +export type BountyVotingStatuses = Record; export type ValidUnassignCuratorAction = 'UnassignCurator' | 'SlashCuratorMotion' | 'SlashCuratorAction'; export type UnassignCuratorAction = ValidUnassignCuratorAction | 'None'; export type UserRole = 'User' | 'Member' | 'Curator' | 'None'; diff --git a/packages/page-bounties/test/pages/bountiesPage.tsx b/packages/page-bounties/test/pages/bountiesPage.tsx index c236fcb..4a149b8 100644 --- a/packages/page-bounties/test/pages/bountiesPage.tsx +++ b/packages/page-bounties/test/pages/bountiesPage.tsx @@ -37,7 +37,7 @@ function aGenesisHash () { } type FindOne = (match: string) => Promise; -type FindManyWithMatcher = (match: string | ((match: string) => boolean)) => Promise +type FindManyWithMatcher = (match: string | ((match: string) => boolean)) => Promise; type GetMany = (match: string) => HTMLElement[]; class NotYetRendered extends Error { @@ -57,7 +57,7 @@ interface RenderedBountiesPage { } export class BountiesPage { - aBounty: ({ status, value }?: Partial) => PezpalletBountiesBounty; + aBounty: (bounty?: Partial) => PezpalletBountiesBounty; aBountyIndex: (index?: number) => BountyIndex; aBountyStatus: (status: string) => PezpalletBountiesBountyStatus; bountyStatusWith: ({ curator, status }: { curator?: string, status?: string, }) => PezpalletBountiesBountyStatus; diff --git a/packages/page-broker/src/Overview/Filters.tsx b/packages/page-broker/src/Overview/Filters.tsx index 82be184..494fe99 100644 --- a/packages/page-broker/src/Overview/Filters.tsx +++ b/packages/page-broker/src/Overview/Filters.tsx @@ -40,8 +40,8 @@ function Filters ({ data, onFilter }: Props): React.ReactElement { const coreArr: number[] = useMemo(() => data?.length ? Array.from({ length: data.length || 0 }, (_, index) => index) - : [] - , [data]); + : [], + [data]); const { t } = useTranslation(); const teyrchainId = useDebounce(_teyrchainId); diff --git a/packages/page-broker/src/Overview/Summary/RegionLength.tsx b/packages/page-broker/src/Overview/Summary/RegionLength.tsx index c577fa6..a92f197 100644 --- a/packages/page-broker/src/Overview/Summary/RegionLength.tsx +++ b/packages/page-broker/src/Overview/Summary/RegionLength.tsx @@ -19,7 +19,7 @@ function RegionLength ({ children, className }: Props): React.ReactElement - {length?.toString() || '-'} + {typeof length === 'number' ? length : '-'} {children} ); diff --git a/packages/page-broker/src/Overview/Workload.tsx b/packages/page-broker/src/Overview/Workload.tsx index 3efa3a8..dbeacef 100644 --- a/packages/page-broker/src/Overview/Workload.tsx +++ b/packages/page-broker/src/Overview/Workload.tsx @@ -34,8 +34,8 @@ function Workload ({ api, config, core, workload, workplan }: Props): React.Reac const { currentRegion, status } = useBrokerContext(); const currentTimeSlice = useMemo(() => - status?.lastTimeslice ?? 0 - , [status]); + status?.lastTimeslice ?? 0, + [status]); const regionInfo = useRegions(api); const regionOwnerInfo: RegionInfo | undefined = useMemo(() => regionInfo?.find((v) => v.core === core && v.start <= currentTimeSlice && v.end > currentTimeSlice), [regionInfo, core, currentTimeSlice]); diff --git a/packages/page-broker/src/Overview/index.tsx b/packages/page-broker/src/Overview/index.tsx index 0d1268f..a7fd369 100644 --- a/packages/page-broker/src/Overview/index.tsx +++ b/packages/page-broker/src/Overview/index.tsx @@ -18,8 +18,8 @@ interface Props { className?: string; } -type LeaseMapType = Record -type ReservationMapType = Record +type LeaseMapType = Record; +type ReservationMapType = Record; const formatDataObject = (one: CoreWorkplan | CoreWorkload, leaseMap: LeaseMapType, reservationMap: ReservationMapType) => ({ ...one, diff --git a/packages/page-calendar/src/DayItem.tsx b/packages/page-calendar/src/DayItem.tsx index 7a53f72..605c7de 100644 --- a/packages/page-calendar/src/DayItem.tsx +++ b/packages/page-calendar/src/DayItem.tsx @@ -100,7 +100,7 @@ function DayItem ({ className, item: { blockNumber, date, info, type }, showAllE : ['teyrchainAuction'].includes(type) ? createLink('teyrchains/auction', t('via Teyrchains/Auction')) : undefined; - let s = ''; + let s: string; switch (type) { case 'councilElection': diff --git a/packages/page-calendar/src/types.ts b/packages/page-calendar/src/types.ts index 17e991f..35bc1a5 100644 --- a/packages/page-calendar/src/types.ts +++ b/packages/page-calendar/src/types.ts @@ -3,7 +3,7 @@ import type { BN } from '@pezkuwi/util'; -export type EntryType = 'councilElection' | 'councilMotion' | 'democracyDispatch' | 'democracyLaunch' | 'teyrchainAuction' | 'teyrchainLease' | 'referendumDispatch' | 'referendumVote' | 'scheduler' | 'societyChallenge' | 'societyRotate'| 'stakingEpoch' | 'stakingEra' | 'stakingSlash' | 'treasurySpend'; +export type EntryType = 'councilElection' | 'councilMotion' | 'democracyDispatch' | 'democracyLaunch' | 'teyrchainAuction' | 'teyrchainLease' | 'referendumDispatch' | 'referendumVote' | 'scheduler' | 'societyChallenge' | 'societyRotate' | 'stakingEpoch' | 'stakingEra' | 'stakingSlash' | 'treasurySpend'; export interface EntryInfo { blockNumber: BN; diff --git a/packages/page-claims/src/Warning.tsx b/packages/page-claims/src/Warning.tsx index d69a0e4..5452d5b 100644 --- a/packages/page-claims/src/Warning.tsx +++ b/packages/page-claims/src/Warning.tsx @@ -8,7 +8,7 @@ import { AddressMini, Card, styled } from '@pezkuwi/react-components'; import { useTranslation } from './translate.js'; import usePezkuwiPreclaims from './usePezkuwiPreclaims.js'; -export interface Props{ +export interface Props { className?: string; } diff --git a/packages/page-claims/src/index.tsx b/packages/page-claims/src/index.tsx index cf1a833..b8b3722 100644 --- a/packages/page-claims/src/index.tsx +++ b/packages/page-claims/src/index.tsx @@ -28,7 +28,7 @@ enum Step { Account = 0, ETHAddress = 1, Sign = 2, - Claim = 3, + Claim = 3 } const PRECLAIMS_LOADING = 'PRECLAIMS_LOADING'; @@ -105,7 +105,7 @@ function ClaimsApp ({ basePath }: Props): React.ReactElement { setEthereumAddress(null); setPreclaimEthereumAddress(PRECLAIMS_LOADING); - if (!api.query.claims || !api.query.claims.preclaims) { + if (!api.query.claims?.preclaims) { return setPreclaimEthereumAddress(null); } diff --git a/packages/page-claims/src/react-copy-to-clipboard.d.ts b/packages/page-claims/src/react-copy-to-clipboard.d.ts index a0b72ec..c319064 100644 --- a/packages/page-claims/src/react-copy-to-clipboard.d.ts +++ b/packages/page-claims/src/react-copy-to-clipboard.d.ts @@ -18,7 +18,7 @@ declare module 'react-copy-to-clipboard' { options?: Options; } - function CopyToClipboard(props: Props): ReactElement; + function CopyToClipboard (props: Props): ReactElement; export = CopyToClipboard; } diff --git a/packages/page-contracts/src/Codes/Code.tsx b/packages/page-contracts/src/Codes/Code.tsx index a4eb93a..aa57fbf 100644 --- a/packages/page-contracts/src/Codes/Code.tsx +++ b/packages/page-contracts/src/Codes/Code.tsx @@ -35,7 +35,7 @@ function Code ({ className, code, onShowDeploy }: Props): React.ReactElement { - onShowDeploy && onShowDeploy(code.json.codeHash, constructorIndex || 0); + onShowDeploy?.(code.json.codeHash, constructorIndex || 0); }, [code, onShowDeploy] ); diff --git a/packages/page-contracts/src/Codes/Upload.tsx b/packages/page-contracts/src/Codes/Upload.tsx index 2b0d5c9..4f71b83 100644 --- a/packages/page-contracts/src/Codes/Upload.tsx +++ b/packages/page-contracts/src/Codes/Upload.tsx @@ -97,7 +97,6 @@ function Upload ({ onClose }: Props): React.ReactElement { : api.registry.createType('Balance', BN_ZERO), weight.weightV2, null, - // eslint-disable-next-line @typescript-eslint/no-explicit-any { Upload: api.registry.createType('Raw', wasm) } as any, contractAbi?.constructors[constructorIndex]?.toU8a(params), '' diff --git a/packages/page-contracts/src/Codes/ValidateCode.tsx b/packages/page-contracts/src/Codes/ValidateCode.tsx index 9068c75..62e95b3 100644 --- a/packages/page-contracts/src/Codes/ValidateCode.tsx +++ b/packages/page-contracts/src/Codes/ValidateCode.tsx @@ -1,8 +1,6 @@ // Copyright 2017-2026 @pezkuwi/app-contracts authors & contributors // SPDX-License-Identifier: Apache-2.0 -/* eslint-disable camelcase */ - import type { Option } from '@pezkuwi/types'; import type { PrefabWasmModule } from '@pezkuwi/types/interfaces'; diff --git a/packages/page-contracts/src/Contracts/Call.tsx b/packages/page-contracts/src/Contracts/Call.tsx index 7a23da0..79b1bbf 100644 --- a/packages/page-contracts/src/Contracts/Call.tsx +++ b/packages/page-contracts/src/Contracts/Call.tsx @@ -138,11 +138,11 @@ function Call ({ className = '', contract, messageIndex, onCallResult, onChangeM params, when: new Date() }, ...outcomes]); - onCallResult && onCallResult(messageIndex, result); + onCallResult?.(messageIndex, result); }) .catch((error): void => { console.error(error); - onCallResult && onCallResult(messageIndex); + onCallResult?.(messageIndex); }); }, [accountId, contract.query, message, messageIndex, onCallResult, outcomes, params, value, weight] diff --git a/packages/page-contracts/src/Contracts/Deploy.tsx b/packages/page-contracts/src/Contracts/Deploy.tsx index 621275d..7608a93 100644 --- a/packages/page-contracts/src/Contracts/Deploy.tsx +++ b/packages/page-contracts/src/Contracts/Deploy.tsx @@ -108,7 +108,7 @@ function Deploy ({ codeHash, constructorIndex = 0, onClose, setConstructorIndex tags: [] }); - onClose && onClose(); + onClose?.(); } }, [api, name, onClose] diff --git a/packages/page-contracts/src/RemoveABI.tsx b/packages/page-contracts/src/RemoveABI.tsx index 1d0e0fe..7c29501 100644 --- a/packages/page-contracts/src/RemoveABI.tsx +++ b/packages/page-contracts/src/RemoveABI.tsx @@ -21,7 +21,7 @@ function RemoveABI ({ code, onClose, onRemove }: Props): React.ReactElement { - onClose && onClose(); + onClose?.(); onRemove(); }, [onClose, onRemove] diff --git a/packages/page-contracts/src/shared/Message.tsx b/packages/page-contracts/src/shared/Message.tsx index c08e966..4bd3743 100644 --- a/packages/page-contracts/src/shared/Message.tsx +++ b/packages/page-contracts/src/shared/Message.tsx @@ -42,7 +42,7 @@ function Message ({ className = '', index, lastResult, message, onSelect }: Prop const { t } = useTranslation(); const _onSelect = useCallback( - () => onSelect && onSelect(index), + () => onSelect?.(index), [index, onSelect] ); diff --git a/packages/page-contracts/src/shared/Messages.tsx b/packages/page-contracts/src/shared/Messages.tsx index 2d6c32e..3fa8a38 100644 --- a/packages/page-contracts/src/shared/Messages.tsx +++ b/packages/page-contracts/src/shared/Messages.tsx @@ -89,7 +89,7 @@ function Messages ({ className = '', contract, contractAbi: { constructors, info ); const _onSelect = useCallback( - (index: number) => onSelect && onSelect(index, _setMessageResult), + (index: number) => onSelect?.(index, _setMessageResult), [_setMessageResult, onSelect] ); diff --git a/packages/page-contracts/src/store.ts b/packages/page-contracts/src/store.ts index 6a0b271..e0ac9ca 100644 --- a/packages/page-contracts/src/store.ts +++ b/packages/page-contracts/src/store.ts @@ -53,12 +53,12 @@ class Store extends EventEmitter { const genesisHash = statics.api.genesisHash.toHex(); store.each((json: CodeJson, key: string): void => { - if (json && json.genesisHash === genesisHash && key.startsWith(KEY_CODE)) { + if (json?.genesisHash === genesisHash && key.startsWith(KEY_CODE)) { this.addCode(key, json); } }); - onLoaded && onLoaded(); + onLoaded?.(); } catch (error) { console.error('Unable to load code', error); } diff --git a/packages/page-contracts/src/useWeight.ts b/packages/page-contracts/src/useWeight.ts index 887787b..6551651 100644 --- a/packages/page-contracts/src/useWeight.ts +++ b/packages/page-contracts/src/useWeight.ts @@ -35,7 +35,7 @@ function useWeightImpl (): UseWeight { const [isEmpty, setIsEmpty] = useState(false); const setMegaGas = useCallback( - (value?: BN | undefined) => + (value?: BN) => _setMegaGas(value || convertWeight( api.consts.system.blockWeights ? api.consts.system.blockWeights.maxBlock @@ -44,7 +44,7 @@ function useWeightImpl (): UseWeight { [api] ); const setMegaRefTime = useCallback( - (value?: BN | undefined) => + (value?: BN) => _setMegaRefTime( value || api.consts.system.blockWeights ? api.consts.system.blockWeights.perClass.normal.maxExtrinsic.unwrapOrDefault().refTime.toBn().div(BN_MILLION).div(BN_TEN) @@ -53,7 +53,7 @@ function useWeightImpl (): UseWeight { [api] ); const setProofSize = useCallback( - (value?: BN | undefined) => + (value?: BN) => _setProofSize( value || api.consts.system.blockWeights ? api.consts.system.blockWeights.perClass.normal.maxExtrinsic.unwrapOrDefault().proofSize.toBn() diff --git a/packages/page-coretime/src/Overview/filters/useSearchFilter.tsx b/packages/page-coretime/src/Overview/filters/useSearchFilter.tsx index 78d02b1..2ff6e4c 100644 --- a/packages/page-coretime/src/Overview/filters/useSearchFilter.tsx +++ b/packages/page-coretime/src/Overview/filters/useSearchFilter.tsx @@ -1,7 +1,7 @@ // Copyright 2017-2026 @pezkuwi/app-coretime authors & contributors // SPDX-License-Identifier: Apache-2.0 -import React, { useCallback, useMemo, useState } from 'react'; +import { useCallback, useMemo, useState } from 'react'; import { useRelayEndpoints } from '@pezkuwi/react-hooks/useParaEndpoints'; @@ -18,7 +18,7 @@ export function useSearchFilter ({ data, onFilter }: UseSearchFilterProps) { endpoints .filter((e) => e?.text && e.paraId) .map((e) => [ - React.isValidElement(e.text) ? '' : String(e.text), + typeof e.text === 'string' ? e.text : '', e.paraId ]) ), diff --git a/packages/page-coretime/src/Sale/SaleDetailsView.tsx b/packages/page-coretime/src/Sale/SaleDetailsView.tsx index 196735b..68e1ae4 100644 --- a/packages/page-coretime/src/Sale/SaleDetailsView.tsx +++ b/packages/page-coretime/src/Sale/SaleDetailsView.tsx @@ -84,8 +84,8 @@ const SaleDetailsView = ({ chosenSaleNumber, relayName, saleParams }: { salePara const { t } = useTranslation(); const subscanPriceGraphUrl = useMemo(() => - `https://coretime-${relayName}.subscan.io/coretime_dashboard` - , [relayName]); + `https://coretime-${relayName}.subscan.io/coretime_dashboard`, + [relayName]); if (chosenSaleNumber === -1 || !saleParams) { return null; diff --git a/packages/page-coretime/src/types.ts b/packages/page-coretime/src/types.ts index 87acc59..3c65aaa 100644 --- a/packages/page-coretime/src/types.ts +++ b/packages/page-coretime/src/types.ts @@ -83,7 +83,7 @@ export interface RegionInfo { regionEnd: number; } -export type RelayName = 'dicle' | 'pezkuwi' | 'paseo testnet' | 'zagros' +export type RelayName = 'dicle' | 'pezkuwi' | 'paseo testnet' | 'zagros'; export interface GetResponse { blocks: { diff --git a/packages/page-coretime/src/utils/index.ts b/packages/page-coretime/src/utils/index.ts index b73b1cd..c7ee67d 100644 --- a/packages/page-coretime/src/utils/index.ts +++ b/packages/page-coretime/src/utils/index.ts @@ -10,8 +10,8 @@ import { BN } from '@pezkuwi/util'; type FirstCycleStartType = Record< 'block' | 'timeslice', Record< -'coretime', -Record + 'coretime', + Record > >; diff --git a/packages/page-coretime/src/utils/sale.ts b/packages/page-coretime/src/utils/sale.ts index 8c1aa14..aa9e7f9 100644 --- a/packages/page-coretime/src/utils/sale.ts +++ b/packages/page-coretime/src/utils/sale.ts @@ -185,7 +185,7 @@ const getPhaseConfiguration = ( }; export const getSaleParameters = ( - { config, constants, salesInfo }: {salesInfo: RegionInfo, config: Pick, constants: ChainConstants}, + { config, constants, salesInfo }: { salesInfo: RegionInfo, config: Pick, constants: ChainConstants }, relayName: RelayName, lastCommittedTimeslice: number, chosenSaleNumber = -1 diff --git a/packages/page-council/src/Motions/ProposeExternal.tsx b/packages/page-council/src/Motions/ProposeExternal.tsx index 85a3d84..7458390 100644 --- a/packages/page-council/src/Motions/ProposeExternal.tsx +++ b/packages/page-council/src/Motions/ProposeExternal.tsx @@ -81,7 +81,6 @@ function ProposeExternal ({ className = '', isMember, members }: Props): React.R useEffect((): void => { if (isHashValid && hash) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any const proposal = isCurrentPreimage ? preimage && api.tx.democracy.externalProposeMajority({ Lookup: { diff --git a/packages/page-council/src/Overview/Vote.tsx b/packages/page-council/src/Overview/Vote.tsx index c64f674..a56b5fc 100644 --- a/packages/page-council/src/Overview/Vote.tsx +++ b/packages/page-council/src/Overview/Vote.tsx @@ -61,9 +61,7 @@ function Vote ({ electionsInfo }: Props): React.ReactElement | null { (): BN | undefined => { const location = api.consts.elections || api.consts.phragmenElection || api.consts.electionsPhragmen; - return location && - location.votingBondBase && - location.votingBondBase.add(location.votingBondFactor.muln(votes.length)); + return location?.votingBondBase?.add(location.votingBondFactor.muln(votes.length)); }, [api, votes] ); diff --git a/packages/page-explorer/src/BlockHeader.tsx b/packages/page-explorer/src/BlockHeader.tsx index 5dd2b37..6678fcf 100644 --- a/packages/page-explorer/src/BlockHeader.tsx +++ b/packages/page-explorer/src/BlockHeader.tsx @@ -70,7 +70,7 @@ const BASE_BORDER = 0.125; const BORDER_TOP = `${BASE_BORDER * 3}rem solid var(--bg-page)`; const BORDER_RADIUS = `${BASE_BORDER * 4}rem`; -const StyledTr = styled.tr<{isFirstItem: boolean; isLastItem: boolean}>` +const StyledTr = styled.tr<{ isFirstItem: boolean; isLastItem: boolean }>` .blockTime { text-align: right; font-style: italic; diff --git a/packages/page-explorer/src/BlockInfo/ByHash.tsx b/packages/page-explorer/src/BlockInfo/ByHash.tsx index a5197f2..38a064b 100644 --- a/packages/page-explorer/src/BlockInfo/ByHash.tsx +++ b/packages/page-explorer/src/BlockInfo/ByHash.tsx @@ -39,7 +39,7 @@ interface State { const EMPTY_HEADER: [React.ReactNode?, string?, number?][] = [['...', 'start', 6]]; -function transformResult ([[runtimeVersion, events, blockWeight], getBlock, getHeader]: [[RuntimeVersionPartial, EventRecord[] | null, PezframeSupportDispatchPerDispatchClassWeight|null], SignedBlock, HeaderExtended?]): State { +function transformResult ([[runtimeVersion, events, blockWeight], getBlock, getHeader]: [[RuntimeVersionPartial, EventRecord[] | null, PezframeSupportDispatchPerDispatchClassWeight | null], SignedBlock, HeaderExtended?]): State { return { blockWeight, events: events?.map((record, index) => ({ @@ -64,7 +64,7 @@ function BlockByHash ({ className = '', error, value }: Props): React.ReactEleme const [isVersionCurrent, maxBlockWeight] = useMemo( () => [ !!runtimeVersion && api.runtimeVersion.specName.eq(runtimeVersion.specName) && api.runtimeVersion.specVersion.eq(runtimeVersion.specVersion), - api.consts.system.blockWeights && api.consts.system.blockWeights.maxBlock && convertWeight(api.consts.system.blockWeights.maxBlock).v2Weight + api.consts.system.blockWeights?.maxBlock && convertWeight(api.consts.system.blockWeights.maxBlock).v2Weight ], [api, runtimeVersion] ); @@ -133,9 +133,9 @@ function BlockByHash ({ className = '', error, value }: Props): React.ReactEleme setState((prev) => ({ ...prev, // Type assertion needed due to ArrayBufferLike vs ArrayBuffer in Hash type - nextBlockHash: header.hash as Hash + nextBlockHash: header.hash })); - unsub && unsub(); + unsub?.(); } }).then((_unsub) => { unsub = _unsub; @@ -149,7 +149,7 @@ function BlockByHash ({ className = '', error, value }: Props): React.ReactEleme }); return (): void => { - unsub && unsub(); + unsub?.(); }; }, [api, getHeader?.number, mountedRef]); diff --git a/packages/page-explorer/src/Events.tsx b/packages/page-explorer/src/Events.tsx index 2347543..e25559e 100644 --- a/packages/page-explorer/src/Events.tsx +++ b/packages/page-explorer/src/Events.tsx @@ -18,7 +18,7 @@ import Event from './Event.js'; import { useTranslation } from './translate.js'; const MAX_CACHE = 200; -const blockCache = new Map>}>(); +const blockCache = new Map> }>(); interface Props { className?: string; @@ -81,8 +81,8 @@ function Events ({ className = '', emptyLabel, error, eventClassName, events, la if (!blockData) { const [{ author }, block] = await Promise.all([ - await api.derive.chain.getHeader(blockHash), - await api.rpc.chain.getBlock(blockHash) + api.derive.chain.getHeader(blockHash), + api.rpc.chain.getBlock(blockHash) ]); const extrinsics = block.block.extrinsics; diff --git a/packages/page-explorer/src/Forks.tsx b/packages/page-explorer/src/Forks.tsx index 81e2482..57be8a1 100644 --- a/packages/page-explorer/src/Forks.tsx +++ b/packages/page-explorer/src/Forks.tsx @@ -22,7 +22,7 @@ interface LinkHeader { width: number; } -// eslint-disable-next-line @typescript-eslint/no-empty-interface,no-use-before-define +// eslint-disable-next-line @typescript-eslint/no-empty-object-type interface LinkArray extends Array {} interface Link { @@ -361,8 +361,8 @@ function Forks ({ className }: Props): React.ReactElement | null { })().catch(console.error); return (): void => { - _subFinHead && _subFinHead(); - _subNewHead && _subNewHead(); + _subFinHead?.(); + _subNewHead?.(); }; }, [api, _newFinalized, _newHeader]); diff --git a/packages/page-files/src/CrustFiles.tsx b/packages/page-files/src/CrustFiles.tsx index 83b1e61..81d8c3c 100644 --- a/packages/page-files/src/CrustFiles.tsx +++ b/packages/page-files/src/CrustFiles.tsx @@ -53,7 +53,7 @@ const createOnDown = (f: SaveFile) => () => { // FileSaver.saveAs(createUrl(f), f.Name); }; -type FunInputFile = (e: React.ChangeEvent) => void +type FunInputFile = (e: React.ChangeEvent) => void; const Noop = (): void => undefined; @@ -76,7 +76,6 @@ function CrustFiles ({ className }: Props): React.ReactElement { // @ts-ignore // eslint-disable-next-line inputRef.current.webkitdirectory = dir; - // eslint-disable-next-line inputRef.current.multiple = dir; inputRef.current.click(); }, [inputRef]); @@ -111,7 +110,6 @@ function CrustFiles ({ className }: Props): React.ReactElement { // eslint-disable-next-line // @ts-ignore - // eslint-disable-next-line const isDirectory = e.target.webkitdirectory; if (!isDirectory) { @@ -120,7 +118,6 @@ function CrustFiles ({ className }: Props): React.ReactElement { } else if (files.length >= 1) { // eslint-disable-next-line // @ts-ignore eslint-disable-next-line - // eslint-disable-next-line @typescript-eslint/no-unsafe-call const dirFiles: DirFile[] = []; for (let i = 0, count = files.length; i < count; i++) { @@ -141,13 +138,13 @@ function CrustFiles ({ className }: Props): React.ReactElement { const _onImportResult = useCallback<(m: string, s?: ActionStatusBase['status']) => void>( (message, status = 'queued') => { - queueAction && queueAction({ + queueAction?.({ action: t('Import files'), message, status }); }, - [queueAction, t] + [queueAction, t] ); const importInputRef = useRef(null); const _clickImport = useCallback(() => { @@ -214,7 +211,7 @@ function CrustFiles ({ className }: Props): React.ReactElement { const _export = useCallback(() => { const blob = new Blob([JSON.stringify(wFiles.files)], { type: 'application/json; charset=utf-8' }); - // eslint-disable-next-line deprecation/deprecation + // eslint-disable-next-line @typescript-eslint/no-deprecated FileSaver.saveAs(blob, 'files.json'); }, [wFiles]); diff --git a/packages/page-files/src/UploadModal.tsx b/packages/page-files/src/UploadModal.tsx index 48ebbdc..0db5f50 100644 --- a/packages/page-files/src/UploadModal.tsx +++ b/packages/page-files/src/UploadModal.tsx @@ -134,7 +134,7 @@ function UploadModal ({ className, file, onClose = NOOP, onSuccess = NOOP }: Pro setIsLocked( isInjected ? false - : (currentPair && currentPair.isLocked) || false + : (currentPair?.isLocked) || false ); setSigner({ isUsable, signer: null }); @@ -157,7 +157,7 @@ function UploadModal ({ className, file, onClose = NOOP, onSuccess = NOOP }: Pro currentPair.decodePkcs8(password); resolve(1); } catch (error) { - reject(error); + reject(error instanceof Error ? error : new Error(String(error))); } }); }); @@ -240,11 +240,10 @@ function UploadModal ({ className, file, onClose = NOOP, onSuccess = NOOP }: Pro if (typeof upResult.data === 'string') { const jsonStr = upResult.data.replace(/}\n{/g, '},{'); const items = JSON.parse(`[${jsonStr}]`) as UploadRes[]; - const folder = items.length - 1; - upRes = items[folder]; - delete items[folder]; - upRes.items = items; + // the last entry is the folder itself, the ones before it its files + upRes = items[items.length - 1]; + upRes.items = items.slice(0, -1); } else { upRes = upResult.data; } diff --git a/packages/page-js/src/Playground.tsx b/packages/page-js/src/Playground.tsx index 0041bc6..12e4d62 100644 --- a/packages/page-js/src/Playground.tsx +++ b/packages/page-js/src/Playground.tsx @@ -80,7 +80,7 @@ function Playground ({ basePath, className = '' }: Props): React.ReactElement(null); - const iframeRef = useRef(null); + const iframeRef = useRef(null); const [code, setCode] = useState(''); const [isCustomExample, setIsCustomExample] = useState(false); const [isRunning, setIsRunning] = useState(false); @@ -118,7 +118,7 @@ function Playground ({ basePath, className = '' }: Props): React.ReactElement option.value === localData.selectedValue); setCustomExamples(customExamples); - setIsCustomExample((selected && selected.type === 'custom') || false); + setIsCustomExample((selected?.type === 'custom') || false); setOptions(options); setSelected(selected || snippets[0]); // eslint-disable-next-line react-hooks/exhaustive-deps @@ -168,7 +168,6 @@ function Playground ({ basePath, className = '' }: Props): React.ReactElement'); iframeDoc.close(); @@ -196,7 +195,7 @@ function Playground ({ basePath, className = '' }: Props): React.ReactElement !info || !accountItems ? [] - : accountItems.filter(({ collectionId }) => collectionId.eq(info.id)) - , [info, accountItems] + : accountItems.filter(({ collectionId }) => collectionId.eq(info.id)), + [info, accountItems] ); const itemsInfos = useItemsInfos(collectionItems); diff --git a/packages/page-nfts/src/index.tsx b/packages/page-nfts/src/index.tsx index 79fc720..59d4cc5 100644 --- a/packages/page-nfts/src/index.tsx +++ b/packages/page-nfts/src/index.tsx @@ -39,7 +39,7 @@ function NftApp ({ basePath, className }: Props): React.ReactElement { ]); const hidden = useMemo( - () => (hasAccounts && infos && infos.some(({ details, metadata }) => !!(details && metadata))) + () => (hasAccounts && infos?.some(({ details, metadata }) => !!(details && metadata))) ? [] : ['my-nfts'], [hasAccounts, infos] diff --git a/packages/page-nfts/src/useCollectionInfos.ts b/packages/page-nfts/src/useCollectionInfos.ts index 2fe8c25..1443f92 100644 --- a/packages/page-nfts/src/useCollectionInfos.ts +++ b/packages/page-nfts/src/useCollectionInfos.ts @@ -101,7 +101,7 @@ function useCollectionInfosImpl (ids?: BN[]): CollectionInfo[] | undefined { const fetchedMetadata = useMetadataFetch(metadataLinks, METADATA_FETCH_OPTIONS); useEffect((): void => { - if (fetchedMetadata && details && metadata && (details[0][0].length === metadata[0][0].length)) { + if (fetchedMetadata && details && details[0][0].length === metadata?.[0][0].length) { const collectionInfos = details[0][0].map((id, index) => extractInfo(allAccounts, id, details[1][index], metadata[1][index]) ); diff --git a/packages/page-poll/src/index.tsx b/packages/page-poll/src/index.tsx index 70ca870..5f5ca47 100644 --- a/packages/page-poll/src/index.tsx +++ b/packages/page-poll/src/index.tsx @@ -90,7 +90,7 @@ function PollApp ({ basePath, className }: Props): React.ReactElement { ]; const hasValue = opt10m || opt100m || opt1b || opt10b; - /* eslint-disable react/jsx-max-props-per-line */ + /* eslint-disable @stylistic/jsx-max-props-per-line */ return ( diff --git a/packages/page-preimages/src/Preimages/Call.tsx b/packages/page-preimages/src/Preimages/Call.tsx index bf0c6c0..402e66b 100644 --- a/packages/page-preimages/src/Preimages/Call.tsx +++ b/packages/page-preimages/src/Preimages/Call.tsx @@ -32,7 +32,7 @@ function PreimageCall ({ className = '', value }: Props): React.ReactElement - {value && value.isCompleted + {value?.isCompleted ? ( <> {value.proposal && ( @@ -63,7 +63,7 @@ function PreimageCall ({ className = '', value }: Props): React.ReactElement - {value && value.isCompleted + {value?.isCompleted ? value.deposit ? ( ` +const StyledTr = styled.tr<{ isFirstItem: boolean; isLastItem: boolean }>` background: var(--bg-table); .ui--Icon { diff --git a/packages/page-ranked/src/useMembers.ts b/packages/page-ranked/src/useMembers.ts index 8b2ce88..d332d74 100644 --- a/packages/page-ranked/src/useMembers.ts +++ b/packages/page-ranked/src/useMembers.ts @@ -45,7 +45,7 @@ function useMembersImpl (collective: PalletColl): Result | undefined { const result = useCall(ids && ids.length !== 0 && api.query[collective].members.multi, [ids], OPT_MEM); return useMemo( - () => ids && ids.length === 0 + () => ids?.length === 0 ? { memberIds: [], memberRanks: [], members: [] } : result, [ids, result] diff --git a/packages/page-referenda/src/Referenda/Group.tsx b/packages/page-referenda/src/Referenda/Group.tsx index 6f304c0..84fa118 100644 --- a/packages/page-referenda/src/Referenda/Group.tsx +++ b/packages/page-referenda/src/Referenda/Group.tsx @@ -6,8 +6,8 @@ import type { PalletReferenda, PalletVote, ReferendaGroup, TrackDescription } fr import React, { useMemo } from 'react'; -import { ExpandButton, Table } from '@pezkuwi/react-components'; -import { useApi, useToggle } from '@pezkuwi/react-hooks'; +import { Table } from '@pezkuwi/react-components'; +import { useApi } from '@pezkuwi/react-hooks'; import { useTranslation } from '../translate.js'; import { getTrackInfo } from '../util.js'; @@ -27,41 +27,23 @@ interface Props extends ReferendaGroup { function Group ({ activeIssuance, className, isMember, members, palletReferenda, palletVote, ranks, referenda, trackId, trackName, tracks }: Props): React.ReactElement { const { t } = useTranslation(); const { api, specName } = useApi(); - const [isExpanded, toggleExpanded] = useToggle(); const trackInfo = useMemo( () => getTrackInfo(api, specName, palletReferenda, tracks, trackId?.toNumber()), [api, specName, palletReferenda, tracks, trackId] ); - const [headerButton, headerChildren] = useMemo( - () => [ - false && trackInfo && ( - - ), - isExpanded && trackInfo && ( - - - - ) - ], - [isExpanded, toggleExpanded, trackInfo] - ); - const [header, key] = useMemo( (): [([React.ReactNode?, string?, number?] | null)[], string] => [ [ [trackName ? <>{trackName}
{trackInfo?.text}
: t('referenda'), 'start', 8], - [headerButton] + [] ], trackName ? `track:${trackName}` : 'untracked' ], - [headerButton, t, trackInfo, trackName] + [t, trackInfo, trackName] ); return ( @@ -69,7 +51,6 @@ function Group ({ activeIssuance, className, isMember, members, palletReferenda, className={className} empty={referenda && t('No active referenda')} header={header} - headerChildren={headerChildren} isSplit={!trackId} key={key} > diff --git a/packages/page-referenda/src/Referenda/Submit/useTrackOptions.tsx b/packages/page-referenda/src/Referenda/Submit/useTrackOptions.tsx index e6a5ec6..fc5e4ca 100644 --- a/packages/page-referenda/src/Referenda/Submit/useTrackOptions.tsx +++ b/packages/page-referenda/src/Referenda/Submit/useTrackOptions.tsx @@ -23,8 +23,7 @@ function getTrackOptions (api: ApiPromise, specName: string, palletReferenda: st !includeBn || includeBn.some((v) => v.eq(id)) ) && ( - !excludeBn || - !excludeBn.some((v) => v.eq(id)) + !excludeBn?.some((v) => v.eq(id)) ) ) .map(({ id, info }): TrackOption => { diff --git a/packages/page-referenda/src/Referenda/Vote/index.tsx b/packages/page-referenda/src/Referenda/Vote/index.tsx index e1e4b47..a320025 100644 --- a/packages/page-referenda/src/Referenda/Vote/index.tsx +++ b/packages/page-referenda/src/Referenda/Vote/index.tsx @@ -46,13 +46,12 @@ function filterMembers (allAccounts: string[], members?: string[], ranks?: BN[], } function createVoteOpts (api: ApiPromise, t: (key: string, options?: { replace: Record }) => string): { text: string, value: string }[] { - let hasAbstain = false; + let hasAbstain: boolean; try { // Check if the runtime supports SplitAbstain vote type const voteType = api.createType('PezpalletConvictionVotingVoteAccountVote', { SplitAbstain: { abstain: 1 } }); - // eslint-disable-next-line @typescript-eslint/no-explicit-any hasAbstain = !!(voteType as any).isSplitAbstain; } catch { hasAbstain = false; diff --git a/packages/page-referenda/src/Referenda/useVotes.ts b/packages/page-referenda/src/Referenda/useVotes.ts index eb61d42..077ac48 100644 --- a/packages/page-referenda/src/Referenda/useVotes.ts +++ b/packages/page-referenda/src/Referenda/useVotes.ts @@ -21,7 +21,7 @@ const OPT_ACCOUNTID = { const OPT_VOTES = { transform: ([[params], votes]: [[[[BN, AccountId][]]], Option[]]): Record => params.reduce>((all, [, a], i) => { - if (votes[i] && votes[i].isSome) { + if (votes[i]?.isSome) { all[a.toString()] = votes[i].unwrap(); } diff --git a/packages/page-referenda/src/types.ts b/packages/page-referenda/src/types.ts index 9643955..4c3c5f6 100644 --- a/packages/page-referenda/src/types.ts +++ b/packages/page-referenda/src/types.ts @@ -4,7 +4,7 @@ import type { PezpalletReferendaReferendumInfoConvictionVotingTally, PezpalletReferendaReferendumInfoRankedCollectiveTally, PezpalletReferendaTrackDetails } from '@pezkuwi/types/lookup'; import type { BN } from '@pezkuwi/util'; -export type PalletReferenda = 'referenda' | 'rankedPolls' | 'fellowshipReferenda'| 'ambassadorReferenda'; +export type PalletReferenda = 'referenda' | 'rankedPolls' | 'fellowshipReferenda' | 'ambassadorReferenda'; export type PalletVote = 'convictionVoting' | 'rankedCollective' | 'fellowshipCollective' | 'ambassadorCollective'; diff --git a/packages/page-referenda/src/useAccountLocks.ts b/packages/page-referenda/src/useAccountLocks.ts index 77011c9..5e41c22 100644 --- a/packages/page-referenda/src/useAccountLocks.ts +++ b/packages/page-referenda/src/useAccountLocks.ts @@ -84,7 +84,7 @@ function getLocks (api: ApiPromise, palletVote: PalletVote, votes: [classId: BN, if (refInfo) { const [, tally] = refInfo; let total: BN | undefined; - let endBlock: BN| undefined; + let endBlock: BN | undefined; let convictionIndex = 0; let locked = 'None'; const durationIndex = 1; diff --git a/packages/page-referenda/src/useReferenda.ts b/packages/page-referenda/src/useReferenda.ts index 782d8b5..aa50fb1 100644 --- a/packages/page-referenda/src/useReferenda.ts +++ b/packages/page-referenda/src/useReferenda.ts @@ -89,7 +89,7 @@ function group (tracks: TrackDescription[], totalIssuance?: BN, referenda?: Refe } const trackInfo = tracks.find(({ id }) => - id?.eq && id.eq(ref.info.asOngoing.track) + id?.eq?.(ref.info.asOngoing.track) ); if (trackInfo) { @@ -152,7 +152,7 @@ function useReferendaImpl (palletReferenda: PalletReferenda): [ReferendaGroup[], return useMemo( () => [ - (ids && ids.length === 0) + (ids?.length === 0) ? [{ key: 'referenda', referenda: [] }] : group(tracks, totalIssuance, (referenda as Referendum[])), tracks diff --git a/packages/page-referenda/src/useSummary.ts b/packages/page-referenda/src/useSummary.ts index c9092dd..88b489e 100644 --- a/packages/page-referenda/src/useSummary.ts +++ b/packages/page-referenda/src/useSummary.ts @@ -16,7 +16,7 @@ function calcActive (grouped: ReferendaGroup[] = []): number { 0); } -function useSummaryImpl (palletReferenda: PalletReferenda, grouped?: ReferendaGroup[] | undefined): Summary { +function useSummaryImpl (palletReferenda: PalletReferenda, grouped?: ReferendaGroup[]): Summary { const { api } = useApi(); const refCount = useCall(api.query[palletReferenda].referendumCount); const refActive = useMemo( diff --git a/packages/page-settings/src/Developer.tsx b/packages/page-settings/src/Developer.tsx index 364c857..a07fd79 100644 --- a/packages/page-settings/src/Developer.tsx +++ b/packages/page-settings/src/Developer.tsx @@ -161,7 +161,7 @@ function Developer ({ className = '', onStatusChange }: Props): React.ReactEleme const typesHasNoEntries = Object.keys(types).length === 0; // Trans component - /* eslint-disable react/jsx-max-props-per-line */ + /* eslint-disable @stylistic/jsx-max-props-per-line */ return ( diff --git a/packages/page-settings/src/I18n/index.tsx b/packages/page-settings/src/I18n/index.tsx index f35792c..8116b21 100644 --- a/packages/page-settings/src/I18n/index.tsx +++ b/packages/page-settings/src/I18n/index.tsx @@ -130,7 +130,7 @@ function doDownload (strings: Strings, withEmpty: boolean): void { return result; }, {}); - // eslint-disable-next-line deprecation/deprecation + // eslint-disable-next-line @typescript-eslint/no-deprecated FileSaver.saveAs( new Blob([JSON.stringify(sanitized, null, 2)], { type: 'application/json; charset=utf-8' }), 'translation.json' diff --git a/packages/page-settings/src/Metadata/NetworkSpecs.tsx b/packages/page-settings/src/Metadata/NetworkSpecs.tsx index 772986a..a04284a 100644 --- a/packages/page-settings/src/Metadata/NetworkSpecs.tsx +++ b/packages/page-settings/src/Metadata/NetworkSpecs.tsx @@ -20,7 +20,7 @@ interface Props { } // TODO-MOONBEAM: update NetworkSpecsStruct in @pezkuwi/ui-settings/types -interface NetworkSpecsStructWithType extends NetworkSpecsStruct{ +interface NetworkSpecsStructWithType extends NetworkSpecsStruct { chainType: ChainType } diff --git a/packages/page-settings/src/useRawMetadata.ts b/packages/page-settings/src/useRawMetadata.ts index d5f017a..007b1a5 100644 --- a/packages/page-settings/src/useRawMetadata.ts +++ b/packages/page-settings/src/useRawMetadata.ts @@ -14,13 +14,13 @@ function useRawMetadataImpl (): HexString | null { useEffect( (): void => { - isApiReady && - api.call.metadata.metadataAtVersion && - api.call.metadata.metadataAtVersion(15).then((opaque) => { - const raw = opaque.toHex(); + if (isApiReady) { + api.call.metadata.metadataAtVersion?.(15).then((opaque) => { + const raw = opaque.toHex(); - setState(raw); - }).catch(console.error); + setState(raw); + }).catch(console.error); + } }, [api, isApiReady] ); diff --git a/packages/page-settings/src/util.tsx b/packages/page-settings/src/util.tsx index 618ef2d..021b56f 100644 --- a/packages/page-settings/src/util.tsx +++ b/packages/page-settings/src/util.tsx @@ -41,7 +41,6 @@ export function createOption ({ info, isHeader, text, value }: Option, overrides } export function createIdenticon ({ info, text, value }: Option, overrides: string[] = [], override = 'empty'): Option { - // eslint-disable-next-line @typescript-eslint/no-explicit-any const theme = (info && overrides.includes(info) ? override : info) as any; // bizinikiwi is valid in pezkuwi-sdk but IconTheme type not yet updated diff --git a/packages/page-signing/src/Sign.tsx b/packages/page-signing/src/Sign.tsx index 0a88006..d9f92d2 100644 --- a/packages/page-signing/src/Sign.tsx +++ b/packages/page-signing/src/Sign.tsx @@ -56,7 +56,7 @@ function Sign ({ className = '' }: Props): React.ReactElement { setIsLocked( isInjected ? false - : (currentPair && currentPair.isLocked) || false + : (currentPair?.isLocked) || false ); setSignature(''); setSigner({ isUsable, signer: null }); diff --git a/packages/page-signing/src/Unlock.tsx b/packages/page-signing/src/Unlock.tsx index 78e88fe..59e1aae 100644 --- a/packages/page-signing/src/Unlock.tsx +++ b/packages/page-signing/src/Unlock.tsx @@ -33,7 +33,7 @@ function Unlock ({ onClose, onUnlock, pair }: Props): React.ReactElement const _onUnlock = useCallback( (): void => { - if (!pair || !pair.isLocked) { + if (!pair?.isLocked) { return; } diff --git a/packages/page-society/src/Overview/Summary.tsx b/packages/page-society/src/Overview/Summary.tsx index a0a0f44..d521b64 100644 --- a/packages/page-society/src/Overview/Summary.tsx +++ b/packages/page-society/src/Overview/Summary.tsx @@ -25,7 +25,7 @@ function Summary ({ className = '', info, payoutTotal }: Props): React.ReactElem const bestNumber = useBestNumber(); const pot = useMemo( - () => info && info.pot.gtn(0) + () => info?.pot.gtn(0) ? info.pot : null, [info] diff --git a/packages/page-staking-async/src/Actions/Account/InjectKeys.tsx b/packages/page-staking-async/src/Actions/Account/InjectKeys.tsx index 526f19d..ac98e16 100644 --- a/packages/page-staking-async/src/Actions/Account/InjectKeys.tsx +++ b/packages/page-staking-async/src/Actions/Account/InjectKeys.tsx @@ -63,7 +63,6 @@ function InjectKeys ({ onClose }: Props): React.ReactElement | null { const _onSubmit = useCallback( (): void => queueRpc({ - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment rpc: { method: 'insertKey', section: 'author' } as any, values: [keyType, suri, publicKey] }), diff --git a/packages/page-staking-async/src/Actions/Account/WarnBond.tsx b/packages/page-staking-async/src/Actions/Account/WarnBond.tsx index b73da07..3321707 100644 --- a/packages/page-staking-async/src/Actions/Account/WarnBond.tsx +++ b/packages/page-staking-async/src/Actions/Account/WarnBond.tsx @@ -20,7 +20,7 @@ function WarnBond ({ minBond, stakingInfo }: Props): React.ReactElement | const { t } = useTranslation(); const isBelow = useMemo( - () => minBond && stakingInfo && stakingInfo.stakingLedger.active.unwrap().lt(minBond), + () => minBond && stakingInfo?.stakingLedger.active.unwrap().lt(minBond), [minBond, stakingInfo] ); diff --git a/packages/page-staking-async/src/Actions/Account/index.tsx b/packages/page-staking-async/src/Actions/Account/index.tsx index 38cf4fa..c4ef8a8 100644 --- a/packages/page-staking-async/src/Actions/Account/index.tsx +++ b/packages/page-staking-async/src/Actions/Account/index.tsx @@ -333,7 +333,7 @@ function Account ({ allSlashes, className = '', info, isDisabled, minCommission, onClick={toggleRebond} /> diff --git a/packages/page-staking-async/src/Actions/Pool/useAccountInfo.ts b/packages/page-staking-async/src/Actions/Pool/useAccountInfo.ts index 3c0f61d..66bd0db 100644 --- a/packages/page-staking-async/src/Actions/Pool/useAccountInfo.ts +++ b/packages/page-staking-async/src/Actions/Pool/useAccountInfo.ts @@ -21,13 +21,14 @@ function useAccountInfoImpl (accountId: string): AccountInfo | null { const member = useCall(api.query.nominationPools.poolMembers, [accountId], OPT_DEL); useEffect((): void => { - member && + if (member) { api.call.nominationPoolsApi ?.pendingRewards(accountId) .then((claimable) => isMountedRef.current && setState({ claimable, member }) ) .catch(console.error); + } }, [accountId, member, api, isMountedRef]); return state; diff --git a/packages/page-staking-async/src/Actions/partials/Validate.tsx b/packages/page-staking-async/src/Actions/partials/Validate.tsx index a76bc7f..5082ebb 100644 --- a/packages/page-staking-async/src/Actions/partials/Validate.tsx +++ b/packages/page-staking-async/src/Actions/partials/Validate.tsx @@ -44,7 +44,6 @@ function Validate ({ className = '', controllerId, minCommission, onChange, stas useEffect((): void => { try { onChange({ - // eslint-disable-next-line @typescript-eslint/no-explicit-any validateTx: api.tx.staking.validate({ blocked: !allowNoms, commission diff --git a/packages/page-staking-async/src/Actions/useInactives.ts b/packages/page-staking-async/src/Actions/useInactives.ts index c87b18a..eb2af55 100644 --- a/packages/page-staking-async/src/Actions/useInactives.ts +++ b/packages/page-staking-async/src/Actions/useInactives.ts @@ -40,7 +40,7 @@ interface ExtractStateParams { stashId: string; unappliedSlashes: string[]; nominationsInfo: NominationInfo[]; - activeEra: EraIndex| undefined; + activeEra: EraIndex | undefined; submittedIn: EraIndex; activeValidators: DeriveEraValidatorExposurePaged; } @@ -173,7 +173,7 @@ function useInactivesImpl (stashId: string, nominees?: string[]): Inactives { } return (): void => { - unsub && unsub(); + unsub?.(); }; }, [api, mountedRef, nominees, stashId, indexes]); diff --git a/packages/page-staking-async/src/Actions/useUnbondDuration.ts b/packages/page-staking-async/src/Actions/useUnbondDuration.ts index 7179034..3b1292c 100644 --- a/packages/page-staking-async/src/Actions/useUnbondDuration.ts +++ b/packages/page-staking-async/src/Actions/useUnbondDuration.ts @@ -14,7 +14,7 @@ function useUnbondDurationImpl (): BN | undefined { const sessionInfo = useCall(api?.derive.session.info); return useMemo( - () => (sessionInfo && sessionInfo.sessionLength.gt(BN_ONE)) + () => (sessionInfo?.sessionLength.gt(BN_ONE)) ? sessionInfo.eraLength.mul(api?.consts.staking.bondingDuration ?? BN_ZERO) : undefined, [api, sessionInfo] diff --git a/packages/page-staking-async/src/CommandCenter/ah.tsx b/packages/page-staking-async/src/CommandCenter/ah.tsx index 39ecbf8..2ffbecd 100644 --- a/packages/page-staking-async/src/CommandCenter/ah.tsx +++ b/packages/page-staking-async/src/CommandCenter/ah.tsx @@ -142,11 +142,11 @@ function AssetHubSection ({ ahApi, ahEvents, ahOutput, ahUrl, children, isRelayC

{t('Bags List')}

- {/* eslint-disable-next-line @typescript-eslint/no-unsafe-member-access */} + {} {ahOutput.bagsList ? ahOutput.bagsList.allNodes : 'None'} - {/* eslint-disable-next-line @typescript-eslint/no-unsafe-member-access */} + {} {ahOutput.bagsList ? ahOutput.bagsList.lock : 'None'}
diff --git a/packages/page-staking-async/src/CommandCenter/index.tsx b/packages/page-staking-async/src/CommandCenter/index.tsx index 8986898..42cad8e 100644 --- a/packages/page-staking-async/src/CommandCenter/index.tsx +++ b/packages/page-staking-async/src/CommandCenter/index.tsx @@ -53,7 +53,7 @@ export interface IAhOutput { finalizedBlock: number, staking: { currentEra: number, - activeEra: {index: number, start: string, duration?: string}, + activeEra: { index: number, start: string, duration?: string }, erasStartSessionIndex?: number, bondedEras: Vec>, unprunedEras: string, @@ -76,7 +76,7 @@ export interface IAhOutput { phase: string, round: number, snapshotRange: string[] - queuedScore: string|null, + queuedScore: string | null, signedSubmissions: number }, bagsList?: { @@ -309,7 +309,6 @@ const commandCenterHandler = async ( const parsedQueuedScore = ahApi.createType('Option', queuedScore); const formattedQueuedScore = parsedQueuedScore.isSome ? (() => { - // eslint-disable-next-line @typescript-eslint/no-explicit-any const score = parsedQueuedScore.unwrap() as any; const minimalStake = score.minimalStake?.toString() || '0'; const formattedMinStake = formatBalance(minimalStake, { forceUnit: '-', withSi: true }); @@ -400,11 +399,11 @@ function CommandCenter ({ ahApi: initialAhApi, ahEndPoints, isRelayChain, rcApi: const [rcEvents, setRcEvents] = useState([]); const [ahEvents, setAhEvents] = useState([]); - const [rcUrl, setRcUrl] = useState(undefined); - const [ahUrl, setAhUrl] = useState(undefined); + const [rcUrl, setRcUrl] = useState(undefined); + const [ahUrl, setAhUrl] = useState(undefined); - const [ahApi, setAhApi] = useState(initialAhApi); - const [rcApi, setRcApi] = useState(initialRcApi); + const [ahApi, setAhApi] = useState(initialAhApi); + const [rcApi, setRcApi] = useState(initialRcApi); const [isLoadingHistory, setIsLoadingHistory] = useState(false); const [rcLowestBlock, setRcLowestBlock] = useState(null); diff --git a/packages/page-staking-async/src/Validators/Address/StakeOther.tsx b/packages/page-staking-async/src/Validators/Address/StakeOther.tsx index fe7c2c4..0f445fc 100644 --- a/packages/page-staking-async/src/Validators/Address/StakeOther.tsx +++ b/packages/page-staking-async/src/Validators/Address/StakeOther.tsx @@ -70,7 +70,7 @@ function StakeOther ({ nominators, stakeOther }: Props): React.ReactElement - {(!rewarded || rewarded[0] !== 0) && ( + {(rewarded?.[0] !== 0) && ( - this guide + this guide .

- For more information about Staking Async and AssetHub migration, please see the{' '} + For more information about Staking Async and AssetHub migration, please see the{' '} - Asset Hub Migration FAQ + Asset Hub Migration FAQ . {children} diff --git a/packages/page-staking-async/src/Validators/Summary.tsx b/packages/page-staking-async/src/Validators/Summary.tsx index b842673..fc31ca7 100644 --- a/packages/page-staking-async/src/Validators/Summary.tsx +++ b/packages/page-staking-async/src/Validators/Summary.tsx @@ -37,7 +37,6 @@ const useActiveNominators = () => { const exposedNominators = (await api.query.staking.erasStakersPaged.entries(currentEra)).map(([_, value]) => { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error - // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access return (value).unwrap().others.map((x) => x.who.toString()); }).flat(); diff --git a/packages/page-staking-async/src/Validators/index.tsx b/packages/page-staking-async/src/Validators/index.tsx index 5f7f376..02fdf5a 100644 --- a/packages/page-staking-async/src/Validators/index.tsx +++ b/packages/page-staking-async/src/Validators/index.tsx @@ -69,7 +69,7 @@ function Overview ({ className = '', favorites, hasAccounts, hasQueries, minComm ); useEffect((): void => { - toggleLedger && toggleLedger(); + toggleLedger?.(); }, [toggleLedger]); const isOwn = typeIndex === 0; diff --git a/packages/page-staking-legacy/src/Actions/Account/InjectKeys.tsx b/packages/page-staking-legacy/src/Actions/Account/InjectKeys.tsx index e003dc5..a9cc75b 100644 --- a/packages/page-staking-legacy/src/Actions/Account/InjectKeys.tsx +++ b/packages/page-staking-legacy/src/Actions/Account/InjectKeys.tsx @@ -62,7 +62,6 @@ function InjectKeys ({ onClose }: Props): React.ReactElement | null { const _onSubmit = useCallback( (): void => queueRpc({ - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment rpc: { method: 'insertKey', section: 'author' } as any, values: [keyType, suri, publicKey] }), diff --git a/packages/page-staking-legacy/src/Actions/Account/WarnBond.tsx b/packages/page-staking-legacy/src/Actions/Account/WarnBond.tsx index 366d101..27e33e7 100644 --- a/packages/page-staking-legacy/src/Actions/Account/WarnBond.tsx +++ b/packages/page-staking-legacy/src/Actions/Account/WarnBond.tsx @@ -20,7 +20,7 @@ function WarnBond ({ minBond, stakingInfo }: Props): React.ReactElement | const { t } = useTranslation(); const isBelow = useMemo( - () => minBond && stakingInfo && stakingInfo.stakingLedger.active.unwrap().lt(minBond), + () => minBond && stakingInfo?.stakingLedger.active.unwrap().lt(minBond), [minBond, stakingInfo] ); diff --git a/packages/page-staking-legacy/src/Actions/Account/index.tsx b/packages/page-staking-legacy/src/Actions/Account/index.tsx index 9d53799..ed31251 100644 --- a/packages/page-staking-legacy/src/Actions/Account/index.tsx +++ b/packages/page-staking-legacy/src/Actions/Account/index.tsx @@ -304,7 +304,7 @@ function Account ({ allSlashes, className = '', info: { controllerId, destinatio onClick={toggleRebond} /> diff --git a/packages/page-staking-legacy/src/Actions/Pool/useAccountInfo.ts b/packages/page-staking-legacy/src/Actions/Pool/useAccountInfo.ts index 067f05d..3133dc3 100644 --- a/packages/page-staking-legacy/src/Actions/Pool/useAccountInfo.ts +++ b/packages/page-staking-legacy/src/Actions/Pool/useAccountInfo.ts @@ -21,13 +21,14 @@ function useAccountInfoImpl (accountId: string): AccountInfo | null { const member = useCall(api.query.nominationPools.poolMembers, [accountId], OPT_DEL); useEffect((): void => { - member && + if (member) { api.call.nominationPoolsApi ?.pendingRewards(accountId) .then((claimable) => isMountedRef.current && setState({ claimable, member }) ) .catch(console.error); + } }, [accountId, member, api, isMountedRef]); return state; diff --git a/packages/page-staking-legacy/src/Actions/partials/Validate.tsx b/packages/page-staking-legacy/src/Actions/partials/Validate.tsx index fbd58d9..3e0eee7 100644 --- a/packages/page-staking-legacy/src/Actions/partials/Validate.tsx +++ b/packages/page-staking-legacy/src/Actions/partials/Validate.tsx @@ -44,7 +44,6 @@ function Validate ({ className = '', controllerId, minCommission, onChange, stas useEffect((): void => { try { onChange({ - // eslint-disable-next-line @typescript-eslint/no-explicit-any validateTx: api.tx.staking.validate({ blocked: !allowNoms, commission diff --git a/packages/page-staking-legacy/src/Actions/useInactives.ts b/packages/page-staking-legacy/src/Actions/useInactives.ts index fc4e951..6ce6e79 100644 --- a/packages/page-staking-legacy/src/Actions/useInactives.ts +++ b/packages/page-staking-legacy/src/Actions/useInactives.ts @@ -124,7 +124,7 @@ function useInactivesImpl (stashId: string, nominees?: string[]): Inactives { } return (): void => { - unsub && unsub(); + unsub?.(); }; }, [api, indexes, mountedRef, nominees, stashId]); diff --git a/packages/page-staking-legacy/src/Actions/useUnbondDuration.ts b/packages/page-staking-legacy/src/Actions/useUnbondDuration.ts index d4abb4f..10739c3 100644 --- a/packages/page-staking-legacy/src/Actions/useUnbondDuration.ts +++ b/packages/page-staking-legacy/src/Actions/useUnbondDuration.ts @@ -14,7 +14,7 @@ function useUnbondDurationImpl (): BN | undefined { const sessionInfo = useCall(api.derive.session.info); return useMemo( - () => (sessionInfo && sessionInfo.sessionLength.gt(BN_ONE)) + () => (sessionInfo?.sessionLength.gt(BN_ONE)) ? sessionInfo.eraLength.mul(api.consts.staking.bondingDuration) : undefined, [api, sessionInfo] diff --git a/packages/page-staking-legacy/src/Bags/Bag.tsx b/packages/page-staking-legacy/src/Bags/Bag.tsx index 02c1817..065ca1c 100644 --- a/packages/page-staking-legacy/src/Bags/Bag.tsx +++ b/packages/page-staking-legacy/src/Bags/Bag.tsx @@ -42,7 +42,7 @@ function Bag ({ bagLower, bagUpper, info, nodesOwn }: Props): React.ReactElement useEffect((): void => { info && nodesOwn && - setHeadId(([, trigger]) => [info.head.unwrapOr(null), ++trigger]); + setHeadId(([, trigger]) => [info.head.unwrapOr(null), trigger + 1]); }, [info, nodesOwn]); useEffect((): void => { diff --git a/packages/page-staking-legacy/src/Bags/useBagEntries.tsx b/packages/page-staking-legacy/src/Bags/useBagEntries.tsx index 3702af3..70e92e9 100644 --- a/packages/page-staking-legacy/src/Bags/useBagEntries.tsx +++ b/packages/page-staking-legacy/src/Bags/useBagEntries.tsx @@ -34,7 +34,7 @@ function useBagEntriesImpl (headId: AccountId32 | null, trigger: number): [boole ); useEffect((): void => { - if (node && node.isSome) { + if (node?.isSome) { const { next } = node.unwrap(); if (next.isSome) { diff --git a/packages/page-staking-legacy/src/Bags/useBagsList.ts b/packages/page-staking-legacy/src/Bags/useBagsList.ts index 010d388..d98b69e 100644 --- a/packages/page-staking-legacy/src/Bags/useBagsList.ts +++ b/packages/page-staking-legacy/src/Bags/useBagsList.ts @@ -43,7 +43,7 @@ const MULTI_OPTS = { }; function merge (prev: BagInfo[] | undefined, curr: BagInfo[]): BagInfo[] { - return !prev || curr.length !== prev.length + return curr.length !== prev?.length ? curr : curr.map((q, i) => JSON.stringify(q) === JSON.stringify(prev[i]) diff --git a/packages/page-staking-legacy/src/Payouts/useEraBlocks.ts b/packages/page-staking-legacy/src/Payouts/useEraBlocks.ts index 8ee0fd9..92e4561 100644 --- a/packages/page-staking-legacy/src/Payouts/useEraBlocks.ts +++ b/packages/page-staking-legacy/src/Payouts/useEraBlocks.ts @@ -16,7 +16,7 @@ function useEraBlocksImpl (historyDepth?: BN, era?: BN): BN | undefined { const forcing = useCall(api.query.staking.forceEra); return useMemo( - () => (historyDepth && era && forcing && progress && progress.sessionLength.gt(BN_ONE)) + () => (historyDepth && era && forcing && progress?.sessionLength.gt(BN_ONE)) ? ( forcing.isForceAlways ? progress.sessionLength diff --git a/packages/page-staking-legacy/src/Query/useBlockCounts.tsx b/packages/page-staking-legacy/src/Query/useBlockCounts.tsx index 9a7ef3d..793a6e3 100644 --- a/packages/page-staking-legacy/src/Query/useBlockCounts.tsx +++ b/packages/page-staking-legacy/src/Query/useBlockCounts.tsx @@ -25,7 +25,7 @@ function useBlockCountsImpl (accountId: string, sessionRewards: SessionRewards[] if (filtered.length) { Promise .all(filtered.map(({ parentHash, sessionIndex }): Promise => - // eslint-disable-next-line deprecation/deprecation + // eslint-disable-next-line @typescript-eslint/no-deprecated api.query.imOnline.authoredBlocks.at(parentHash, sessionIndex.sub(BN_ONE), accountId) )) .then((historic): void => { diff --git a/packages/page-staking-legacy/src/Slashes/Row.tsx b/packages/page-staking-legacy/src/Slashes/Row.tsx index 1a422aa..9be4401 100644 --- a/packages/page-staking-legacy/src/Slashes/Row.tsx +++ b/packages/page-staking-legacy/src/Slashes/Row.tsx @@ -24,7 +24,7 @@ function Row ({ index, isSelected, onSelect, slash: { era, isMine, slash: { othe const { api } = useApi(); const _onSelect = useCallback( - () => onSelect && onSelect(index), + () => onSelect?.(index), [index, onSelect] ); diff --git a/packages/page-staking-legacy/src/Targets/index.tsx b/packages/page-staking-legacy/src/Targets/index.tsx index d65f58f..091b1e6 100644 --- a/packages/page-staking-legacy/src/Targets/index.tsx +++ b/packages/page-staking-legacy/src/Targets/index.tsx @@ -101,7 +101,7 @@ function applyFilter (validators: ValidatorInfo[], medianComm: number, allIdenti ) { if (!withGroup) { return true; - } else if (!thisIdentity || !thisIdentity.hasIdentity) { + } else if (!thisIdentity?.hasIdentity) { parentIds.push(stashId); return true; @@ -288,7 +288,6 @@ function Targets ({ className = '', isInElection, nominatedBy, ownStashes, targe ); // False positive, this is part of the type... - // eslint-disable-next-line func-call-spacing const header = useMemo<[React.ReactNode?, string?, number?, (() => void)?][]>(() => [ [t('validators'), 'start', 4], [t('payout'), 'media--1400'], diff --git a/packages/page-staking-legacy/src/Validators/Address/StakeOther.tsx b/packages/page-staking-legacy/src/Validators/Address/StakeOther.tsx index d7b1361..80da94c 100644 --- a/packages/page-staking-legacy/src/Validators/Address/StakeOther.tsx +++ b/packages/page-staking-legacy/src/Validators/Address/StakeOther.tsx @@ -70,7 +70,7 @@ function StakeOther ({ nominators, stakeOther }: Props): React.ReactElement - {(!rewarded || rewarded[0] !== 0) && ( + {(rewarded?.[0] !== 0) && ( { - toggleLedger && toggleLedger(); + toggleLedger?.(); }, [toggleLedger]); const isOwn = typeIndex === 0; diff --git a/packages/page-staking-legacy/src/useSortedTargets.ts b/packages/page-staking-legacy/src/useSortedTargets.ts index 89b96e8..bebe5fb 100644 --- a/packages/page-staking-legacy/src/useSortedTargets.ts +++ b/packages/page-staking-legacy/src/useSortedTargets.ts @@ -56,10 +56,10 @@ const OPT_MULTI = { counterForNominators, counterForValidators, historyDepth, - maxNominatorsCount: optMaxNominatorsCount && optMaxNominatorsCount.isSome + maxNominatorsCount: optMaxNominatorsCount?.isSome ? optMaxNominatorsCount.unwrap() : undefined, - maxValidatorsCount: optMaxValidatorsCount && optMaxValidatorsCount.isSome + maxValidatorsCount: optMaxValidatorsCount?.isSome ? optMaxValidatorsCount.unwrap() : undefined, minNominatorBond, @@ -171,7 +171,7 @@ function extractSingle (api: ApiPromise, allAccounts: string[], derive: DeriveSt commissionPer: validatorPrefs.commission.unwrap().toNumber() / 10_000_000, exposure: exposureEraStakers, isActive: !skipRewards, - isBlocking: !!(validatorPrefs.blocked && validatorPrefs.blocked.isTrue), + isBlocking: !!(validatorPrefs.blocked?.isTrue), isElected: !isWaitingDerive(derive) && derive.nextElected.some((e) => e.eq(accountId)), isFavorite: favorites.includes(key), isNominating: (exposureEraStakers.others || []).reduce((isNominating, indv): boolean => { diff --git a/packages/page-staking/src/Actions/Account/InjectKeys.tsx b/packages/page-staking/src/Actions/Account/InjectKeys.tsx index 838c19a..41e06cb 100644 --- a/packages/page-staking/src/Actions/Account/InjectKeys.tsx +++ b/packages/page-staking/src/Actions/Account/InjectKeys.tsx @@ -63,7 +63,6 @@ function InjectKeys ({ onClose }: Props): React.ReactElement | null { const _onSubmit = useCallback( (): void => queueRpc({ - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment rpc: { method: 'insertKey', section: 'author' } as any, values: [keyType, suri, publicKey] }), diff --git a/packages/page-staking/src/Actions/Account/WarnBond.tsx b/packages/page-staking/src/Actions/Account/WarnBond.tsx index 366d101..27e33e7 100644 --- a/packages/page-staking/src/Actions/Account/WarnBond.tsx +++ b/packages/page-staking/src/Actions/Account/WarnBond.tsx @@ -20,7 +20,7 @@ function WarnBond ({ minBond, stakingInfo }: Props): React.ReactElement | const { t } = useTranslation(); const isBelow = useMemo( - () => minBond && stakingInfo && stakingInfo.stakingLedger.active.unwrap().lt(minBond), + () => minBond && stakingInfo?.stakingLedger.active.unwrap().lt(minBond), [minBond, stakingInfo] ); diff --git a/packages/page-staking/src/Actions/Account/index.tsx b/packages/page-staking/src/Actions/Account/index.tsx index 9d53799..ed31251 100644 --- a/packages/page-staking/src/Actions/Account/index.tsx +++ b/packages/page-staking/src/Actions/Account/index.tsx @@ -304,7 +304,7 @@ function Account ({ allSlashes, className = '', info: { controllerId, destinatio onClick={toggleRebond} /> diff --git a/packages/page-staking/src/Actions/Pool/useAccountInfo.ts b/packages/page-staking/src/Actions/Pool/useAccountInfo.ts index 067f05d..3133dc3 100644 --- a/packages/page-staking/src/Actions/Pool/useAccountInfo.ts +++ b/packages/page-staking/src/Actions/Pool/useAccountInfo.ts @@ -21,13 +21,14 @@ function useAccountInfoImpl (accountId: string): AccountInfo | null { const member = useCall(api.query.nominationPools.poolMembers, [accountId], OPT_DEL); useEffect((): void => { - member && + if (member) { api.call.nominationPoolsApi ?.pendingRewards(accountId) .then((claimable) => isMountedRef.current && setState({ claimable, member }) ) .catch(console.error); + } }, [accountId, member, api, isMountedRef]); return state; diff --git a/packages/page-staking/src/Actions/partials/Validate.tsx b/packages/page-staking/src/Actions/partials/Validate.tsx index fbd58d9..3e0eee7 100644 --- a/packages/page-staking/src/Actions/partials/Validate.tsx +++ b/packages/page-staking/src/Actions/partials/Validate.tsx @@ -44,7 +44,6 @@ function Validate ({ className = '', controllerId, minCommission, onChange, stas useEffect((): void => { try { onChange({ - // eslint-disable-next-line @typescript-eslint/no-explicit-any validateTx: api.tx.staking.validate({ blocked: !allowNoms, commission diff --git a/packages/page-staking/src/Actions/useInactives.ts b/packages/page-staking/src/Actions/useInactives.ts index a4e551f..de7d1fa 100644 --- a/packages/page-staking/src/Actions/useInactives.ts +++ b/packages/page-staking/src/Actions/useInactives.ts @@ -25,7 +25,7 @@ interface ExtractStateParams { stashId: string; slashes: Option[]; nominees: string[]; - activeEra: EraIndex| undefined; + activeEra: EraIndex | undefined; submittedIn: EraIndex; exposures: Exposure[]; version: number | undefined; @@ -188,8 +188,8 @@ function useInactivesImpl (stashId: string, nominees?: string[], eraExposure?: D api.queryMulti( [[api.query.staking.nominators, stashId] as QueryableStorageMultiArg<'promise'>] .concat( - nominees.map((id) => [api.query.staking.slashingSpans, id])) - , ([optNominators, ...slashingSpans]: [Option, ...(Option)[]]): void => { + nominees.map((id) => [api.query.staking.slashingSpans, id])), + ([optNominators, ...slashingSpans]: [Option, ...(Option)[]]): void => { setSubmittedIn(optNominators.unwrapOrDefault().submittedIn); setSlashes(slashingSpans); }) @@ -200,7 +200,7 @@ function useInactivesImpl (stashId: string, nominees?: string[], eraExposure?: D } return (): void => { - unsub && unsub(); + unsub?.(); }; }, [api, indexes, mountedRef, nominees, stashId]); @@ -216,8 +216,8 @@ function useInactivesImpl (stashId: string, nominees?: string[], eraExposure?: D api.queryMulti( api.query.staking.erasStakers ? nominees.map((id) => [api.query.staking.erasStakers, [indexes?.activeEra, id]]) - : nominees.map((id) => [api.query.staking.stakers, id]) - , (exposures: Exposure[]): void => setExposures(exposures)) + : nominees.map((id) => [api.query.staking.stakers, id]), + (exposures: Exposure[]): void => setExposures(exposures)) .then((_unsub): void => { unsub = _unsub; }) @@ -225,7 +225,7 @@ function useInactivesImpl (stashId: string, nominees?: string[], eraExposure?: D } return (): void => { - unsub && unsub(); + unsub?.(); }; }, [api, indexes, mountedRef, nominees, stashId, version]); diff --git a/packages/page-staking/src/Actions/useUnbondDuration.ts b/packages/page-staking/src/Actions/useUnbondDuration.ts index d4abb4f..10739c3 100644 --- a/packages/page-staking/src/Actions/useUnbondDuration.ts +++ b/packages/page-staking/src/Actions/useUnbondDuration.ts @@ -14,7 +14,7 @@ function useUnbondDurationImpl (): BN | undefined { const sessionInfo = useCall(api.derive.session.info); return useMemo( - () => (sessionInfo && sessionInfo.sessionLength.gt(BN_ONE)) + () => (sessionInfo?.sessionLength.gt(BN_ONE)) ? sessionInfo.eraLength.mul(api.consts.staking.bondingDuration) : undefined, [api, sessionInfo] diff --git a/packages/page-staking/src/Bags/Bag.tsx b/packages/page-staking/src/Bags/Bag.tsx index 02c1817..065ca1c 100644 --- a/packages/page-staking/src/Bags/Bag.tsx +++ b/packages/page-staking/src/Bags/Bag.tsx @@ -42,7 +42,7 @@ function Bag ({ bagLower, bagUpper, info, nodesOwn }: Props): React.ReactElement useEffect((): void => { info && nodesOwn && - setHeadId(([, trigger]) => [info.head.unwrapOr(null), ++trigger]); + setHeadId(([, trigger]) => [info.head.unwrapOr(null), trigger + 1]); }, [info, nodesOwn]); useEffect((): void => { diff --git a/packages/page-staking/src/Bags/useBagEntries.tsx b/packages/page-staking/src/Bags/useBagEntries.tsx index 3702af3..70e92e9 100644 --- a/packages/page-staking/src/Bags/useBagEntries.tsx +++ b/packages/page-staking/src/Bags/useBagEntries.tsx @@ -34,7 +34,7 @@ function useBagEntriesImpl (headId: AccountId32 | null, trigger: number): [boole ); useEffect((): void => { - if (node && node.isSome) { + if (node?.isSome) { const { next } = node.unwrap(); if (next.isSome) { diff --git a/packages/page-staking/src/Bags/useBagsList.ts b/packages/page-staking/src/Bags/useBagsList.ts index 010d388..d98b69e 100644 --- a/packages/page-staking/src/Bags/useBagsList.ts +++ b/packages/page-staking/src/Bags/useBagsList.ts @@ -43,7 +43,7 @@ const MULTI_OPTS = { }; function merge (prev: BagInfo[] | undefined, curr: BagInfo[]): BagInfo[] { - return !prev || curr.length !== prev.length + return curr.length !== prev?.length ? curr : curr.map((q, i) => JSON.stringify(q) === JSON.stringify(prev[i]) diff --git a/packages/page-staking/src/Payouts/useEraBlocks.ts b/packages/page-staking/src/Payouts/useEraBlocks.ts index 8ee0fd9..92e4561 100644 --- a/packages/page-staking/src/Payouts/useEraBlocks.ts +++ b/packages/page-staking/src/Payouts/useEraBlocks.ts @@ -16,7 +16,7 @@ function useEraBlocksImpl (historyDepth?: BN, era?: BN): BN | undefined { const forcing = useCall(api.query.staking.forceEra); return useMemo( - () => (historyDepth && era && forcing && progress && progress.sessionLength.gt(BN_ONE)) + () => (historyDepth && era && forcing && progress?.sessionLength.gt(BN_ONE)) ? ( forcing.isForceAlways ? progress.sessionLength diff --git a/packages/page-staking/src/Query/useBlockCounts.tsx b/packages/page-staking/src/Query/useBlockCounts.tsx index 9a7ef3d..793a6e3 100644 --- a/packages/page-staking/src/Query/useBlockCounts.tsx +++ b/packages/page-staking/src/Query/useBlockCounts.tsx @@ -25,7 +25,7 @@ function useBlockCountsImpl (accountId: string, sessionRewards: SessionRewards[] if (filtered.length) { Promise .all(filtered.map(({ parentHash, sessionIndex }): Promise => - // eslint-disable-next-line deprecation/deprecation + // eslint-disable-next-line @typescript-eslint/no-deprecated api.query.imOnline.authoredBlocks.at(parentHash, sessionIndex.sub(BN_ONE), accountId) )) .then((historic): void => { diff --git a/packages/page-staking/src/Slashes/Row.tsx b/packages/page-staking/src/Slashes/Row.tsx index 1a422aa..9be4401 100644 --- a/packages/page-staking/src/Slashes/Row.tsx +++ b/packages/page-staking/src/Slashes/Row.tsx @@ -24,7 +24,7 @@ function Row ({ index, isSelected, onSelect, slash: { era, isMine, slash: { othe const { api } = useApi(); const _onSelect = useCallback( - () => onSelect && onSelect(index), + () => onSelect?.(index), [index, onSelect] ); diff --git a/packages/page-staking/src/Targets/index.tsx b/packages/page-staking/src/Targets/index.tsx index bdc524a..d276bf7 100644 --- a/packages/page-staking/src/Targets/index.tsx +++ b/packages/page-staking/src/Targets/index.tsx @@ -100,7 +100,7 @@ function applyFilter (validators: ValidatorInfo[], medianComm: number, allIdenti ) { if (!withGroup) { return true; - } else if (!thisIdentity || !thisIdentity.hasIdentity) { + } else if (!thisIdentity?.hasIdentity) { parentIds.push(stashId); return true; @@ -287,7 +287,6 @@ function Targets ({ className = '', isInElection, nominatedBy, ownStashes, targe ); // False positive, this is part of the type... - // eslint-disable-next-line func-call-spacing const header = useMemo<[React.ReactNode?, string?, number?, (() => void)?][]>(() => [ [t('validators'), 'start', 4], [t('payout'), 'media--1400'], diff --git a/packages/page-staking/src/Validators/Address/StakeOther.tsx b/packages/page-staking/src/Validators/Address/StakeOther.tsx index d7b1361..80da94c 100644 --- a/packages/page-staking/src/Validators/Address/StakeOther.tsx +++ b/packages/page-staking/src/Validators/Address/StakeOther.tsx @@ -70,7 +70,7 @@ function StakeOther ({ nominators, stakeOther }: Props): React.ReactElement - {(!rewarded || rewarded[0] !== 0) && ( + {(rewarded?.[0] !== 0) && ( { - toggleLedger && toggleLedger(); + toggleLedger?.(); }, [toggleLedger]); const isOwn = typeIndex === 0; diff --git a/packages/page-staking/src/useSortedTargets.ts b/packages/page-staking/src/useSortedTargets.ts index 9cb753a..73f17e4 100644 --- a/packages/page-staking/src/useSortedTargets.ts +++ b/packages/page-staking/src/useSortedTargets.ts @@ -56,10 +56,10 @@ const OPT_MULTI = { counterForNominators, counterForValidators, historyDepth, - maxNominatorsCount: optMaxNominatorsCount && optMaxNominatorsCount.isSome + maxNominatorsCount: optMaxNominatorsCount?.isSome ? optMaxNominatorsCount.unwrap() : undefined, - maxValidatorsCount: optMaxValidatorsCount && optMaxValidatorsCount.isSome + maxValidatorsCount: optMaxValidatorsCount?.isSome ? optMaxValidatorsCount.unwrap() : undefined, minNominatorBond, @@ -176,7 +176,7 @@ function extractSingle (api: ApiPromise, allAccounts: string[], derive: DeriveSt exposureMeta: expMeta || emptyExposureMeta, exposurePaged: exp || emptyExposure, isActive: !skipRewards, - isBlocking: !!(validatorPrefs.blocked && validatorPrefs.blocked.isTrue), + isBlocking: !!(validatorPrefs.blocked?.isTrue), isElected: !isWaitingDerive(derive) && derive.nextElected.some((e) => e.eq(accountId)), isFavorite: favorites.includes(key), isNominating: ((exp && exp.others) || []).reduce((isNominating, indv): boolean => { diff --git a/packages/page-staking2/src/Validators/Active/Status.tsx b/packages/page-staking2/src/Validators/Active/Status.tsx index 08f98a4..7007f6f 100644 --- a/packages/page-staking2/src/Validators/Active/Status.tsx +++ b/packages/page-staking2/src/Validators/Active/Status.tsx @@ -21,7 +21,7 @@ function Status ({ className, heartbeat: { authoredBlocks, isOnline } = {}, isCh const { allAccounts } = useAccounts(); const isNominating = useMemo( - () => nominators && nominators.some((a) => allAccounts.includes(a)), + () => nominators?.some((a) => allAccounts.includes(a)), [allAccounts, nominators] ); diff --git a/packages/page-storage/src/Query.tsx b/packages/page-storage/src/Query.tsx index 9864a33..4b9bc9e 100644 --- a/packages/page-storage/src/Query.tsx +++ b/packages/page-storage/src/Query.tsx @@ -30,7 +30,7 @@ interface CacheInstance { refresh: (swallowErrors: boolean) => React.ComponentType; } -const cache: CacheInstance[] = []; +const cache = new Map(); function keyToName (isConst: boolean, _key: Uint8Array | QueryableStorageEntry<'promise'> | ConstValue): string { if (isConst) { @@ -83,7 +83,9 @@ function createComponent (type: string, Component: React.ComponentType, def function getCachedComponent (registry: Registry, query: QueryTypes): CacheInstance { const { blockHash, id, isConst, key, params = [] } = query as StorageModuleQuery; - if (!cache[id]) { + let instance = cache.get(id); + + if (!instance) { let renderHelper; let type: string; @@ -116,7 +118,7 @@ function getCachedComponent (registry: Registry, query: QueryTypes): CacheInstan params: isEntries ? [key.entries, ...values] : blockHash - // eslint-disable-next-line deprecation/deprecation + // eslint-disable-next-line @typescript-eslint/no-deprecated ? [key.at, blockHash, ...values] : [key, ...values], withIndicator: true @@ -135,10 +137,11 @@ function getCachedComponent (registry: Registry, query: QueryTypes): CacheInstan defaultProps ); - cache[query.id] = createComponent(type, Component, defaultProps, renderHelper); + instance = createComponent(type, Component, defaultProps, renderHelper); + cache.set(id, instance); } - return cache[id]; + return instance; } function Query ({ className = '', onRemove, value }: Props): React.ReactElement | null { @@ -158,7 +161,7 @@ function Query ({ className = '', onRemove, value }: Props): React.ReactElement< const _onRemove = useCallback( (): void => { - delete cache[value.id]; + cache.delete(value.id); onRemove(value.id); }, diff --git a/packages/page-storage/src/Selection/Modules.tsx b/packages/page-storage/src/Selection/Modules.tsx index 6e1b66f..4b83b8d 100644 --- a/packages/page-storage/src/Selection/Modules.tsx +++ b/packages/page-storage/src/Selection/Modules.tsx @@ -60,18 +60,16 @@ function expandParams (registry: Registry, st: StorageEntryTypeLatest, isIterabl } return types.map((str, index) => { - let name: string | undefined; let type: TypeDefExt; if (isIterable && index === (types.length - 1)) { - // name = 'entryKey'; type = getTypeDef(`Option<${str}>`); type.withOptionActive = true; } else { type = getTypeDef(str); } - return { name, type }; + return { name: undefined, type }; }); } diff --git a/packages/page-teyrchains/src/Crowdloan/Contribute.tsx b/packages/page-teyrchains/src/Crowdloan/Contribute.tsx index 3a931ad..1a63798 100644 --- a/packages/page-teyrchains/src/Crowdloan/Contribute.tsx +++ b/packages/page-teyrchains/src/Crowdloan/Contribute.tsx @@ -57,7 +57,7 @@ function Contribute ({ cap, className, needsSignature, paraId, raised }: Props): const remaining = cap.sub(raised); const isAmountBelow = !amount || amount.lt(api.consts.crowdloan.minContribution as BalanceOf); - const isAmountOver = !!(amount && amount.gt(remaining)); + const isAmountOver = !!(amount?.gt(remaining)); const isAmountError = isAmountBelow || isAmountOver; const minContribution = api.consts.crowdloan.minContribution as BlockNumber; diff --git a/packages/page-teyrchains/src/Crowdloan/Fund.tsx b/packages/page-teyrchains/src/Crowdloan/Fund.tsx index 3fb84c0..6277f95 100644 --- a/packages/page-teyrchains/src/Crowdloan/Fund.tsx +++ b/packages/page-teyrchains/src/Crowdloan/Fund.tsx @@ -186,7 +186,7 @@ function Fund ({ bestHash, bestNumber, className = '', isOngoing, leasePeriod, v ); } -interface IDissolveCrowdloan{ +interface IDissolveCrowdloan { isEnded?: boolean; paraId: ParaId; isDepositor: boolean; diff --git a/packages/page-teyrchains/src/Overview/Teyrchain.tsx b/packages/page-teyrchains/src/Overview/Teyrchain.tsx index 3c04ee4..a240790 100644 --- a/packages/page-teyrchains/src/Overview/Teyrchain.tsx +++ b/packages/page-teyrchains/src/Overview/Teyrchain.tsx @@ -124,7 +124,7 @@ function Teyrchain ({ bestNumber, className = '', id, lastBacked, lastInclusion,
{paraInfo.headHex}
- {/* eslint-disable-next-line @typescript-eslint/no-explicit-any */} + {} {paraInfo.updateAt && bestNumber && (paraInfo.lifecycle as any)?.isTeyrchain ? ( <> diff --git a/packages/page-teyrchains/src/Overview/useEvents.ts b/packages/page-teyrchains/src/Overview/useEvents.ts index d5db68d..3b36fe1 100644 --- a/packages/page-teyrchains/src/Overview/useEvents.ts +++ b/packages/page-teyrchains/src/Overview/useEvents.ts @@ -36,7 +36,7 @@ function includeEntry (map: EventMap, event: Event, blockHash: string, blockNumb }; } } catch (error) { - throw new Error(`${event.section}.${event.method}(${stringify(event.data)}):: ${(error as Error).message}`); + throw new Error(`${event.section}.${event.method}(${stringify(event.data)}):: ${(error as Error).message}`, { cause: error }); } } diff --git a/packages/page-teyrchains/src/Overview/useValidators.ts b/packages/page-teyrchains/src/Overview/useValidators.ts index d4e95a7..9733ebe 100644 --- a/packages/page-teyrchains/src/Overview/useValidators.ts +++ b/packages/page-teyrchains/src/Overview/useValidators.ts @@ -20,7 +20,7 @@ function mapValidators (startWith: Record return ids.reduce((all: Record, id) => { // paraId should never be undefined, since it comes from the state, yet here we are... // See https://github.com/pezkuwichain/pezkuwi-apps/issues/6435 - const assignment = scheduled.find(({ paraId }) => paraId && paraId.eq(id)); + const assignment = scheduled.find(({ paraId }) => paraId?.eq(id)); if (!assignment) { return all; diff --git a/packages/page-teyrchains/src/Parathreads/DeregisterId.tsx b/packages/page-teyrchains/src/Parathreads/DeregisterId.tsx index 8bf3956..faf485b 100644 --- a/packages/page-teyrchains/src/Parathreads/DeregisterId.tsx +++ b/packages/page-teyrchains/src/Parathreads/DeregisterId.tsx @@ -35,7 +35,7 @@ function DeregisterId ({ className, nextParaId, onClose, ownedIds }: Props): Rea [] ); - const isIdError = !paraId || !paraId.gt(LOWEST_INVALID_ID); + const isIdError = !paraId?.gt(LOWEST_INVALID_ID); const extrinsic = useMemo(() => api.tx.registrar.deregister(paraId), [api.tx.registrar, paraId]); diff --git a/packages/page-teyrchains/src/Parathreads/RegisterThread.tsx b/packages/page-teyrchains/src/Parathreads/RegisterThread.tsx index 8858add..e803ee8 100644 --- a/packages/page-teyrchains/src/Parathreads/RegisterThread.tsx +++ b/packages/page-teyrchains/src/Parathreads/RegisterThread.tsx @@ -62,7 +62,7 @@ function RegisterThread ({ className, nextParaId, onClose, ownedIds }: Props): R [api, wasm, genesisState, paraConfig] ); - const isIdError = !paraId || !paraId.gt(LOWEST_INVALID_ID); + const isIdError = !paraId?.gt(LOWEST_INVALID_ID); return ( a.eq(id)), isScheduled: scheduled.some(({ scheduledIds }) => scheduledIds.some((s) => s.eq(id))), - proposal: opt && opt.isSome + proposal: opt?.isSome ? opt.unwrap() : undefined }), diff --git a/packages/page-teyrchains/src/Teleport.tsx b/packages/page-teyrchains/src/Teleport.tsx index 0f9547a..2d0962a 100644 --- a/packages/page-teyrchains/src/Teleport.tsx +++ b/packages/page-teyrchains/src/Teleport.tsx @@ -84,7 +84,11 @@ function Teleport ({ onClose }: Props): React.ReactElement | null { const call = useMemo( (): SubmittableExtrinsicFunction<'promise'> => { - const m = XCM_LOC.filter((x) => api.tx[x] && isFunction(api.tx[x].limitedTeleportAssets))[0]; + const m = XCM_LOC.find((x) => api.tx[x] && isFunction(api.tx[x].limitedTeleportAssets)); + + if (!m) { + throw new Error(`None of ${XCM_LOC.join(', ')} has limitedTeleportAssets`); + } return api.tx[m].limitedTeleportAssets; }, diff --git a/packages/page-teyrchains/src/useFunds.ts b/packages/page-teyrchains/src/useFunds.ts index 6102712..bd05aad 100644 --- a/packages/page-teyrchains/src/useFunds.ts +++ b/packages/page-teyrchains/src/useFunds.ts @@ -85,7 +85,7 @@ function createResult (bestNumber: BlockNumber, minContribution: BN, funds: Camp const hasNewTotalCap = !prev.totalCap.eq(totalCap); const hasNewTotalRaised = !prev.totalRaised.eq(totalRaised); const hasChanged = - !prev.funds || prev.funds.length !== funds.length || + prev.funds?.length !== funds.length || hasNewActiveCap || hasNewActiveRaised || hasNewTotalCap || hasNewTotalRaised || funds.some((c) => isFundUpdated(bestNumber, minContribution, c, leased, prev)); diff --git a/packages/react-api/src/Api.tsx b/packages/react-api/src/Api.tsx index e080083..6bf536e 100644 --- a/packages/react-api/src/Api.tsx +++ b/packages/react-api/src/Api.tsx @@ -226,10 +226,8 @@ async function getLightProvider (chain: string): Promise { return relay; } - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const specMod = await import(`${lightSpecs[relayName][paraName]}`); - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access return new ScProvider(Sc, JSON.stringify(specMod.default), relay); } diff --git a/packages/react-api/src/hoc/api.tsx b/packages/react-api/src/hoc/api.tsx index 62227de..b5634d9 100644 --- a/packages/react-api/src/hoc/api.tsx +++ b/packages/react-api/src/hoc/api.tsx @@ -24,7 +24,6 @@ export default function withApi

(Inner: React.ComponentType {...defaultProps} {...(apiProps as any)} {...this.props} - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment ref={this.component} /> ); diff --git a/packages/react-api/src/hoc/call.tsx b/packages/react-api/src/hoc/call.tsx index 35a159c..62943f7 100644 --- a/packages/react-api/src/hoc/call.tsx +++ b/packages/react-api/src/hoc/call.tsx @@ -3,12 +3,6 @@ // SInce this file is deemed deprecated (and awaiting removal), we just don't care -/* eslint-disable @typescript-eslint/no-unsafe-call */ -/* eslint-disable @typescript-eslint/restrict-template-expressions */ -/* eslint-disable @typescript-eslint/no-unsafe-return */ -/* eslint-disable @typescript-eslint/no-unsafe-member-access */ -/* eslint-disable @typescript-eslint/no-unsafe-assignment */ - import type { ApiProps, CallState as State, OnChangeCb, SubtractProps } from '../types.js'; import type { Options } from './types.js'; diff --git a/packages/react-api/src/hoc/callDiv.tsx b/packages/react-api/src/hoc/callDiv.tsx index ef8682f..52e46cf 100644 --- a/packages/react-api/src/hoc/callDiv.tsx +++ b/packages/react-api/src/hoc/callDiv.tsx @@ -12,10 +12,8 @@ interface Props extends BaseProps { callResult?: T; } -// eslint-disable-next-line @typescript-eslint/explicit-function-return-type export default function withCallDiv (endpoint: string, options: Options = {}) { return (render: (value?: T) => React.ReactNode, defaultProps: DefaultProps = {}): React.ComponentType => { - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment function Inner ({ callResult, callUpdated, children, className = defaultProps.className, label = '' }: any): React.ReactElement> { return (

(observable: Observable

, { callO public override render (): React.ReactNode { const { children } = this.props; - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment const { callResult, callUpdated, callUpdatedAt } = this.state; const _props = { ...defaultProps, diff --git a/packages/react-api/src/hoc/onlyOn.tsx b/packages/react-api/src/hoc/onlyOn.tsx index b677bf8..460e1ea 100644 --- a/packages/react-api/src/hoc/onlyOn.tsx +++ b/packages/react-api/src/hoc/onlyOn.tsx @@ -11,7 +11,6 @@ const onlyOn = (environment: Environment) => >(comp return component; } - // eslint-disable-next-line react/display-name return () => null; }; diff --git a/packages/react-api/src/util/getEnvironment.ts b/packages/react-api/src/util/getEnvironment.ts index 565d334..ca46a98 100644 --- a/packages/react-api/src/util/getEnvironment.ts +++ b/packages/react-api/src/util/getEnvironment.ts @@ -11,7 +11,7 @@ function isElectron () { return true; } - return navigator?.userAgent?.indexOf('Electron') >= 0; + return !!navigator?.userAgent?.includes('Electron'); } export function getEnvironment (): Environment { diff --git a/packages/react-components/src/AccountSidebar/AccountMenuButtons.tsx b/packages/react-components/src/AccountSidebar/AccountMenuButtons.tsx index 265f664..545c626 100644 --- a/packages/react-components/src/AccountSidebar/AccountMenuButtons.tsx +++ b/packages/react-components/src/AccountSidebar/AccountMenuButtons.tsx @@ -36,7 +36,7 @@ function AccountMenuButtons ({ className = '', flags, isEditing, isEditingName, const _onForgetAddress = useCallback( (): void => { onForgetAddress(); - onUpdateName && onUpdateName(); + onUpdateName?.(); }, [onForgetAddress, onUpdateName] ); @@ -49,7 +49,7 @@ function AccountMenuButtons ({ className = '', flags, isEditing, isEditingName, const _onUpdateName = useCallback( (): void => { onSaveName(); - onUpdateName && onUpdateName(); + onUpdateName?.(); }, [onSaveName, onUpdateName] ); diff --git a/packages/react-components/src/AccountSidebar/Identity.tsx b/packages/react-components/src/AccountSidebar/Identity.tsx index 21b74b8..680fb24 100644 --- a/packages/react-components/src/AccountSidebar/Identity.tsx +++ b/packages/react-components/src/AccountSidebar/Identity.tsx @@ -39,8 +39,8 @@ function Identity ({ address, identity }: Props): React.ReactElement | nu key={sub.toString()} value={sub} /> - ) - , [subs] + ), + [subs] ); if (!identity || !identity.isExistent || !apiIdentity.query.identity?.identityOf) { diff --git a/packages/react-components/src/AccountSidebar/UserIcon.tsx b/packages/react-components/src/AccountSidebar/UserIcon.tsx index 03920a1..454f71e 100644 --- a/packages/react-components/src/AccountSidebar/UserIcon.tsx +++ b/packages/react-components/src/AccountSidebar/UserIcon.tsx @@ -16,7 +16,6 @@ function UserIcon (): React.ReactElement { diff --git a/packages/react-components/src/AddressInfo.tsx b/packages/react-components/src/AddressInfo.tsx index 19cd5ab..5685550 100644 --- a/packages/react-components/src/AddressInfo.tsx +++ b/packages/react-components/src/AddressInfo.tsx @@ -487,7 +487,7 @@ function createBalanceItems (formatIndex: number, lookup: Record

); - } else if (bestNumber && votingOf && votingOf.isDirect) { + } else if (bestNumber && votingOf?.isDirect) { const { prior: [unlockAt, balance] } = votingOf.asDirect; balance.gt(BN_ZERO) && unlockAt.gt(BN_ZERO) && allItems.push( diff --git a/packages/react-components/src/AddressToggle.tsx b/packages/react-components/src/AddressToggle.tsx index 6c3564e..cb6b902 100644 --- a/packages/react-components/src/AddressToggle.tsx +++ b/packages/react-components/src/AddressToggle.tsx @@ -30,7 +30,7 @@ function AddressToggle ({ address, className = '', filter, isHidden, noToggle, o ); const _onClick = useCallback( - () => onChange && onChange(!value), + () => onChange?.(!value), [onChange, value] ); diff --git a/packages/react-components/src/Chart/HorizBar.tsx b/packages/react-components/src/Chart/HorizBar.tsx index 58637ee..cada53c 100644 --- a/packages/react-components/src/Chart/HorizBar.tsx +++ b/packages/react-components/src/Chart/HorizBar.tsx @@ -105,10 +105,8 @@ function ChartHorizBar ({ aspectRatio = 8, className = '', max = 100, showLabels return (
diff --git a/packages/react-components/src/Chart/Line.tsx b/packages/react-components/src/Chart/Line.tsx index 135895b..45a5fcf 100644 --- a/packages/react-components/src/Chart/Line.tsx +++ b/packages/react-components/src/Chart/Line.tsx @@ -88,7 +88,6 @@ function getOptions (options: ChartOptions = {}): DatasetChartOptions<'line'> { // Re-spread plugins for deep(er) copy plugins: objectSpread({}, BASE_OPTS.plugins, options.plugins, { // Same applied to plugins, we may want specific values - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument annotation: objectSpread({}, BASE_OPTS.plugins?.annotation, options.plugins?.annotation), crosshair: objectSpread({}, BASE_OPTS.plugins?.crosshair, options.plugins?.crosshair), tooltip: objectSpread({}, BASE_OPTS.plugins?.tooltip, options.plugins?.tooltip) diff --git a/packages/react-components/src/Checkbox.tsx b/packages/react-components/src/Checkbox.tsx index c61b986..d6500e3 100644 --- a/packages/react-components/src/Checkbox.tsx +++ b/packages/react-components/src/Checkbox.tsx @@ -17,7 +17,7 @@ interface Props { function Checkbox ({ className = '', isDisabled, label, onChange, value }: Props): React.ReactElement { const _onClick = useCallback( (): void => { - !isDisabled && onChange && onChange(!value); + !isDisabled && onChange?.(!value); }, [isDisabled, onChange, value] ); diff --git a/packages/react-components/src/ConvictionDropdown.tsx b/packages/react-components/src/ConvictionDropdown.tsx index 8a7a989..3cf366d 100644 --- a/packages/react-components/src/ConvictionDropdown.tsx +++ b/packages/react-components/src/ConvictionDropdown.tsx @@ -27,7 +27,7 @@ function createOptions (blockTime: BN, voteLockingPeriod: BN, t: (key: string, o text: t('{{value}}x voting balance, locked for {{duration}}x duration{{period}}', { replace: { duration, - period: voteLockingPeriod && voteLockingPeriod.gt(BN_ZERO) + period: voteLockingPeriod?.gt(BN_ZERO) ? ` (${calcBlockTime(blockTime, durationBn.mul(voteLockingPeriod), t)[1]})` : '', value diff --git a/packages/react-components/src/CopyButton.tsx b/packages/react-components/src/CopyButton.tsx index ec486ea..6e7063d 100644 --- a/packages/react-components/src/CopyButton.tsx +++ b/packages/react-components/src/CopyButton.tsx @@ -31,7 +31,7 @@ function CopyButton ({ children, className = '', icon = 'copy', label, type, val const _onCopy = useCallback( (): void => { - queueAction && queueAction({ + queueAction?.({ action: t('clipboard'), message: t('{{type}} copied', { replace: { type: type || t('value') } }), status: 'queued' diff --git a/packages/react-components/src/DemocracyLocks.tsx b/packages/react-components/src/DemocracyLocks.tsx index 5c836e3..9185ff4 100644 --- a/packages/react-components/src/DemocracyLocks.tsx +++ b/packages/react-components/src/DemocracyLocks.tsx @@ -43,7 +43,7 @@ function groupLocks (t: (key: string, options?: { replace: Record balance).filter((b): b is Balance => !!b)), sorted: locks - .map((info): [Partial, BN] => [info, info.unlockAt && info.unlockAt.gt(bestNumber) ? info.unlockAt.sub(bestNumber) : BN_ZERO]) + .map((info): [Partial, BN] => [info, info.unlockAt?.gt(bestNumber) ? info.unlockAt.sub(bestNumber) : BN_ZERO]) .sort((a, b) => (a[0].referendumId || BN_ZERO).cmp(b[0].referendumId || BN_ZERO)) .sort((a, b) => a[1].cmp(b[1])) .sort((a, b) => a[0].isFinished === b[0].isFinished ? 0 : (a[0].isFinished ? -1 : 1)) diff --git a/packages/react-components/src/Dropdown.tsx b/packages/react-components/src/Dropdown.tsx index a881a30..915f9aa 100644 --- a/packages/react-components/src/Dropdown.tsx +++ b/packages/react-components/src/Dropdown.tsx @@ -42,7 +42,7 @@ interface Props