diff --git a/package.json b/package.json index 2844f1f7bd..f7ffb3f3cd 100644 --- a/package.json +++ b/package.json @@ -27,13 +27,14 @@ "scripts": { "analyze": "yarn clean && BUILD_ANALYZE=1 yarn run build:code && yarn source-map-explorer packages/apps/build/app.*.js", "build": "yarn run build:i18n && yarn run build:code", - "build:before": "yarn build:images && yarn build:typesBundle", + "build:before": "yarn build:fixup && yarn build:images && yarn build:typesBundle", "build:code": "NODE_ENV=production yarn polkadot-dev-build-ts", "build:devElectronMain": "cd packages/apps-electron && yarn polkadot-exec-webpack --config webpack.main.cjs", "build:devElectronRenderer": "cd packages/apps-electron && yarn polkadot-exec-webpack --config webpack.renderer.cjs", "build:electron": "yarn clean:electronBuild && yarn build:electronMain && yarn build:electronRenderer", "build:electronMain": "cd packages/apps-electron && NODE_ENV=production yarn polkadot-exec-webpack --config webpack.main.cjs", "build:electronRenderer": "cd packages/apps-electron && NODE_ENV=production yarn polkadot-exec-webpack --config webpack.renderer.cjs", + "build:fixup": "node ./scripts/fixupModules.cjs", "build:i18n": "i18next-scanner --config i18next-scanner.config.cjs && node ./scripts/i18nSort.cjs", "build:images": "node scripts/imgConvert.mjs", "build:release:electron": "yarn build && yarn build:electron && yarn postinstall:electron", @@ -41,7 +42,7 @@ "build:release:ipfs": "node scripts/ipfsUpload.mjs", "build:release:www": "yarn polkadot-ci-ghact-build && yarn build:release:ghpages && yarn build:release:ipfs", "build:robohash": "node scripts/robohash.cjs", - "build:typesBundle": "polkadot-dev-run-test --env node --require ./scripts/fixupModules.cjs --experimental-specifier-resolution=node packages/apps-config/src/api/typesBundle.spec.ts", + "build:typesBundle": "polkadot-dev-run-test --env node --experimental-specifier-resolution=node packages/apps-config/src/api/typesBundle.spec.ts", "build:www": "rm -rf packages/apps/build && mkdir -p packages/apps/build && yarn run build:i18n && cd packages/apps && yarn polkadot-exec-webpack --config webpack.config.cjs", "ci:chainEndpoints": "polkadot-dev-run-test --env node packages/apps-config/src/ci/chainEndpoints --log .github/chain-endpoints.md", "ci:chainTypes": "echo ok", @@ -50,7 +51,7 @@ "clean:electronRelease": "cd packages/apps-electron && rm -rf release", "clean:i18n": "rm -rf packages/apps/public/locales/en && mkdir -p packages/apps/public/locales/en", "docs": "echo \"skipping docs\"", - "lint": "polkadot-dev-run-lint", + "lint": "yarn build:fixup && polkadot-dev-run-lint", "packElectron": "yarn build:release:electron && yarn clean:electronRelease && electron-builder build -mwl", "packElectron:linux": "yarn build:release:electron && electron-builder build --linux", "packElectron:mac": "yarn build:release:electron && electron-builder build --mac", diff --git a/packages/apps-config/src/api/index.spec.ts b/packages/apps-config/src/api/index.spec.ts index ff85d6682c..13843c1e56 100644 --- a/packages/apps-config/src/api/index.spec.ts +++ b/packages/apps-config/src/api/index.spec.ts @@ -1,7 +1,7 @@ // Copyright 2017-2023 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 -/// +/// import type { OverrideBundleDefinition } from '@polkadot/types/types'; diff --git a/packages/apps-config/src/api/spec/frequency.ts b/packages/apps-config/src/api/spec/frequency.ts index 5b5575304f..9069ba7ac5 100644 --- a/packages/apps-config/src/api/spec/frequency.ts +++ b/packages/apps-config/src/api/spec/frequency.ts @@ -3,15 +3,17 @@ import type { OverrideBundleDefinition } from '@polkadot/types/types'; -import { options } from '@frequency-chain/api-augment'; +import { rpc, runtime, signedExtensions, types } from '@frequency-chain/api-augment'; export default { - ...options, + rpc, + runtime, + signedExtensions, types: [ { // on all versions minmax: [0, undefined], - types: options.types + types } ] } as OverrideBundleDefinition; diff --git a/packages/apps-config/src/api/spec/zeitgeist.ts b/packages/apps-config/src/api/spec/zeitgeist.ts index 050bf73cbd..b49ce54f0e 100644 --- a/packages/apps-config/src/api/spec/zeitgeist.ts +++ b/packages/apps-config/src/api/spec/zeitgeist.ts @@ -16,7 +16,9 @@ const bundle = { types: [{ minmax: [0, undefined], types: { - ...typesFromDefs(typeDefs), + // the cast here is needed to make the build happy, + // however the output is actually correct as well... + ...typesFromDefs(typeDefs as unknown as Record }>), TokensAccountData: { free: 'Balance', frozen: 'Balance', diff --git a/packages/apps-config/src/api/typesBundle.spec.ts b/packages/apps-config/src/api/typesBundle.spec.ts index 0027809db3..4a7d0f1418 100644 --- a/packages/apps-config/src/api/typesBundle.spec.ts +++ b/packages/apps-config/src/api/typesBundle.spec.ts @@ -1,7 +1,7 @@ // Copyright 2017-2023 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 -/// +/// import fs from 'node:fs'; diff --git a/packages/apps-config/src/api/typesBundle.ts b/packages/apps-config/src/api/typesBundle.ts index 11674e6ec7..9ca45344bd 100644 --- a/packages/apps-config/src/api/typesBundle.ts +++ b/packages/apps-config/src/api/typesBundle.ts @@ -54013,76 +54013,6 @@ export const typesBundle = { } } }, - "types": [ - { - "minmax": [ - 0, - null - ], - "types": { - "RpcEvent": { - "phase": "Option", - "pallet": "u8", - "event": "u8", - "data": "Vec" - }, - "BlockPaginationRequest": { - "from_block": "BlockNumber", - "from_index": "u32", - "to_block": "BlockNumber", - "page_size": "u32" - }, - "MessageResponse": { - "payload": "Option>", - "cid": "Option>", - "provider_msa_id": "MessageSourceId", - "msa_id": "Option", - "index": "u16", - "block_number": "BlockNumber", - "payload_length": "Option" - }, - "BlockPaginationResponseMessage": { - "content": "Vec", - "has_next": "bool", - "next_block": "Option", - "next_index": "Option" - }, - "MessageSourceId": "u64", - "DelegatorId": "MessageSourceId", - "ProviderId": "MessageSourceId", - "KeyInfoResponse": { - "key": "AccountId", - "msaId": "MessageSourceId" - }, - "SchemaId": "u16", - "SchemaModel": "Vec", - "SchemaResponse": { - "schema_id": "SchemaId", - "model": "SchemaModel", - "model_type": "ModelType", - "payload_location": "PayloadLocation" - }, - "ModelType": { - "_enum": [ - "AvroBinary", - "Parquet" - ] - }, - "PayloadLocation": { - "_enum": [ - "OnChain", - "IPFS" - ] - } - } - } - ], - "signedExtensions": { - "CheckFreeExtrinsicUse": { - "extrinsic": {}, - "payload": {} - } - }, "runtime": { "AdditionalRuntimeApi": [ { @@ -54191,7 +54121,77 @@ export const typesBundle = { "version": 1 } ] - } + }, + "signedExtensions": { + "CheckFreeExtrinsicUse": { + "extrinsic": {}, + "payload": {} + } + }, + "types": [ + { + "minmax": [ + 0, + null + ], + "types": { + "RpcEvent": { + "phase": "Option", + "pallet": "u8", + "event": "u8", + "data": "Vec" + }, + "BlockPaginationRequest": { + "from_block": "BlockNumber", + "from_index": "u32", + "to_block": "BlockNumber", + "page_size": "u32" + }, + "MessageResponse": { + "payload": "Option>", + "cid": "Option>", + "provider_msa_id": "MessageSourceId", + "msa_id": "Option", + "index": "u16", + "block_number": "BlockNumber", + "payload_length": "Option" + }, + "BlockPaginationResponseMessage": { + "content": "Vec", + "has_next": "bool", + "next_block": "Option", + "next_index": "Option" + }, + "MessageSourceId": "u64", + "DelegatorId": "MessageSourceId", + "ProviderId": "MessageSourceId", + "KeyInfoResponse": { + "key": "AccountId", + "msaId": "MessageSourceId" + }, + "SchemaId": "u16", + "SchemaModel": "Vec", + "SchemaResponse": { + "schema_id": "SchemaId", + "model": "SchemaModel", + "model_type": "ModelType", + "payload_location": "PayloadLocation" + }, + "ModelType": { + "_enum": [ + "AvroBinary", + "Parquet" + ] + }, + "PayloadLocation": { + "_enum": [ + "OnChain", + "IPFS" + ] + } + } + } + ] }, "frequency-rococo": { "rpc": { @@ -54289,76 +54289,6 @@ export const typesBundle = { } } }, - "types": [ - { - "minmax": [ - 0, - null - ], - "types": { - "RpcEvent": { - "phase": "Option", - "pallet": "u8", - "event": "u8", - "data": "Vec" - }, - "BlockPaginationRequest": { - "from_block": "BlockNumber", - "from_index": "u32", - "to_block": "BlockNumber", - "page_size": "u32" - }, - "MessageResponse": { - "payload": "Option>", - "cid": "Option>", - "provider_msa_id": "MessageSourceId", - "msa_id": "Option", - "index": "u16", - "block_number": "BlockNumber", - "payload_length": "Option" - }, - "BlockPaginationResponseMessage": { - "content": "Vec", - "has_next": "bool", - "next_block": "Option", - "next_index": "Option" - }, - "MessageSourceId": "u64", - "DelegatorId": "MessageSourceId", - "ProviderId": "MessageSourceId", - "KeyInfoResponse": { - "key": "AccountId", - "msaId": "MessageSourceId" - }, - "SchemaId": "u16", - "SchemaModel": "Vec", - "SchemaResponse": { - "schema_id": "SchemaId", - "model": "SchemaModel", - "model_type": "ModelType", - "payload_location": "PayloadLocation" - }, - "ModelType": { - "_enum": [ - "AvroBinary", - "Parquet" - ] - }, - "PayloadLocation": { - "_enum": [ - "OnChain", - "IPFS" - ] - } - } - } - ], - "signedExtensions": { - "CheckFreeExtrinsicUse": { - "extrinsic": {}, - "payload": {} - } - }, "runtime": { "AdditionalRuntimeApi": [ { @@ -54467,7 +54397,77 @@ export const typesBundle = { "version": 1 } ] - } + }, + "signedExtensions": { + "CheckFreeExtrinsicUse": { + "extrinsic": {}, + "payload": {} + } + }, + "types": [ + { + "minmax": [ + 0, + null + ], + "types": { + "RpcEvent": { + "phase": "Option", + "pallet": "u8", + "event": "u8", + "data": "Vec" + }, + "BlockPaginationRequest": { + "from_block": "BlockNumber", + "from_index": "u32", + "to_block": "BlockNumber", + "page_size": "u32" + }, + "MessageResponse": { + "payload": "Option>", + "cid": "Option>", + "provider_msa_id": "MessageSourceId", + "msa_id": "Option", + "index": "u16", + "block_number": "BlockNumber", + "payload_length": "Option" + }, + "BlockPaginationResponseMessage": { + "content": "Vec", + "has_next": "bool", + "next_block": "Option", + "next_index": "Option" + }, + "MessageSourceId": "u64", + "DelegatorId": "MessageSourceId", + "ProviderId": "MessageSourceId", + "KeyInfoResponse": { + "key": "AccountId", + "msaId": "MessageSourceId" + }, + "SchemaId": "u16", + "SchemaModel": "Vec", + "SchemaResponse": { + "schema_id": "SchemaId", + "model": "SchemaModel", + "model_type": "ModelType", + "payload_location": "PayloadLocation" + }, + "ModelType": { + "_enum": [ + "AvroBinary", + "Parquet" + ] + }, + "PayloadLocation": { + "_enum": [ + "OnChain", + "IPFS" + ] + } + } + } + ] }, "galital": { "types": [ diff --git a/packages/apps-config/src/ci/chainEndpoints.spec.ts b/packages/apps-config/src/ci/chainEndpoints.spec.ts index 57335225f7..faceba1739 100644 --- a/packages/apps-config/src/ci/chainEndpoints.spec.ts +++ b/packages/apps-config/src/ci/chainEndpoints.spec.ts @@ -1,7 +1,7 @@ // Copyright 2017-2023 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 -/// +/// import { assert, isString } from '@polkadot/util'; import { WebSocket } from '@polkadot/x-ws'; diff --git a/packages/apps-config/src/endpoints/index.spec.ts b/packages/apps-config/src/endpoints/index.spec.ts index 24e5ff588e..27ef6c9fd2 100644 --- a/packages/apps-config/src/endpoints/index.spec.ts +++ b/packages/apps-config/src/endpoints/index.spec.ts @@ -1,7 +1,7 @@ // Copyright 2017-2023 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 -/// +/// import { strict as assert } from 'node:assert'; diff --git a/packages/apps-electron/src/api/account-store-api.ts b/packages/apps-electron/src/api/account-store-api.ts index 9f3c2c1b56..352b6ff230 100644 --- a/packages/apps-electron/src/api/account-store-api.ts +++ b/packages/apps-electron/src/api/account-store-api.ts @@ -1,6 +1,8 @@ // Copyright 2017-2023 @polkadot/apps authors & contributors // SPDX-License-Identifier: Apache-2.0 +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore Warned on by nodenext resolution (while package does build in bundler mode) import type { KeyringJson } from '@polkadot/ui-keyring/types'; export interface AccountStoreApi { diff --git a/packages/apps-electron/src/index.tsx b/packages/apps-electron/src/index.tsx index 9ccfcf7ce8..05a34d7787 100644 --- a/packages/apps-electron/src/index.tsx +++ b/packages/apps-electron/src/index.tsx @@ -2,13 +2,19 @@ // SPDX-License-Identifier: Apache-2.0 // setup these right at front +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore Warned on by nodenext resolution (while package does build in bundler mode) import '@polkadot/apps/initSettings'; import 'semantic-ui-css/semantic.min.css'; +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore Warned on by nodenext resolution (while package does build in bundler mode) import '@polkadot/react-components/i18n'; import React from 'react'; import { createRoot } from 'react-dom/client'; +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore Warned on by nodenext resolution (while package does build in bundler mode) import Root from '@polkadot/apps/Root'; import { electronMainApi } from './api/global-exported-api.js'; diff --git a/packages/apps-electron/src/main/account-store.spec.ts b/packages/apps-electron/src/main/account-store.spec.ts index 6743d4643d..50a2182ac9 100644 --- a/packages/apps-electron/src/main/account-store.spec.ts +++ b/packages/apps-electron/src/main/account-store.spec.ts @@ -1,12 +1,16 @@ // Copyright 2017-2023 @polkadot/apps authors & contributors // SPDX-License-Identifier: Apache-2.0 -/// +/// +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore Warned on by nodenext resolution (while package does build in bundler mode) import type { KeyringJson } from '@polkadot/ui-keyring/types'; import * as tmp from 'tmp'; +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore Warned on by nodenext resolution (while package does build in bundler mode) import { FileStore } from '@polkadot/ui-keyring/stores'; import { accountStoreIpcHandler } from './account-store.js'; diff --git a/packages/apps-electron/src/main/account-store.ts b/packages/apps-electron/src/main/account-store.ts index 1d3a4e39e7..2b96a0662f 100644 --- a/packages/apps-electron/src/main/account-store.ts +++ b/packages/apps-electron/src/main/account-store.ts @@ -1,11 +1,15 @@ // Copyright 2017-2023 @polkadot/apps authors & contributors // SPDX-License-Identifier: Apache-2.0 +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore Warned on by nodenext resolution (while package does build in bundler mode) import type { KeyringJson } from '@polkadot/ui-keyring/types'; import electron from 'electron'; import path from 'path'; +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore Warned on by nodenext resolution (while package does build in bundler mode) import { FileStore } from '@polkadot/ui-keyring/stores'; import { IpcMainHandler } from './ipc-main-handler.js'; diff --git a/packages/apps-electron/src/preload.ts b/packages/apps-electron/src/preload.ts index ce793bdd5a..002247259d 100644 --- a/packages/apps-electron/src/preload.ts +++ b/packages/apps-electron/src/preload.ts @@ -1,6 +1,8 @@ // Copyright 2017-2023 @polkadot/apps authors & contributors // SPDX-License-Identifier: Apache-2.0 +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore Warned on by nodenext resolution (while package does build in bundler mode) import type { KeyringJson } from '@polkadot/ui-keyring/types'; import { contextBridge, ipcRenderer } from 'electron'; diff --git a/packages/apps-electron/src/renderer/remote-electron-store.spec.ts b/packages/apps-electron/src/renderer/remote-electron-store.spec.ts index ba12f3f342..11feb752d6 100644 --- a/packages/apps-electron/src/renderer/remote-electron-store.spec.ts +++ b/packages/apps-electron/src/renderer/remote-electron-store.spec.ts @@ -1,8 +1,10 @@ // Copyright 2017-2023 @polkadot/apps authors & contributors // SPDX-License-Identifier: Apache-2.0 -/// +/// +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore Warned on by nodenext resolution (while package does build in bundler mode) import type { KeyringJson } from '@polkadot/ui-keyring/types'; import { RemoteElectronStore } from './remote-electron-store.js'; diff --git a/packages/apps-electron/src/renderer/remote-electron-store.ts b/packages/apps-electron/src/renderer/remote-electron-store.ts index 8f53b38283..2d8dddfa17 100644 --- a/packages/apps-electron/src/renderer/remote-electron-store.ts +++ b/packages/apps-electron/src/renderer/remote-electron-store.ts @@ -1,6 +1,8 @@ // Copyright 2017-2023 @polkadot/apps authors & contributors // SPDX-License-Identifier: Apache-2.0 +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore Warned on by nodenext resolution (while package does build in bundler mode) import type { KeyringJson, KeyringStore } from '@polkadot/ui-keyring/types'; import { AccountStoreApi } from '../api/account-store-api.js'; diff --git a/packages/page-accounts/src/Accounts/index.spec.ts b/packages/page-accounts/src/Accounts/index.spec.ts index 1e7630ff60..6448954d34 100644 --- a/packages/page-accounts/src/Accounts/index.spec.ts +++ b/packages/page-accounts/src/Accounts/index.spec.ts @@ -1,7 +1,7 @@ // Copyright 2017-2023 @polkadot/page-accounts authors & contributors // SPDX-License-Identifier: Apache-2.0 -/// +/// import { fireEvent, screen, within } from '@testing-library/react'; diff --git a/packages/page-accounts/src/CreateAccount.slow.spec.tsx b/packages/page-accounts/src/CreateAccount.slow.spec.tsx index f485a56271..73c0f80b49 100644 --- a/packages/page-accounts/src/CreateAccount.slow.spec.tsx +++ b/packages/page-accounts/src/CreateAccount.slow.spec.tsx @@ -1,7 +1,7 @@ // Copyright 2017-2023 @polkadot/app-accounts authors & contributors // SPDX-License-Identifier: Apache-2.0 -/// +/// import '@polkadot/react-components/i18n'; diff --git a/packages/page-accounts/src/Sidebar/Sidebar.spec.tsx b/packages/page-accounts/src/Sidebar/Sidebar.spec.tsx index 30347407b3..b69aea5bc8 100644 --- a/packages/page-accounts/src/Sidebar/Sidebar.spec.tsx +++ b/packages/page-accounts/src/Sidebar/Sidebar.spec.tsx @@ -1,7 +1,7 @@ // Copyright 2017-2023 @polkadot/page-accounts authors & contributors // SPDX-License-Identifier: Apache-2.0 -/// +/// import { fireEvent, screen, waitFor, within } from '@testing-library/react'; diff --git a/packages/page-accounts/src/modals/Create.spec.tsx b/packages/page-accounts/src/modals/Create.spec.tsx index 264943231a..26ecffa9bb 100644 --- a/packages/page-accounts/src/modals/Create.spec.tsx +++ b/packages/page-accounts/src/modals/Create.spec.tsx @@ -1,7 +1,7 @@ // Copyright 2017-2023 @polkadot/page-accounts authors & contributors // SPDX-License-Identifier: Apache-2.0 -/// +/// import { fireEvent, screen, waitForElementToBeRemoved } from '@testing-library/react'; diff --git a/packages/page-addresses/src/Contacts/index.spec.ts b/packages/page-addresses/src/Contacts/index.spec.ts index 63b0f815e1..a21e9966ce 100644 --- a/packages/page-addresses/src/Contacts/index.spec.ts +++ b/packages/page-addresses/src/Contacts/index.spec.ts @@ -1,7 +1,7 @@ // Copyright 2017-2023 @polkadot/page-addresses authors & contributors // SPDX-License-Identifier: Apache-2.0 -/// +/// import { screen } from '@testing-library/react'; diff --git a/packages/page-alliance/src/util.spec.ts b/packages/page-alliance/src/util.spec.ts index b1b3adca80..ddc778ac60 100644 --- a/packages/page-alliance/src/util.spec.ts +++ b/packages/page-alliance/src/util.spec.ts @@ -1,7 +1,7 @@ // Copyright 2017-2023 @polkadot/app-alliance authors & contributors // SPDX-License-Identifier: Apache-2.0 -/// +/// import { Metadata, TypeRegistry } from '@polkadot/types'; import substrate from '@polkadot/types-support/metadata/static-substrate'; diff --git a/packages/page-bounties/src/Bounties.slow.spec.tsx b/packages/page-bounties/src/Bounties.slow.spec.tsx index 17c1037fef..22e1a1b87e 100644 --- a/packages/page-bounties/src/Bounties.slow.spec.tsx +++ b/packages/page-bounties/src/Bounties.slow.spec.tsx @@ -1,7 +1,7 @@ // Copyright 2017-2023 @polkadot/app-bounties authors & contributors // SPDX-License-Identifier: Apache-2.0 -/// +/// import '@polkadot/react-components/i18n'; diff --git a/packages/page-bounties/src/Bounties.spec.ts b/packages/page-bounties/src/Bounties.spec.ts index cee9b175d9..b304b99ceb 100644 --- a/packages/page-bounties/src/Bounties.spec.ts +++ b/packages/page-bounties/src/Bounties.spec.ts @@ -1,7 +1,7 @@ // Copyright 2017-2023 @polkadot/app-bounties authors & contributors // SPDX-License-Identifier: Apache-2.0 -/// +/// import type { SubmittableExtrinsic } from '@polkadot/api/types'; import type { DeriveCollectiveProposal } from '@polkadot/api-derive/types'; diff --git a/packages/page-bounties/src/helpers/calculateBountyBond.spec.ts b/packages/page-bounties/src/helpers/calculateBountyBond.spec.ts index 640836841f..b85e783111 100644 --- a/packages/page-bounties/src/helpers/calculateBountyBond.spec.ts +++ b/packages/page-bounties/src/helpers/calculateBountyBond.spec.ts @@ -1,7 +1,7 @@ // Copyright 2017-2023 @polkadot/app-bounties authors & contributors // SPDX-License-Identifier: Apache-2.0 -/// +/// import { TypeRegistry } from '@polkadot/types/create'; import { BN } from '@polkadot/util'; diff --git a/packages/page-bounties/src/helpers/determineUnassignCuratorAction.spec.ts b/packages/page-bounties/src/helpers/determineUnassignCuratorAction.spec.ts index ee343509c3..f7f05f3825 100644 --- a/packages/page-bounties/src/helpers/determineUnassignCuratorAction.spec.ts +++ b/packages/page-bounties/src/helpers/determineUnassignCuratorAction.spec.ts @@ -1,7 +1,7 @@ // Copyright 2017-2023 @polkadot/app-bounties authors & contributors // SPDX-License-Identifier: Apache-2.0 -/// +/// import { createAugmentedApi } from '@polkadot/test-support/api'; import { BountyFactory } from '@polkadot/test-support/creation/bounties'; diff --git a/packages/page-bounties/src/helpers/getBountyStatus.spec.ts b/packages/page-bounties/src/helpers/getBountyStatus.spec.ts index 4aafa2b1d0..0af3e1d059 100644 --- a/packages/page-bounties/src/helpers/getBountyStatus.spec.ts +++ b/packages/page-bounties/src/helpers/getBountyStatus.spec.ts @@ -1,7 +1,7 @@ // Copyright 2017-2023 @polkadot/app-bounties authors & contributors // SPDX-License-Identifier: Apache-2.0 -/// +/// import { TypeRegistry } from '@polkadot/types/create'; diff --git a/packages/page-bounties/src/helpers/isClaimable.spec.ts b/packages/page-bounties/src/helpers/isClaimable.spec.ts index b776e4ee1c..352e6b1a89 100644 --- a/packages/page-bounties/src/helpers/isClaimable.spec.ts +++ b/packages/page-bounties/src/helpers/isClaimable.spec.ts @@ -1,7 +1,7 @@ // Copyright 2017-2023 @polkadot/app-bounties authors & contributors // SPDX-License-Identifier: Apache-2.0 -/// +/// import { TypeRegistry } from '@polkadot/types/create'; import { BN } from '@polkadot/util'; diff --git a/packages/page-bounties/src/helpers/truncateTitle.spec.ts b/packages/page-bounties/src/helpers/truncateTitle.spec.ts index 45dd23adca..d7a7eaf8a7 100644 --- a/packages/page-bounties/src/helpers/truncateTitle.spec.ts +++ b/packages/page-bounties/src/helpers/truncateTitle.spec.ts @@ -1,7 +1,7 @@ // Copyright 2017-2023 @polkadot/app-bounties authors & contributors // SPDX-License-Identifier: Apache-2.0 -/// +/// import { truncateTitle } from './stringHelpers.js'; diff --git a/packages/page-claims/src/util.spec.ts b/packages/page-claims/src/util.spec.ts index 86be68417d..b1038971a5 100644 --- a/packages/page-claims/src/util.spec.ts +++ b/packages/page-claims/src/util.spec.ts @@ -1,7 +1,7 @@ // Copyright 2017-2023 @polkadot/react-components authors & contributors // SPDX-License-Identifier: Apache-2.0 -/// +/// import { hexToU8a } from '@polkadot/util'; diff --git a/packages/page-democracy/src/util.spec.ts b/packages/page-democracy/src/util.spec.ts index c06665bec1..d74b6662e9 100644 --- a/packages/page-democracy/src/util.spec.ts +++ b/packages/page-democracy/src/util.spec.ts @@ -1,7 +1,7 @@ // Copyright 2017-2023 @polkadot/app-democracy authors & contributors // SPDX-License-Identifier: Apache-2.0 -/// +/// import { calcPassing } from '@polkadot/api-derive/democracy/util'; import { TypeRegistry } from '@polkadot/types/create'; diff --git a/packages/page-referenda/src/util.spec.ts b/packages/page-referenda/src/util.spec.ts index 8c9bac60a8..7a17d6c4b2 100644 --- a/packages/page-referenda/src/util.spec.ts +++ b/packages/page-referenda/src/util.spec.ts @@ -1,7 +1,7 @@ // Copyright 2017-2023 @polkadot/app-referenda authors & contributors // SPDX-License-Identifier: Apache-2.0 -/// +/// import type { PalletReferendaCurve } from '@polkadot/types/lookup'; import type { BN } from '@polkadot/util'; diff --git a/packages/react-api/src/light.spec.ts b/packages/react-api/src/light.spec.ts index 07366a9e2d..bfda2cecc8 100644 --- a/packages/react-api/src/light.spec.ts +++ b/packages/react-api/src/light.spec.ts @@ -1,7 +1,7 @@ // Copyright 2017-2023 @polkadot/react-api authors & contributors // SPDX-License-Identifier: Apache-2.0 -/// +/// import fs from 'fs'; import path from 'path'; diff --git a/packages/react-components/src/Modal/Modal.spec.tsx b/packages/react-components/src/Modal/Modal.spec.tsx index c192e9e42c..aeb267e36f 100644 --- a/packages/react-components/src/Modal/Modal.spec.tsx +++ b/packages/react-components/src/Modal/Modal.spec.tsx @@ -1,7 +1,7 @@ // Copyright 2017-2023 @polkadot/app-bounties authors & contributors // SPDX-License-Identifier: Apache-2.0 -/// +/// import { fireEvent, render, screen, waitFor } from '@testing-library/react'; import React, { Suspense } from 'react'; diff --git a/packages/react-components/src/Popup/Popup.spec.tsx b/packages/react-components/src/Popup/Popup.spec.tsx index 8cc45b683b..05f0ee50ec 100644 --- a/packages/react-components/src/Popup/Popup.spec.tsx +++ b/packages/react-components/src/Popup/Popup.spec.tsx @@ -1,7 +1,7 @@ // Copyright 2017-2023 @polkadot/react-components authors & contributors // SPDX-License-Identifier: Apache-2.0 -/// +/// import { fireEvent, render, screen, waitFor } from '@testing-library/react'; import React, { Suspense } from 'react'; diff --git a/packages/react-components/src/Tooltip.tsx b/packages/react-components/src/Tooltip.tsx index e7ab23ebb3..8ea434da9b 100644 --- a/packages/react-components/src/Tooltip.tsx +++ b/packages/react-components/src/Tooltip.tsx @@ -55,7 +55,10 @@ function Tooltip ({ children, className = '', isClickable = false, place, text, ); } -const StyledReactTooltip = styled(ReactTooltip)` +// FIXME This cast should really not be needed since the export is React.Component, +// however while it works as specified, it fails here on the definition. Until we have the component +// upgraded to latest, we probably don't want to start digging... +const StyledReactTooltip = styled(ReactTooltip as unknown as React.ComponentType)` .tooltipSpacer { padding: 0.375rem; } diff --git a/packages/react-components/src/i18n/index.ts b/packages/react-components/src/i18n/index.ts index ac9d823eea..43e08133d2 100644 --- a/packages/react-components/src/i18n/index.ts +++ b/packages/react-components/src/i18n/index.ts @@ -1,6 +1,8 @@ // Copyright 2017-2023 @polkadot/react-components authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { LanguageDetectorModule, Newable } from 'i18next'; + import i18next from 'i18next'; import LanguageDetector from 'i18next-browser-languagedetector'; import { initReactI18next } from 'react-i18next'; @@ -9,7 +11,12 @@ import { LANGUAGE_DEFAULT, settings } from '@polkadot/ui-settings'; import Backend from './Backend.js'; -const languageDetector = new LanguageDetector(); +// This is a workaround for the above package - +// +// 1. It does have an ESM export which would be used +// 2. The package type is set to commonjs +// 3. Unless we run fixup on it, it seems problematic... (here we opt for no fixup) +const languageDetector = new (LanguageDetector as unknown as Newable unknown }>)(); languageDetector.addDetector({ lookup: () => { diff --git a/packages/react-hooks/src/useMemoValue.spec.ts b/packages/react-hooks/src/useMemoValue.spec.ts index eb8a62f028..9998c9bc75 100644 --- a/packages/react-hooks/src/useMemoValue.spec.ts +++ b/packages/react-hooks/src/useMemoValue.spec.ts @@ -1,7 +1,7 @@ // Copyright 2017-2023 @polkadot/react-components authors & contributors // SPDX-License-Identifier: Apache-2.0 -/// +/// import { stringify } from '@polkadot/util'; diff --git a/scripts/fixupModules.cjs b/scripts/fixupModules.cjs old mode 100644 new mode 100755 index 15d62ccc59..9046e6fc97 --- a/scripts/fixupModules.cjs +++ b/scripts/fixupModules.cjs @@ -1,18 +1,15 @@ // Copyright 2017-2023 @polkadot/apps-config authors & contributors // SPDX-License-Identifier: Apache-2.0 -const fs = require('fs'); -const path = require('path'); -const process = require('process'); +const fs = require('node:fs'); +const path = require('node:path'); +const process = require('node:process'); // incorrect packages without type specifier -const PKG_FIX = [ - '@frequency-chain/api-augment', - // the default export here is ESM - 'i18next-browser-languagedetector' -]; - -PKG_FIX.forEach((f) => { +[ + // See https://github.com/LibertyDSNP/frequency/issues/1116 + '@frequency-chain/api-augment' +].forEach((f) => { const full = path.join(process.cwd(), `node_modules/${f}/package.json`); const json = JSON.parse(fs.readFileSync(full, 'utf8')); diff --git a/tsconfig.base.json b/tsconfig.base.json index 5d3807934d..bfb1faf063 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -2,8 +2,6 @@ "extends": "@polkadot/dev/config/tsconfig.json", "compilerOptions": { "composite": false, - /* FIXME we still have some issues with some deps that make the default nodenext impossible */ - "moduleResolution": "node", "paths": { "@polkadot/apps": ["apps/src/index.tsx"], "@polkadot/apps/Root": ["apps/src/Root.tsx"],