Skip to content

Commit 24cae72

Browse files
authored
Fixed eslint warnings (#538)
* Fixed #535 * Fixed #536
1 parent bf0ba0a commit 24cae72

File tree

97 files changed

+2237
-2077
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+2237
-2077
lines changed

.eslintrc.js

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11
module.exports = {
2-
parser: "@typescript-eslint/parser", // Specifies the ESLint parser
2+
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
33
extends: [
4-
"plugin:@typescript-eslint/recommended", // Uses the recommended rules from the @typescript-eslint/eslint-plugin
5-
"prettier/@typescript-eslint", // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
6-
"plugin:prettier/recommended" // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
4+
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
5+
'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
6+
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
77
],
88
parserOptions: {
99
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
10-
sourceType: "module" // Allows for the use of imports
10+
sourceType: 'module', // Allows for the use of imports
1111
},
1212
rules: {
13-
"@typescript-eslint/no-non-null-assertion": "off",
14-
"@typescript-eslint/interface-name-prefix": "off",
15-
"@typescript-eslint/camelcase": "off",
13+
'@typescript-eslint/no-non-null-assertion': 'off',
14+
'@typescript-eslint/interface-name-prefix': 'off',
15+
'@typescript-eslint/camelcase': 'off',
1616
// TODO fix all the warnings
17-
"@typescript-eslint/explicit-function-return-type": "warn",
18-
"@typescript-eslint/no-unused-vars": "warn",
19-
"@typescript-eslint/no-inferrable-types": "warn",
20-
"@typescript-eslint/no-use-before-define": "warn"
21-
}
17+
'@typescript-eslint/no-explicit-any': 'off',
18+
},
2219
};

.travis.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
language: node_js
22
node_js:
3-
- '8'
4-
- '9'
5-
- '10'
6-
- '12'
3+
- "10"
4+
- "12"
75
cache:
86
directories:
9-
- 'node_modules'
7+
- "node_modules"
108
- .eslintcache
119
before_script:
1210
- npm run build
@@ -24,16 +22,16 @@ deploy:
2422
script: /bin/sh travis/github-pages.sh
2523
on:
2624
branch: master
27-
node_js: '12'
25+
node_js: "12"
2826
- provider: script
2927
skip_cleanup: true
3028
script: /bin/sh travis/uploadArchives.sh
3129
on:
3230
branch: master
33-
node_js: '10'
31+
node_js: "10"
3432
- provider: script
3533
skip_cleanup: true
3634
script: /bin/sh travis/release.sh
3735
on:
3836
branch: $RELEASE_BRANCH
39-
node_js: '10'
37+
node_js: "10"

e2e/infrastructure/BlockHttp.spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ describe('BlockHttp', () => {
3434
let account2: Account;
3535
let blockRepository: BlockRepository;
3636
let receiptRepository: ReceiptRepository;
37-
let blockReceiptHash = '';
38-
let blockTransactionHash = '';
3937
let chainHeight;
4038
let generationHash: string;
4139
let networkType: NetworkType;
@@ -86,8 +84,6 @@ describe('BlockHttp', () => {
8684
describe('getBlockByHeight', () => {
8785
it('should return block info given height', async () => {
8886
const blockInfo = await blockRepository.getBlockByHeight(UInt64.fromUint(1)).toPromise();
89-
blockReceiptHash = blockInfo.blockReceiptsHash;
90-
blockTransactionHash = blockInfo.blockTransactionsHash;
9187
expect(blockInfo.height.lower).to.be.equal(1);
9288
expect(blockInfo.height.higher).to.be.equal(0);
9389
expect(blockInfo.timestamp.lower).to.be.equal(0);

e2e/infrastructure/IntegrationTestHelper.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import { SignedTransaction } from '../../src/model/transaction/SignedTransaction
2424
import { Transaction } from '../../src/model/transaction/Transaction';
2525
import { UInt64 } from '../../src/model/UInt64';
2626
import { TransactionService } from '../../src/service/TransactionService';
27-
import { NetworkHarvestLocal } from '../../src/model/mosaic/NetworkHarvestLocal';
2827
import { NetworkCurrencyPublic } from '../../src/model/mosaic/NetworkCurrencyPublic';
2928
import { NetworkCurrencyLocal } from '../../src/model/mosaic/NetworkCurrencyLocal';
3029
import { NamespaceId } from '../../src/model/namespace/NamespaceId';

e2e/infrastructure/Listener.spec.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import { assert, expect } from 'chai';
1717
import { ChronoUnit } from 'js-joda';
1818
import { filter } from 'rxjs/operators';
1919
import { AccountRepository } from '../../src/infrastructure/AccountRepository';
20-
import { NamespaceRepository } from '../../src/infrastructure/NamespaceRepository';
2120
import { TransactionRepository } from '../../src/infrastructure/TransactionRepository';
2221
import { Account } from '../../src/model/account/Account';
2322
import { PlainMessage } from '../../src/model/message/PlainMessage';
@@ -40,7 +39,6 @@ describe('Listener', () => {
4039
let cosignAccount2: Account;
4140
let cosignAccount3: Account;
4241
let accountRepository: AccountRepository;
43-
let namespaceRepository: NamespaceRepository;
4442
let generationHash: string;
4543
let networkType: NetworkType;
4644
const NetworkCurrencyLocalId: NamespaceId = helper.networkCurrencyNamespaceId;
@@ -57,7 +55,6 @@ describe('Listener', () => {
5755
generationHash = helper.generationHash;
5856
networkType = helper.networkType;
5957
accountRepository = helper.repositoryFactory.createAccountRepository();
60-
namespaceRepository = helper.repositoryFactory.createNamespaceRepository();
6158
transactionRepository = helper.repositoryFactory.createTransactionRepository();
6259
});
6360
});
@@ -97,7 +94,7 @@ describe('Listener', () => {
9794
signedAggregatedTransaction: SignedTransaction,
9895
signer: Account,
9996
mosaicId: MosaicId | NamespaceId,
100-
) => {
97+
): void => {
10198
const lockFundsTransaction = LockFundsTransaction.create(
10299
Deadline.create(),
103100
new Mosaic(mosaicId, UInt64.fromUint(10 * Math.pow(10, helper.networkCurrencyDivisibility))),

e2e/infrastructure/TransactionHttp.spec.ts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,14 @@
1616
import { expect } from 'chai';
1717
import * as CryptoJS from 'crypto-js';
1818
import { ChronoUnit } from 'js-joda';
19-
import { keccak_256, sha3_256 } from 'js-sha3';
19+
import { sha3_256 } from 'js-sha3';
2020
import { Crypto } from '../../src/core/crypto';
2121
import { Convert, Convert as convert } from '../../src/core/format';
2222
import { TransactionMapping } from '../../src/core/utils/TransactionMapping';
2323
import { AccountRepository } from '../../src/infrastructure/AccountRepository';
24-
import { MultisigRepository } from '../../src/infrastructure/MultisigRepository';
2524
import { NamespaceRepository } from '../../src/infrastructure/NamespaceRepository';
26-
import { RepositoryFactory } from '../../src/infrastructure/RepositoryFactory';
2725
import { TransactionRepository } from '../../src/infrastructure/TransactionRepository';
2826
import { Account } from '../../src/model/account/Account';
29-
import { Address } from '../../src/model/account/Address';
30-
import { PublicAccount } from '../../src/model/account/PublicAccount';
3127
import { PlainMessage } from '../../src/model/message/PlainMessage';
3228
import { Mosaic } from '../../src/model/mosaic/Mosaic';
3329
import { MosaicFlags } from '../../src/model/mosaic/MosaicFlags';
@@ -82,14 +78,7 @@ describe('TransactionHttp', () => {
8278
let account3: Account;
8379
let multisigAccount: Account;
8480
let cosignAccount1: Account;
85-
let cosignAccount2: Account;
86-
let cosignAccount3: Account;
87-
let accountAddress: Address;
88-
let accountPublicKey: string;
89-
let publicAccount: PublicAccount;
90-
let repositoryFactory: RepositoryFactory;
9181
let accountRepository: AccountRepository;
92-
let multisigRepository: MultisigRepository;
9382
let namespaceRepository: NamespaceRepository;
9483
let generationHash: string;
9584
let networkType: NetworkType;
@@ -112,17 +101,10 @@ describe('TransactionHttp', () => {
112101
account3 = helper.account3;
113102
multisigAccount = helper.multisigAccount;
114103
cosignAccount1 = helper.cosignAccount1;
115-
cosignAccount2 = helper.cosignAccount2;
116-
cosignAccount3 = helper.cosignAccount3;
117-
accountAddress = helper.account.address;
118104
harvestingAccount = helper.harvestingAccount;
119-
accountPublicKey = helper.account.publicKey;
120-
publicAccount = helper.account.publicAccount;
121105
generationHash = helper.generationHash;
122106
networkType = helper.networkType;
123-
repositoryFactory = helper.repositoryFactory;
124107
accountRepository = helper.repositoryFactory.createAccountRepository();
125-
multisigRepository = helper.repositoryFactory.createMultisigRepository();
126108
namespaceRepository = helper.repositoryFactory.createNamespaceRepository();
127109
transactionRepository = helper.repositoryFactory.createTransactionRepository();
128110
});
@@ -1166,7 +1148,6 @@ describe('TransactionHttp', () => {
11661148
it('standalone', () => {
11671149
const randomBytes = secureRandom.randomBuffer(32);
11681150
const secretSeed = randomBytes.toString('hex');
1169-
const hash = sha256(Buffer.from(secretSeed, 'hex'));
11701151
// const secret = sha256(Buffer.from(hash, 'hex'));
11711152
const secret = LockHashUtils.Op_Hash_256(randomBytes);
11721153
const proof = secretSeed;

e2e/infrastructure/UnresolvedMapping.spec.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@
1515
*/
1616
import { expect } from 'chai';
1717
import { Convert } from '../../src/core/format';
18-
import { NamespaceRepository } from '../../src/infrastructure/NamespaceRepository';
19-
import { TransactionHttp } from '../../src/infrastructure/TransactionHttp';
2018
import { Account } from '../../src/model/account/Account';
21-
import { Address } from '../../src/model/account/Address';
2219
import { PlainMessage } from '../../src/model/message/PlainMessage';
2320
import { MosaicFlags } from '../../src/model/mosaic/MosaicFlags';
2421
import { MosaicId } from '../../src/model/mosaic/MosaicId';
@@ -46,11 +43,9 @@ describe('TransactionHttp', () => {
4643
const helper = new IntegrationTestHelper();
4744
let account: Account;
4845
let account2: Account;
49-
let namespaceRepository: NamespaceRepository;
5046
let generationHash: string;
5147
let networkType: NetworkType;
5248
let mosaicId: MosaicId;
53-
let NetworkCurrencyLocalId: MosaicId;
5449
let namespaceIdAddress: NamespaceId;
5550
let namespaceIdMosaic: NamespaceId;
5651

@@ -60,7 +55,6 @@ describe('TransactionHttp', () => {
6055
account2 = helper.account2;
6156
generationHash = helper.generationHash;
6257
networkType = helper.networkType;
63-
namespaceRepository = helper.repositoryFactory.createNamespaceRepository();
6458
});
6559
});
6660

@@ -77,11 +71,6 @@ describe('TransactionHttp', () => {
7771
* Setup test data
7872
* =========================
7973
*/
80-
describe('Get network currency mosaic id', () => {
81-
it('get mosaicId', async () => {
82-
NetworkCurrencyLocalId = (await namespaceRepository.getLinkedMosaicId(new NamespaceId('cat.currency')).toPromise()) as MosaicId;
83-
});
84-
});
8574

8675
describe('MosaicDefinitionTransaction', () => {
8776
it('standalone', () => {

e2e/service/BlockService.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ describe('BlockService', () => {
3232
let generationHash: string;
3333
let account: Account;
3434
let account2: Account;
35-
let account3: Account;
3635
let networkType: NetworkType;
3736
let transactionHash: string;
3837
let blockService: BlockService;
@@ -43,7 +42,6 @@ describe('BlockService', () => {
4342
return helper.start().then(() => {
4443
account = helper.account;
4544
account2 = helper.account2;
46-
account3 = helper.account3;
4745
generationHash = helper.generationHash;
4846
networkType = helper.networkType;
4947
transactionRepository = helper.repositoryFactory.createTransactionRepository();

e2e/service/MosaicService.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import { AccountRepository } from '../../src/infrastructure/AccountRepository';
1818
import { MosaicRepository } from '../../src/infrastructure/MosaicRepository';
1919
import { Address } from '../../src/model/account/Address';
20-
import { NetworkType } from '../../src/model/network/NetworkType';
2120
import { MosaicService } from '../../src/service/MosaicService';
2221
import { IntegrationTestHelper } from '../infrastructure/IntegrationTestHelper';
2322

0 commit comments

Comments
 (0)