Bump dev (w/ lint updates) (#1795)

* Bump dev (w/ lint updates)

* Bump dev

* Adjust behavior for global setting

* Adjust versionDetect expectations
This commit is contained in:
Jaco
2023-04-11 14:52:49 +03:00
committed by GitHub
parent 5964f790b5
commit de85d063a4
9 changed files with 105 additions and 98 deletions
+1 -1
View File
@@ -37,7 +37,7 @@
"test:one": "polkadot-dev-run-test --env browser"
},
"devDependencies": {
"@polkadot/dev": "^0.72.39",
"@polkadot/dev": "^0.72.42",
"@types/node": "^18.15.11"
},
"resolutions": {
+2 -2
View File
@@ -43,7 +43,7 @@ export class Keyring implements KeyringInstance {
readonly #type: KeypairType;
#ss58?: number;
#ss58?: number | undefined;
public decodeAddress = decodeAddress;
@@ -246,7 +246,7 @@ export class Keyring implements KeyringInstance {
public encodeAddress = (address: Uint8Array | string, ss58Format?: number): string => {
return this.type === 'ethereum'
? ethereumEncode(address)
: encodeAddress(address, ss58Format === undefined ? this.#ss58 : ss58Format);
: encodeAddress(address, ss58Format ?? this.#ss58);
};
/**
+1 -1
View File
@@ -3,6 +3,6 @@
export interface PairInfo {
publicKey: Uint8Array;
secretKey?: Uint8Array;
secretKey?: Uint8Array | undefined;
seed?: Uint8Array | null;
}
+3 -1
View File
@@ -30,7 +30,9 @@ export function blake2AsU8a (data: HexString | Uint8Array | string, bitLength: 6
return !hasBigInt || (!onlyJs && isReady())
? blake2b(u8a, u8aToU8a(key), byteLength)
: blake2bJs(u8a, { dkLen: byteLength, key: key || undefined });
: key
? blake2bJs(u8a, { dkLen: byteLength, key })
: blake2bJs(u8a, { dkLen: byteLength });
}
/**
+1 -1
View File
@@ -11,6 +11,6 @@ import { nToU8a } from './toU8a.js';
* @name nToHex
* @summary Creates a hex value from a bigint object.
*/
export function nToHex <ExtToBn extends ToBn | ToBigInt> (value?: ExtToBn | BN | bigint | number | null, { bitLength, isLe = false, isNegative = false }: NumberOptions = {}): HexString {
export function nToHex <ExtToBn extends ToBn | ToBigInt> (value?: ExtToBn | BN | bigint | number | null, { bitLength = -1, isLe = false, isNegative = false }: NumberOptions = {}): HexString {
return u8aToHex(nToU8a(value || 0, { bitLength, isLe, isNegative }));
}
+8 -8
View File
@@ -162,16 +162,16 @@ formatBalance.getOptions = (decimals: number = defaultDecimals): SiDef[] => {
// Sets the default decimals to use for formatting (ui-wide)
formatBalance.setDefaults = ({ decimals, unit }: SetDefaults): void => {
defaultDecimals = decimals === undefined
? defaultDecimals
: Array.isArray(decimals)
defaultDecimals = (
Array.isArray(decimals)
? decimals[0]
: decimals;
defaultUnit = unit === undefined
? defaultUnit
: Array.isArray(unit)
: decimals
) ?? defaultDecimals;
defaultUnit = (
Array.isArray(unit)
? unit[0]
: unit;
: unit
) ?? defaultUnit;
SI[SI_MID].text = defaultUnit;
};
+9 -9
View File
@@ -15,13 +15,13 @@ describe('detectPackage', (): void => {
const MISMATCH = `@polkadot/util has multiple versions, ensure that there is only one installed.
Either remove and explicitly install matching versions or dedupe using your package manager.
The following conflicting packages were found:
\t ${VER1}\tnode_modules/@polkadot/util
\tesm ${VER1}\t<unknown>
\tesm ${VER2} \tnode_modules/@polkadot/api/node_modules/@polkadot/util`;
it('should not log the first time', (): void => {
const spy = jest.spyOn(console, 'warn');
detectPackage({ name: PKG, version: VER1 }, PATH);
detectPackage({ name: PKG, path: 'auto', type: 'esm', version: VER1 }, PATH);
expect(spy).not.toHaveBeenCalled();
spy.mockRestore();
});
@@ -37,7 +37,7 @@ The following conflicting packages were found:
it('should allow for function use', (): void => {
const spy = jest.spyOn(console, 'warn');
detectPackage({ name: PKG, type: 'cjs', version: VER3 }, () => PATH);
detectPackage({ name: PKG, path: 'node_modules/@polkadot/util', type: 'cjs', version: VER3 }, () => PATH);
expect(spy).toHaveBeenCalledWith(`${MISMATCH}
\tcjs ${VER3} \tnode_modules/@polkadot/util`);
spy.mockRestore();
@@ -45,15 +45,15 @@ The following conflicting packages were found:
});
describe('detectPackageDeps', (): void => {
const DEP0 = { name: '@polkadot/keyring', version: '1.1.1' };
const DEP1 = { name: '@polkadot/util', version: '1.1.2' };
const DEP2 = { name: '@polkadot/util-crypto', version: '1.1.3' };
const DEP3 = { name: '@polkadot/networks', version: '1.1.1' };
const DEP0 = { name: '@polkadot/keyring', path: 'auto', type: 'esm', version: '1.1.1' };
const DEP1 = { name: '@polkadot/util', path: 'auto', type: 'esm', version: '1.1.2' };
const DEP2 = { name: '@polkadot/util-crypto', path: 'auto', type: 'esm', version: '1.1.3' };
const DEP3 = { name: '@polkadot/networks', path: 'auto', type: 'esm', version: '1.1.1' };
it('should not log when no mismatches are found', (): void => {
const spy = jest.spyOn(console, 'warn');
detectPackage({ name: '@polkadot/one', version: '1.1.1' }, false, [DEP0, DEP3]);
detectPackage({ name: '@polkadot/one', path: 'auto', type: 'esm', version: '1.1.1' }, false, [DEP0, DEP3]);
expect(spy).not.toHaveBeenCalled();
spy.mockRestore();
});
@@ -61,7 +61,7 @@ describe('detectPackageDeps', (): void => {
it('should log when mismatches are found', (): void => {
const spy = jest.spyOn(console, 'warn');
detectPackage({ name: '@polkadot/two', version: '1.1.1' }, false, [DEP0, DEP1, DEP2, DEP3]);
detectPackage({ name: '@polkadot/two', path: 'auto', type: 'esm', version: '1.1.1' }, false, [DEP0, DEP1, DEP2, DEP3]);
expect(spy).toHaveBeenCalledWith(`@polkadot/two requires direct dependencies exactly matching version 1.1.1.
Either remove and explicitly install matching versions or dedupe using your package manager.
The following conflicting packages were found:
+7 -10
View File
@@ -7,17 +7,14 @@ import { isFunction } from './is/function.js';
type This = typeof globalThis;
interface PackageJson {
name: string;
path?: string;
type?: string;
interface VersionPath {
path: string;
type: string;
version: string;
}
interface VersionPath {
path?: string;
type?: string;
version: string;
interface PackageInfo extends VersionPath {
name: string;
}
interface PjsChecks extends This {
@@ -58,7 +55,7 @@ function formatDisplay <T extends { version: string }> (all: T[], fmt: (version:
}
/** @internal */
function formatInfo (version: string, { name }: PackageJson): string[] {
function formatInfo (version: string, { name }: PackageInfo): string[] {
return [
version,
name
@@ -110,7 +107,7 @@ function warn <T extends { version: string }> (pre: string, all: T[], fmt: (vers
* @summary Checks that a specific package is only imported once
* @description A `@polkadot/*` version detection utility, checking for one occurence of a package in addition to checking for ddependency versions.
*/
export function detectPackage ({ name, path, type, version }: PackageJson, pathOrFn?: FnString | string | false | null, deps: PackageJson[] = []): void {
export function detectPackage ({ name, path, type, version }: PackageInfo, pathOrFn?: FnString | string | false | null, deps: PackageInfo[] = []): void {
if (!name.startsWith('@polkadot')) {
throw new Error(`Invalid package descriptor ${name}`);
}
+73 -65
View File
@@ -486,34 +486,34 @@ __metadata:
languageName: node
linkType: hard
"@polkadot/dev-test@npm:^0.72.39":
version: 0.72.39
resolution: "@polkadot/dev-test@npm:0.72.39"
"@polkadot/dev-test@npm:^0.72.42":
version: 0.72.42
resolution: "@polkadot/dev-test@npm:0.72.42"
dependencies:
jsdom: ^21.1.1
tslib: ^2.5.0
checksum: 2731ac8444aa2c5e78516798c18eee69bc850e66c1f61c35076c86938d906b143a2fe0c52a1fc73cf916f8665e0c79710f6e2f3cc4443f5f6eb3904734e35356
checksum: eff51b13d27cd2dd5815cabe2ef311f485602c28f0573bf0168f125812b254b84819be26406aa18cc6f3252dfb9084671bededd43f29b1a403ed6762161bfeeb
languageName: node
linkType: hard
"@polkadot/dev-ts@npm:^0.72.39":
version: 0.72.39
resolution: "@polkadot/dev-ts@npm:0.72.39"
"@polkadot/dev-ts@npm:^0.72.42":
version: 0.72.42
resolution: "@polkadot/dev-ts@npm:0.72.42"
dependencies:
json5: ^2.2.3
tslib: ^2.5.0
typescript: ^5.0.4
checksum: 8782d9a9c567eed0a08ffd9a3a220622d19b68c86e0cedec0c97a652d4b900c59112a87c40c2a3065727fc4a55de5c49bea3538eff02188503ff1903e8741107
checksum: c679ea2544ef9eb6c4294191d640d50af13efb39008ceaf8f325398e3989c76d7e091ab19669efbe65c96d9fbad80cddfd33bca4d7a6455ea9755d4a806c5053
languageName: node
linkType: hard
"@polkadot/dev@npm:^0.72.39":
version: 0.72.39
resolution: "@polkadot/dev@npm:0.72.39"
"@polkadot/dev@npm:^0.72.42":
version: 0.72.42
resolution: "@polkadot/dev@npm:0.72.42"
dependencies:
"@eslint/js": ^8.38.0
"@polkadot/dev-test": ^0.72.39
"@polkadot/dev-ts": ^0.72.39
"@polkadot/dev-test": ^0.72.42
"@polkadot/dev-ts": ^0.72.42
"@rollup/plugin-alias": ^5.0.0
"@rollup/plugin-commonjs": ^24.0.1
"@rollup/plugin-dynamic-import-vars": ^2.0.3
@@ -521,8 +521,9 @@ __metadata:
"@rollup/plugin-json": ^6.0.0
"@rollup/plugin-node-resolve": ^15.0.2
"@rushstack/eslint-patch": ^1.2.0
"@typescript-eslint/eslint-plugin": ^5.57.1
"@typescript-eslint/parser": ^5.57.1
"@tsconfig/strictest": ^2.0.0
"@typescript-eslint/eslint-plugin": ^5.58.0
"@typescript-eslint/parser": ^5.58.0
eslint: ^8.38.0
eslint-config-standard: ^17.0.0
eslint-import-resolver-node: ^0.3.7
@@ -574,7 +575,7 @@ __metadata:
polkadot-exec-rollup: scripts/polkadot-exec-rollup.mjs
polkadot-exec-tsc: scripts/polkadot-exec-tsc.mjs
polkadot-exec-webpack: scripts/polkadot-exec-webpack.mjs
checksum: 527602e64635b3ed43e8f7227c7bd5ae108c861bb89b6a1ad4f04ec933c0e9dc8ec8a9d260638eabc71ecf47f25b66672428becbdad4394a8f55e01ab19a040b
checksum: 1ed5062936ea439d225f044cbc84863b4031476be02491b622aac67b18b8421276114ebb1b38bee9ce7283ef544fe6f829076b4da238cad40dc3269b19e8fcd4
languageName: node
linkType: hard
@@ -978,6 +979,13 @@ __metadata:
languageName: node
linkType: hard
"@tsconfig/strictest@npm:^2.0.0":
version: 2.0.0
resolution: "@tsconfig/strictest@npm:2.0.0"
checksum: a21d79fb3eb587e3e61b5bf3e4f52bc2a4f471ca4f3b1effe93849b97a36723cecfbef8181bac2c68cba9b44ef6b220cbe64194d17826622402de144383440f3
languageName: node
linkType: hard
"@types/bn.js@npm:^5.1.1":
version: 5.1.1
resolution: "@types/bn.js@npm:5.1.1"
@@ -1266,14 +1274,14 @@ __metadata:
languageName: node
linkType: hard
"@typescript-eslint/eslint-plugin@npm:^5.57.1":
version: 5.57.1
resolution: "@typescript-eslint/eslint-plugin@npm:5.57.1"
"@typescript-eslint/eslint-plugin@npm:^5.58.0":
version: 5.58.0
resolution: "@typescript-eslint/eslint-plugin@npm:5.58.0"
dependencies:
"@eslint-community/regexpp": ^4.4.0
"@typescript-eslint/scope-manager": 5.57.1
"@typescript-eslint/type-utils": 5.57.1
"@typescript-eslint/utils": 5.57.1
"@typescript-eslint/scope-manager": 5.58.0
"@typescript-eslint/type-utils": 5.58.0
"@typescript-eslint/utils": 5.58.0
debug: ^4.3.4
grapheme-splitter: ^1.0.4
ignore: ^5.2.0
@@ -1286,43 +1294,43 @@ __metadata:
peerDependenciesMeta:
typescript:
optional: true
checksum: 3ea842ef9615e298e28c6687c4dc285577ea0995944410553b3ca514ce9d437534b6e89114e9398c1a370324afe7a4a251c8c49540bb3bf13dcadde9ada3ecc2
checksum: e5d76d43c466ebd4b552e3307eff72ab5ae8a0c09a1d35fa13b62769ac3336df94d9281728ab5aafd2c14a0a644133583edcd708fce60a9a82df1db3ca3b8e14
languageName: node
linkType: hard
"@typescript-eslint/parser@npm:^5.57.1":
version: 5.57.1
resolution: "@typescript-eslint/parser@npm:5.57.1"
"@typescript-eslint/parser@npm:^5.58.0":
version: 5.58.0
resolution: "@typescript-eslint/parser@npm:5.58.0"
dependencies:
"@typescript-eslint/scope-manager": 5.57.1
"@typescript-eslint/types": 5.57.1
"@typescript-eslint/typescript-estree": 5.57.1
"@typescript-eslint/scope-manager": 5.58.0
"@typescript-eslint/types": 5.58.0
"@typescript-eslint/typescript-estree": 5.58.0
debug: ^4.3.4
peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
peerDependenciesMeta:
typescript:
optional: true
checksum: db61a12a67bc45d814297e7f089768c0849f18162b330279aa15121223ec3b18d80df4c327f4ca0a40a7bddb9150ba1a9379fce00bc0e4a10cc189d04e36f0e3
checksum: 38681da48a40132c0538579c818ceef9ba2793ab8f79236c3f64980ba1649bb87cb367cd79d37bf2982b8bfbc28f91846b8676f9bd333e8b691c9befffd8874a
languageName: node
linkType: hard
"@typescript-eslint/scope-manager@npm:5.57.1":
version: 5.57.1
resolution: "@typescript-eslint/scope-manager@npm:5.57.1"
"@typescript-eslint/scope-manager@npm:5.58.0":
version: 5.58.0
resolution: "@typescript-eslint/scope-manager@npm:5.58.0"
dependencies:
"@typescript-eslint/types": 5.57.1
"@typescript-eslint/visitor-keys": 5.57.1
checksum: 4f03d54372f0591fbc5f6e0267a6f1b73e3012e8a319c1893829e0b8e71f882e17a696995dc8b11e700162daf74444fd2d8f55dba314e1a95221a9d3eabcfb2b
"@typescript-eslint/types": 5.58.0
"@typescript-eslint/visitor-keys": 5.58.0
checksum: f0d3df5cc3c461fe63ef89ad886b53c239cc7c1d9061d83d8a9d9c8e087e5501eac84bebff8a954728c17ccea191f235686373d54d2b8b6370af2bcf2b18e062
languageName: node
linkType: hard
"@typescript-eslint/type-utils@npm:5.57.1":
version: 5.57.1
resolution: "@typescript-eslint/type-utils@npm:5.57.1"
"@typescript-eslint/type-utils@npm:5.58.0":
version: 5.58.0
resolution: "@typescript-eslint/type-utils@npm:5.58.0"
dependencies:
"@typescript-eslint/typescript-estree": 5.57.1
"@typescript-eslint/utils": 5.57.1
"@typescript-eslint/typescript-estree": 5.58.0
"@typescript-eslint/utils": 5.58.0
debug: ^4.3.4
tsutils: ^3.21.0
peerDependencies:
@@ -1330,7 +1338,7 @@ __metadata:
peerDependenciesMeta:
typescript:
optional: true
checksum: 06fab95315fc1ffdaaa011e6ec1ae538826ef3d9b422e2c926dbe9b83e55d9e8bdaa07c43317a4c0a59b40a24c5c48a7c8284e6a18780475a65894b1b949fc23
checksum: 803f24daed185152bf86952d4acebb5ea18ff03db5f28750368edf76fdea46b4b0f8803ae0b61c0282b47181c9977113457b16e33d5d2cb33b13855f55c5e5b2
languageName: node
linkType: hard
@@ -1341,19 +1349,19 @@ __metadata:
languageName: node
linkType: hard
"@typescript-eslint/types@npm:5.57.1":
version: 5.57.1
resolution: "@typescript-eslint/types@npm:5.57.1"
checksum: 21789eb697904bbb44a18df961d5918e7c5bd90c79df3a8b8b835da81d0c0f42c7eeb2d05f77cafe49a7367ae7f549a0c8281656ea44b6dc56ae1bf19a3a1eae
"@typescript-eslint/types@npm:5.58.0":
version: 5.58.0
resolution: "@typescript-eslint/types@npm:5.58.0"
checksum: 8622a73d73220c4a7111537825f488c0271272032a1d4e129dc722bc6e8b3ec84f64469b2ca3b8dae7da3a9c18953ce1449af51f5f757dad60835eb579ad1d2c
languageName: node
linkType: hard
"@typescript-eslint/typescript-estree@npm:5.57.1, @typescript-eslint/typescript-estree@npm:^5.13.0":
version: 5.57.1
resolution: "@typescript-eslint/typescript-estree@npm:5.57.1"
"@typescript-eslint/typescript-estree@npm:5.58.0, @typescript-eslint/typescript-estree@npm:^5.13.0":
version: 5.58.0
resolution: "@typescript-eslint/typescript-estree@npm:5.58.0"
dependencies:
"@typescript-eslint/types": 5.57.1
"@typescript-eslint/visitor-keys": 5.57.1
"@typescript-eslint/types": 5.58.0
"@typescript-eslint/visitor-keys": 5.58.0
debug: ^4.3.4
globby: ^11.1.0
is-glob: ^4.0.3
@@ -1362,7 +1370,7 @@ __metadata:
peerDependenciesMeta:
typescript:
optional: true
checksum: bf96520f6de562838a40c3f009fc61fbee5369621071cd0d1dba4470b2b2f746cf79afe4ffa3fbccb8913295a2fbb3d89681d5178529e8da4987c46ed4e5cbed
checksum: 51b668ec858db0c040a71dff526273945cee4ba5a9b240528d503d02526685882d900cf071c6636a4d9061ed3fd4a7274f7f1a23fba55c4b48b143344b4009c7
languageName: node
linkType: hard
@@ -1384,21 +1392,21 @@ __metadata:
languageName: node
linkType: hard
"@typescript-eslint/utils@npm:5.57.1, @typescript-eslint/utils@npm:^5.10.0, @typescript-eslint/utils@npm:^5.57.0":
version: 5.57.1
resolution: "@typescript-eslint/utils@npm:5.57.1"
"@typescript-eslint/utils@npm:5.58.0, @typescript-eslint/utils@npm:^5.10.0, @typescript-eslint/utils@npm:^5.57.0":
version: 5.58.0
resolution: "@typescript-eslint/utils@npm:5.58.0"
dependencies:
"@eslint-community/eslint-utils": ^4.2.0
"@types/json-schema": ^7.0.9
"@types/semver": ^7.3.12
"@typescript-eslint/scope-manager": 5.57.1
"@typescript-eslint/types": 5.57.1
"@typescript-eslint/typescript-estree": 5.57.1
"@typescript-eslint/scope-manager": 5.58.0
"@typescript-eslint/types": 5.58.0
"@typescript-eslint/typescript-estree": 5.58.0
eslint-scope: ^5.1.1
semver: ^7.3.7
peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || ^8.0.0
checksum: 12e55144c8087f4e8f0f22e5693f3901b81bb7899dec42c7bfe540ac672a802028b688884bb43bd67bcf3cd3546a7205d207afcd948c731c19f551ea61267205
checksum: c618ae67963ecf96b1492c09afaeb363f542f0d6780bcac4af3c26034e3b20034666b2d523aa94821df813aafb57a0b150a7d5c2224fe8257452ad1de2237a58
languageName: node
linkType: hard
@@ -1412,13 +1420,13 @@ __metadata:
languageName: node
linkType: hard
"@typescript-eslint/visitor-keys@npm:5.57.1":
version: 5.57.1
resolution: "@typescript-eslint/visitor-keys@npm:5.57.1"
"@typescript-eslint/visitor-keys@npm:5.58.0":
version: 5.58.0
resolution: "@typescript-eslint/visitor-keys@npm:5.58.0"
dependencies:
"@typescript-eslint/types": 5.57.1
"@typescript-eslint/types": 5.58.0
eslint-visitor-keys: ^3.3.0
checksum: d187dfac044b7c0f24264a9ba5eebcf6651412d840b4aaba8eacabff7e771babcd67c738525b1f7c9eb8c94b7edfe7658f6de99f5fdc9745e409c538c1374674
checksum: ab2d1f37660559954c840429ef78bbf71834063557e3e68e435005b4987970b9356fdf217ead53f7a57f66f5488dc478062c5c44bf17053a8bf041733539b98f
languageName: node
linkType: hard
@@ -7643,7 +7651,7 @@ fsevents@~2.3.2:
version: 0.0.0-use.local
resolution: "root-workspace-0b6124@workspace:."
dependencies:
"@polkadot/dev": ^0.72.39
"@polkadot/dev": ^0.72.42
"@types/node": ^18.15.11
languageName: unknown
linkType: soft