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

Commit

Permalink
♻️ Update elements and client, and remove all tslint reference
Browse files Browse the repository at this point in the history
🔥 Remove unused file
♻️ Fix script
♻️ Remove more
  • Loading branch information
shuse2 committed Apr 23, 2020
1 parent bf63ae4 commit 98612d2
Show file tree
Hide file tree
Showing 98 changed files with 155 additions and 358 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ docs/
lisk/
templates/
types/
examples/
**/*.d.ts
1 change: 0 additions & 1 deletion .nycrc

This file was deleted.

54 changes: 0 additions & 54 deletions Jenkinsfile.sonar

This file was deleted.

2 changes: 1 addition & 1 deletion commander/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"scripts": {
"start": "ts-node src/index.js",
"format": "prettier --write '**/*'",
"lint": "eslint . --ext .js,.ts",
"lint": "eslint --ext .js,.ts .",
"lint:fix": "eslint --fix --ext .js,.ts .",
"test": "TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT=./test/tsconfig.json nyc mocha",
"test:watch": "npm run test:local -- --watch",
Expand Down
1 change: 0 additions & 1 deletion commander/src/commands/config/set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ export default class SetCommand extends BaseCommand {
{
name: 'variable',
required: true,
// tslint:disable-next-line array-type
options: CONFIG_VARIABLES as Array<string>,
description: '',
},
Expand Down
1 change: 0 additions & 1 deletion commander/src/commands/core/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@ export default class InstallCommand extends BaseCommand {

await tasks.run();
if (!noStart) {
// tslint:disable-next-line await-promise
await StartCommand.run([name]);
const newInstance = await describeApplication(name);
this.print(newInstance);
Expand Down
2 changes: 0 additions & 2 deletions commander/src/commands/core/restart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ export default class RestartCommand extends BaseCommand {

return;
}
// tslint:disable-next-line await-promise
await StopCommand.run([name]);
// tslint:disable-next-line await-promise
await StartCommand.run([name]);
}
}
2 changes: 0 additions & 2 deletions commander/src/commands/core/start/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ export default class StartCommand extends BaseCommand {
return;
}

// tslint:disable-next-line await-promise
await CacheCommand.run([name]);
// tslint:disable-next-line await-promise
await DatabaseCommand.run([name]);

const tasks = new Listr([
Expand Down
2 changes: 0 additions & 2 deletions commander/src/commands/core/stop/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ export default class StopCommand extends BaseCommand {
return;
}

// tslint:disable-next-line await-promise
await CacheCommand.run([name]);
// tslint:disable-next-line await-promise
await DatabaseCommand.run([name]);

const tasks = new Listr([
Expand Down
1 change: 0 additions & 1 deletion commander/src/commands/core/uninstall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export default class UnInstallCommand extends BaseCommand {

return;
}
// tslint:disable-next-line await-promise
await StopCommand.run([name]);

const { installationPath, network } = instance;
Expand Down
1 change: 0 additions & 1 deletion commander/src/commands/transaction/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ export default class CreateCommand extends BaseCommand {
? typeNumberMap[type]
: type;
const resolvedFlags = Object.entries(flags).reduce(resolveFlags, []);
// tslint:disable-next-line await-promise
await typeClassMap[commandType].run([...argv, ...resolvedFlags]);
}
}
2 changes: 0 additions & 2 deletions commander/src/commands/transaction/create/pom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ export default class PoMCommand extends BaseCommand {
throw new ValidationError('Enter a valid fee in number string format.');
}

// tslint:disable-next-line no-let
let header1: RawHeader;
try {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
Expand All @@ -149,7 +148,6 @@ export default class PoMCommand extends BaseCommand {
);
}

// tslint:disable-next-line no-let
let header2: RawHeader;
try {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
Expand Down
1 change: 0 additions & 1 deletion commander/src/commands/transaction/sign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ const getPassphrasesFromPrompt = async (
numberOfPassphrases = 1,
): Promise<ReadonlyArray<string>> => {
const passphrases = [];
// tslint:disable-next-line: no-let
for (let index = 0; index < numberOfPassphrases; index += 1) {
const passphrase = await getPassphraseFromPrompt('passphrase', true);
passphrases.push(passphrase);
Expand Down
4 changes: 0 additions & 4 deletions commander/src/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export type WritableValue =
| object;

interface ConfigOptionsIndex {
// tslint:disable-next-line readonly-keyword
[key: string]: WritableValue;
}

Expand Down Expand Up @@ -62,13 +61,11 @@ const attemptCallWithError = <T>(fn: () => T, errorMessage: string): T => {

const attemptToCreateDir = (dirPath: string): void => {
const fn = fs.mkdirSync.bind(undefined, dirPath);
// tslint:disable-next-line invalid-void
attemptCallWithError<void>(fn, fileWriteErrorMessage(dirPath));
};

const attemptToCreateFile = (filePath: string): void => {
const fn = writeJSONSync.bind(undefined, filePath, defaultConfig);
// tslint:disable-next-line invalid-void
attemptCallWithError<void>(fn, fileWriteErrorMessage(filePath));
};

Expand Down Expand Up @@ -98,7 +95,6 @@ const attemptToValidateConfig = (config: object, filePath: string): void => {
};
const errorMessage = `Config file seems to be corrupted: missing required keys. Please check ${filePath} or delete the file so we can create a new one from defaults.`;

// tslint:disable-next-line invalid-void
attemptCallWithError<void>(fn, errorMessage);
};

Expand Down
1 change: 0 additions & 1 deletion commander/src/utils/query.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { APIClient } from '@liskhq/lisk-api-client';
// tslint:disable-next-line no-submodule-imports
import { NodeResource } from '@liskhq/lisk-api-client/dist-node/resources/node';

/*
Expand Down
3 changes: 0 additions & 3 deletions commander/src/utils/reader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ export const getPassphraseFromPrompt = async (
),
'Warning: ',
);
// tslint:disable-next-line no-console
console.warn(passphraseWarning);
}
});
Expand All @@ -116,7 +115,6 @@ export const isFileSource = (source?: string): boolean => {
}
const delimiter = ':';
const sourceParts = source.split(delimiter);
// tslint:disable-next-line no-magic-numbers
if (sourceParts.length === 2 && sourceParts[0] === 'file') {
return true;
}
Expand Down Expand Up @@ -156,7 +154,6 @@ const DEFAULT_TIMEOUT = 100;

export const readStdIn = async (): Promise<string[]> => {
const readFromStd = new Promise<string[]>((resolve, reject) => {
// tslint:disable readonly-array
const lines: string[] = [];
const rl = readline.createInterface({ input: process.stdin });

Expand Down
2 changes: 0 additions & 2 deletions commander/src/utils/tablify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ const getKeyValueArray = (array: ReadonlyArray<object>) =>
? array.map(getKeyValueObject).join('\n\n')
: array.join('\n');

// tslint:disable-next-line readonly-array
const addValuesToTable = (table: object[], data: object) => {
Object.entries(data).forEach(([key, values]) => {
const strValue = Array.isArray(values)
Expand All @@ -71,7 +70,6 @@ export const tablify = (data: ReadonlyArray<object> | object) => {

if (Array.isArray(data)) {
data.forEach((value, key) => {
// tslint:disable-next-line readonly-array
const cell: Cell[] = [
{
colSpan: 2,
Expand Down
1 change: 0 additions & 1 deletion commander/test/utils/tablify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ describe('tablify utils', () => {

describe('a cyclic object', () => {
it('should throw an error', () => {
// tslint:disable-next-line no-any
const printValue: any = {
root: 'value',
nested: {
Expand Down
2 changes: 1 addition & 1 deletion elements/lisk-api-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"scripts": {
"clean": "./scripts/clean.sh",
"format": "prettier --write '**/*'",
"lint": "eslint . --ext .js,.ts",
"lint": "eslint --ext .js,.ts .",
"lint:fix": "eslint --fix --ext .js,.ts .",
"test": "jest",
"test:watch": "npm test -- --watch",
Expand Down
2 changes: 1 addition & 1 deletion elements/lisk-bft/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"scripts": {
"clean": "./scripts/clean.sh",
"format": "prettier --write '**/*'",
"lint": "eslint . --ext .js,.ts",
"lint": "eslint --ext .js,.ts .",
"lint:fix": "eslint --fix --ext .js,.ts .",
"test": "jest",
"test:watch": "npm test -- --watch",
Expand Down
10 changes: 0 additions & 10 deletions elements/lisk-bft/src/finality_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ export class FinalityManager extends EventEmitter {
// Set constants
this.activeDelegates = activeDelegates;

/* tslint:disable:no-magic-numbers */
// Threshold to consider a block pre-voted
this.preVoteThreshold = Math.ceil((this.activeDelegates * 2) / 3);

Expand All @@ -104,8 +103,6 @@ export class FinalityManager extends EventEmitter {
this.state = {};
this.preVotes = {};
this.preCommits = {};

/* tslint:enable:no-magic-numbers */
}

public async addBlockHeader(
Expand Down Expand Up @@ -282,7 +279,6 @@ export class FinalityManager extends EventEmitter {
throw new Error('Cannot find a block to recompute');
}

// tslint:disable-next-line no-let
for (let i = blockHeaders.length - 1; i >= 0; i -= 1) {
const blockHeader = blockHeaders[i];
const bftBlockHeader = blockHeaders.slice(i + 1);
Expand Down Expand Up @@ -332,9 +328,7 @@ export class FinalityManager extends EventEmitter {
}

// Order the two block headers such that earlierBlock must be forged first
// tslint:disable-next-line no-let
let earlierBlock = delegateLastBlock;
// tslint:disable-next-line no-let
let laterBlock = blockHeader;
const higherMaxHeightPreviouslyForged =
earlierBlock.maxHeightPreviouslyForged >
Expand Down Expand Up @@ -402,7 +396,6 @@ export class FinalityManager extends EventEmitter {
header: BlockHeader,
bftApplicableBlocks: ReadonlyArray<BlockHeader>,
): number {
// tslint:disable-next-line no-let
let needleHeight = Math.max(
header.maxHeightPreviouslyForged,
header.height - this.processingThreshold,
Expand All @@ -414,7 +407,6 @@ export class FinalityManager extends EventEmitter {
header.height - this.processingThreshold,
);
// Hold reference for the previously forged height
// tslint:disable-next-line no-let
let previousBlockHeight = header.maxHeightPreviouslyForged;

const blocksIncludingCurrent = [header, ...bftApplicableBlocks];
Expand Down Expand Up @@ -450,7 +442,6 @@ export class FinalityManager extends EventEmitter {
}

private _cleanup(): void {
// tslint:disable:no-delete no-dynamic-delete
Object.keys(this.preVotes)
.slice(0, this.maxHeaders * -1)
.forEach(key => {
Expand All @@ -462,6 +453,5 @@ export class FinalityManager extends EventEmitter {
.forEach(key => {
delete this.preCommits[key];
});
// tslint:enable:no-delete no-dynamic-delete
}
}
2 changes: 0 additions & 2 deletions elements/lisk-bft/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ export interface StateStore {

export class BFTError extends Error {}

/* tslint:disable:max-classes-per-file */

export class BFTChainDisjointError extends BFTError {
public constructor() {
super(
Expand Down
2 changes: 1 addition & 1 deletion elements/lisk-chain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"scripts": {
"clean": "./scripts/clean.sh",
"format": "prettier --write '**/*'",
"lint": "eslint . --ext .js,.ts",
"lint": "eslint --ext .js,.ts .",
"lint:fix": "eslint --fix --ext .js,.ts .",
"test": "jest",
"test:watch": "npm test -- --watch",
Expand Down
3 changes: 3 additions & 0 deletions elements/lisk-client/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist-node
dist-browser
jest.config.js
7 changes: 7 additions & 0 deletions elements/lisk-client/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
extends: '../../.eslintrc.js',
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
};
1 change: 0 additions & 1 deletion elements/lisk-client/.nycrc

This file was deleted.

14 changes: 9 additions & 5 deletions elements/lisk-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"uglify": "uglifyjs -nm -o ./dist-browser/index.min.js ./dist-browser/index.js",
"clean": "./scripts/clean.sh",
"format": "prettier --write '**/*'",
"lint": "tslint --format verbose --project .",
"lint:fix": "npm run lint -- --fix",
"lint": "eslint --ext .js,.ts .",
"lint:fix": "eslint --fix --ext .js,.ts .",
"test": "jest",
"test:watch": "npm test -- --watch",
"test:node": "npm run build:check",
Expand All @@ -53,6 +53,13 @@
"devDependencies": {
"@types/jest": "25.1.3",
"@types/jest-when": "2.7.0",
"@typescript-eslint/eslint-plugin": "2.28.0",
"@typescript-eslint/parser": "2.28.0",
"eslint": "6.8.0",
"eslint-config-lisk-base": "1.2.2",
"eslint-config-prettier": "6.10.0",
"eslint-plugin-import": "2.20.1",
"eslint-plugin-jest": "23.8.2",
"browserify": "16.5.0",
"jest": "25.1.0",
"jest-extended": "0.11.5",
Expand All @@ -61,9 +68,6 @@
"source-map-support": "0.5.16",
"ts-node": "8.6.2",
"tsconfig-paths": "3.9.0",
"tslint": "6.0.0",
"tslint-config-prettier": "1.18.0",
"tslint-immutable": "6.0.1",
"typescript": "3.8.3",
"uglify-es": "3.3.9"
}
Expand Down
Loading

0 comments on commit 98612d2

Please sign in to comment.