Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Update dev dependencies (#7821)
Browse files Browse the repository at this point in the history
### What was the problem?

This PR partially addresses #7084 

### How was it solved?

- Update dev dependencies
  - typescript related dependencies
  - jest related dependencies
  - eslint related dependencies
  - prettier related dependencies

### How was it tested?

- Only error related to eslint/typescripts are fixed, so all test should
pass
  • Loading branch information
shuse2 authored Dec 1, 2022
1 parent c4e1d7a commit 380ecb3
Show file tree
Hide file tree
Showing 286 changed files with 5,315 additions and 4,281 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@ module.exports = {
tsconfigRootDir: __dirname,
},
extends: ['lisk-base/ts'],
rules: {
'@typescript-eslint/member-ordering': 'off',
'@typescript-eslint/no-unsafe-argument': ['warn'],
}
};
4 changes: 4 additions & 0 deletions .eslintrc.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ module.exports = {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
rules: {
'@typescript-eslint/member-ordering': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
}
};
12 changes: 6 additions & 6 deletions commander/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module.exports = {
globals: {
'ts-jest': {
tsconfig: './test/tsconfig.json',
},
},
testMatch: ['<rootDir>/test/**/?(*.)+(spec|test).+(ts|tsx|js)'],
setupFilesAfterEnv: ['<rootDir>/test/setup.js'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
tsconfig: '<rootDir>/test/tsconfig.json',
},
],
},
verbose: false,
collectCoverage: false,
Expand Down
40 changes: 20 additions & 20 deletions commander/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"scripts": {
"start": "ts-node src/index.js",
"format": "prettier --write '**/*'",
"lint": "eslint --ext .js,.ts .",
"lint": "eslint --ext .ts .",
"lint:fix": "eslint --fix --ext .js,.ts .",
"test:watch": "npm run test:local -- --watch",
"test:watch:min": "npm run test:watch -- --reporter=min",
Expand Down Expand Up @@ -136,35 +136,35 @@
"@types/bip39": "3.0.0",
"@types/expect": "24.3.0",
"@types/fs-extra": "9.0.1",
"@types/inquirer": "6.5.0",
"@types/jest": "26.0.21",
"@types/jest-when": "2.7.2",
"@types/inquirer": "7.3.3",
"@types/jest": "29.2.3",
"@types/jest-when": "3.5.2",
"@types/jquery": "3.3.33",
"@types/listr": "0.14.2",
"@types/node": "12.20.6",
"@types/progress": "2.0.3",
"@types/semver": "7.1.0",
"@types/strip-ansi": "5.2.1",
"@types/tar": "6.1.3",
"@types/yeoman-environment": "2.10.3",
"@types/yeoman-generator": "4.11.4",
"@typescript-eslint/eslint-plugin": "4.19.0",
"@typescript-eslint/parser": "4.19.0",
"@types/yeoman-environment": "2.10.8",
"@types/yeoman-generator": "5.2.11",
"@typescript-eslint/eslint-plugin": "5.44.0",
"@typescript-eslint/parser": "5.44.0",
"copyfiles": "2.4.1",
"eslint": "7.22.0",
"eslint": "8.28.0",
"eslint-config-lisk-base": "2.0.1",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-jest": "24.3.2",
"jest": "26.6.3",
"jest-extended": "0.11.5",
"jest-when": "3.2.1",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-jest": "27.1.6",
"jest": "29.3.1",
"jest-extended": "3.2.0",
"jest-when": "3.5.2",
"oclif": "3.2.12",
"prettier": "2.2.1",
"prettier": "2.8.0",
"rxjs-compat": "6.5.4",
"source-map-support": "0.5.19",
"ts-jest": "26.5.4",
"ts-node": "9.1.1",
"tsconfig-paths": "3.9.0",
"typescript": "4.2.3"
"source-map-support": "0.5.21",
"ts-jest": "29.0.3",
"ts-node": "10.9.1",
"tsconfig-paths": "4.1.0",
"typescript": "4.9.3"
}
}
17 changes: 4 additions & 13 deletions commander/src/base_bootstrap_command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,10 @@ export default abstract class BaseBootstrapCommand extends Command {
command: string,
opts?: Record<string, unknown>,
): Promise<void> {
return new Promise(resolve => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
env.run(
command,
{ ...opts, template: this.bootstrapFlags.template, version: this.config.version },
(err): void => {
if (err) {
this.error(err);
}

return resolve();
},
);
await env.run(command, {
...opts,
template: this.bootstrapFlags.template,
version: this.config.version,
});
}
}
1 change: 1 addition & 0 deletions commander/src/bootstrapping/commands/base_forging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export abstract class BaseForgingCommand extends BaseIPCClientCommand {
if (flags.password) {
password = flags.password;
} else {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const answers = await inquirer.prompt([
{
type: 'password',
Expand Down
2 changes: 1 addition & 1 deletion commander/src/bootstrapping/commands/block/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export abstract class GetCommand extends BaseIPCClientCommand {
block = await this._client.block.get(Buffer.from(input, 'hex'));
}

this.printJSON((block as unknown) as Record<string, unknown>);
this.printJSON(block as unknown as Record<string, unknown>);
} catch (errors) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const errorMessage = Array.isArray(errors)
Expand Down
2 changes: 1 addition & 1 deletion commander/src/bootstrapping/commands/endpoint/invoke.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class InvokeCommand extends BaseIPCClientCommand {
response = await this._client.invoke(args.endpoint, endpointArguments);
}

this.printJSON((response as unknown) as Record<string, unknown>);
this.printJSON(response as unknown as Record<string, unknown>);
} catch (error) {
this.error((error as Error).message);
}
Expand Down
2 changes: 1 addition & 1 deletion commander/src/bootstrapping/commands/generator/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export abstract class ImportCommand extends BaseIPCClientCommand {
this.error('APIClient is not initialized.');
}

const fileData = (fs.readJSONSync(flags['file-path']) as unknown) as KeysWithInfo;
const fileData = fs.readJSONSync(flags['file-path']) as unknown as KeysWithInfo;

for (const info of fileData.generatorInfo) {
await this._client.invoke('generator_setStatus', info);
Expand Down
4 changes: 2 additions & 2 deletions commander/src/bootstrapping/commands/keys/encrypt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ export class EncryptCommand extends Command {
const { flags } = await this.parse(EncryptCommand);
const password = flags.password ?? (await getPasswordFromPrompt('password', true));

const keysWithoutEncryption = (fs.readJSONSync(
const keysWithoutEncryption = fs.readJSONSync(
flags['file-path'],
) as unknown) as KeysWithoutEncryption;
) as unknown as KeysWithoutEncryption;

const keys = [];
for (const keyWithoutEncryption of keysWithoutEncryption.keys) {
Expand Down
2 changes: 1 addition & 1 deletion commander/src/bootstrapping/commands/keys/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export abstract class ImportCommand extends BaseIPCClientCommand {
this.error('APIClient is not initialized.');
}

const fileData = (fs.readJSONSync(flags['file-path']) as unknown) as Keys;
const fileData = fs.readJSONSync(flags['file-path']) as unknown as Keys;
const keys = fileData.keys.map(k => {
let type: 'encrypted' | 'plain';
let returnData;
Expand Down
4 changes: 1 addition & 3 deletions commander/src/bootstrapping/commands/passphrase/decrypt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ export class DecryptCommand extends Command {

async run(): Promise<void> {
const { flags } = await this.parse(DecryptCommand);
const { encryptedPassphrase } = (fs.readJSONSync(
flags['file-path'],
) as unknown) as inputFileData;
const { encryptedPassphrase } = fs.readJSONSync(flags['file-path']) as unknown as inputFileData;
const password = flags.password ?? (await getPasswordFromPrompt('password', true));
const passphrase = await cryptography.encrypt.decryptMessageWithPassword(
encryptedPassphrase,
Expand Down
12 changes: 6 additions & 6 deletions commander/src/bootstrapping/commands/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ export abstract class StartCommand extends Command {
}

// Read network genesis block and config from the folder
const { basePath: destBasePath, configFilePath, genesisBlockFilePath } = getConfigFilesPath(
dataPath,
);
const {
basePath: srcBasePath,
genesisBlockFilePath: srcGenesisBlockPath,
} = getNetworkConfigFilesPath(this.getApplicationConfigDir(), flags.network, true);
basePath: destBasePath,
configFilePath,
genesisBlockFilePath,
} = getConfigFilesPath(dataPath);
const { basePath: srcBasePath, genesisBlockFilePath: srcGenesisBlockPath } =
getNetworkConfigFilesPath(this.getApplicationConfigDir(), flags.network, true);

// If genesis block file exist, do not copy unless overwrite-config is specified
if (fs.existsSync(genesisBlockFilePath)) {
Expand Down
2 changes: 1 addition & 1 deletion commander/src/bootstrapping/commands/system/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export abstract class MetadataCommand extends BaseIPCClientCommand {
}
try {
const metadataInfo = await this._client.invoke('system_getMetadata');
this.printJSON((metadataInfo as unknown) as Record<string, unknown>);
this.printJSON(metadataInfo as unknown as Record<string, unknown>);
} catch (errors) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const errorMessage = Array.isArray(errors)
Expand Down
2 changes: 1 addition & 1 deletion commander/src/bootstrapping/commands/system/node-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export abstract class InfoCommand extends BaseIPCClientCommand {
}
try {
const nodeInfo = await this._client.node.getNodeInfo();
this.printJSON((nodeInfo as unknown) as Record<string, unknown>);
this.printJSON(nodeInfo as unknown as Record<string, unknown>);
} catch (errors) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const errorMessage = Array.isArray(errors)
Expand Down
2 changes: 1 addition & 1 deletion commander/src/bootstrapping/commands/transaction/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export abstract class GetCommand extends BaseIPCClientCommand {
if (/^Specified key transactions:id:(.*)does not exist/.test((errors as Error).message)) {
this.error(`Transaction with id '${transactionId}' was not found.`);
} else {
this.error(errorMessage);
this.error(errorMessage as string);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion commander/src/bootstrapping/commands/transaction/sign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ const signTransactionOnline = async (
});
let authAccount: AuthAccount;
if (account.mandatoryKeys.length === 0 && account.optionalKeys.length === 0) {
authAccount = (transactionObject.params as unknown) as AuthAccount;
authAccount = transactionObject.params as unknown as AuthAccount;
} else {
authAccount = account;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"*.{js}": ["prettier --write", "eslint"],
"*.{ts}": ["prettier --write", "eslint"],
"*.js": ["prettier --write", "eslint"],
"*.ts": ["prettier --write", "eslint"],
"*.{json,md}": ["prettier --write"]
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module.exports = {
globals: {
'ts-jest': {
tsconfig: './test/tsconfig.json',
},
},
testMatch: ['<rootDir>/test/**/?(*.)+(spec|test).+(ts|tsx|js)'],
setupFilesAfterEnv: ['<rootDir>/test/_setup.js'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
tsconfig: '<rootDir>/tsconfig.json',
},
],
},
verbose: false,
collectCoverage: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"main": "dist/index.js",
"scripts": {
"lint": "eslint --ext .js,.ts .",
"lint": "eslint --ext .ts .",
"lint:fix": "eslint --fix --ext .js,.ts .",
"format": "prettier --write '**/*'",
"prepack": "oclif manifest && oclif readme --multi --dir=docs/commands && npm shrinkwrap && npm prune --production && npm shrinkwrap",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require('jest-extended');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const matchers = require('jest-extended');

process.env.NODE_ENV = 'test';
expect.extend(matchers);
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module.exports = {
globals: {
'ts-jest': {
tsconfig: './test/tsconfig.json',
},
},
testMatch: ['<rootDir>/test/**/?(*.)+(spec|test).+(ts|tsx|js)'],
setupFilesAfterEnv: ['<rootDir>/test/_setup.js'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
tsconfig: '<rootDir>/tsconfig.json',
},
],
},
verbose: false,
collectCoverage: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"main": "dist-node/index.js",
"scripts": {
"format": "prettier --write '**/*'",
"lint": "eslint --ext .js,.ts .",
"lint": "eslint --ext .ts .",
"lint:fix": "eslint --fix --ext .js,.ts .",
"test": "jest --config=./test/unit/jest.config.js ",
"test:coverage": "jest --config=./test/unit/jest.config.js --coverage=true --coverage-reporters=text",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require('jest-extended');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const matchers = require('jest-extended');

process.env.NODE_ENV = 'test';
expect.extend(matchers);
7 changes: 4 additions & 3 deletions commander/src/utils/reader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,12 @@ export const readFileSource = async (source?: string): Promise<string> => {
return getDataFromFile(filePath);
} catch (error) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const { message } = error;
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
const { message } = error as Error;
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access, @typescript-eslint/prefer-regexp-exec
if (message.match(/ENOENT/)) {
throw new FileSystemError(getFileDoesNotExistError(filePath));
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access, @typescript-eslint/prefer-regexp-exec
if (message.match(/EACCES/)) {
throw new FileSystemError(getFileUnreadableError(filePath));
}
Expand Down Expand Up @@ -339,6 +339,7 @@ export const getParamsFromPrompt = async (
const questions = prepareQuestions(assetSchema);
let isTypeConfirm = false;
// Prompt user with prepared questions
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const result = await inquirer.prompt(questions).then(async answer => {
const inquirerResult = answer as { [key: string]: string };
isTypeConfirm = typeof inquirerResult.askAgain === 'boolean';
Expand Down
1 change: 1 addition & 0 deletions commander/test/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'import/no-extraneous-dependencies': [
Expand Down
2 changes: 1 addition & 1 deletion commander/test/base_bootstrap_command.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('base_bootstrap_command command', () => {
describe('_isLiskAppDir', () => {
it('should to check .liskrc.json file', async () => {
jest.spyOn(fs, 'existsSync').mockReturnValue(true);
new MyCommand([], (config as unknown) as Config)['_isLiskAppDir']('/my/dir');
new MyCommand([], config as unknown as Config)['_isLiskAppDir']('/my/dir');

expect(fs.existsSync).toHaveBeenCalledWith('/my/dir/.liskrc.json');
});
Expand Down
4 changes: 2 additions & 2 deletions commander/test/bootstrapping/commands/config/show.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('config:show command', () => {
describe('config:show', () => {
it('should get the config from default path', async () => {
await ShowCommand.run([], config);
expect(JSON.parse(stdout[0]).network.port).toEqual(3000);
expect(JSON.parse(stdout[0]).network.port).toBe(3000);
});
});

Expand Down Expand Up @@ -79,7 +79,7 @@ describe('config:show command', () => {
.calledWith(configPath)
.mockResolvedValue(customConfig);
await ShowCommand.run(['-c', configPath], config);
expect(JSON.parse(stdout[0]).network.port).toEqual(9999);
expect(JSON.parse(stdout[0]).network.port).toBe(9999);
});
});
});
2 changes: 1 addition & 1 deletion commander/test/bootstrapping/commands/console.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('hash-onion command', () => {
jest.spyOn(process.stdout, 'write').mockImplementation(val => stdout.push(val as string) > -1);
jest
.spyOn(repl, 'start')
.mockReturnValue(({ context: {}, on: jest.fn() } as unknown) as repl.REPLServer);
.mockReturnValue({ context: {}, on: jest.fn() } as unknown as repl.REPLServer);
});

describe('console', () => {
Expand Down
Loading

0 comments on commit 380ecb3

Please sign in to comment.