aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-05-15 03:48:46 +0800
committerFabio Berger <me@fabioberger.com>2018-05-15 05:27:41 +0800
commit5422bf57332f69d7b45e884c19a9f20d60bdec5b (patch)
tree589c915c4c085aad68809b7eb5123072beeda8d2
parentda60008048fdf99f3e00e9b83595dfc6572bdf73 (diff)
downloaddexon-sol-tools-5422bf57332f69d7b45e884c19a9f20d60bdec5b.tar.gz
dexon-sol-tools-5422bf57332f69d7b45e884c19a9f20d60bdec5b.tar.zst
dexon-sol-tools-5422bf57332f69d7b45e884c19a9f20d60bdec5b.zip
Fix TSLint issues
-rw-r--r--packages/contract-wrappers/test/global_hooks.ts2
-rw-r--r--packages/contract-wrappers/test/utils/chai_setup.ts2
-rw-r--r--packages/dev-utils/src/callback_error_reporter.ts15
-rw-r--r--packages/monorepo-scripts/src/postpublish_utils.ts10
-rw-r--r--packages/monorepo-scripts/src/publish.ts8
-rw-r--r--packages/monorepo-scripts/src/utils.ts4
-rw-r--r--packages/order-watcher/src/utils/assert.ts2
-rw-r--r--packages/order-watcher/test/global_hooks.ts2
-rw-r--r--packages/order-watcher/test/utils/chai_setup.ts2
9 files changed, 28 insertions, 19 deletions
diff --git a/packages/contract-wrappers/test/global_hooks.ts b/packages/contract-wrappers/test/global_hooks.ts
index 88f202761..53b3ef545 100644
--- a/packages/contract-wrappers/test/global_hooks.ts
+++ b/packages/contract-wrappers/test/global_hooks.ts
@@ -5,7 +5,7 @@ import * as path from 'path';
import { constants } from './utils/constants';
import { provider } from './utils/web3_wrapper';
-before('migrate contracts', async function() {
+before('migrate contracts', async function(): Promise<void> {
// HACK: Since the migrations take longer then our global mocha timeout limit
// we manually increase it for this before hook.
this.timeout(20000);
diff --git a/packages/contract-wrappers/test/utils/chai_setup.ts b/packages/contract-wrappers/test/utils/chai_setup.ts
index 078edd309..1a8733093 100644
--- a/packages/contract-wrappers/test/utils/chai_setup.ts
+++ b/packages/contract-wrappers/test/utils/chai_setup.ts
@@ -4,7 +4,7 @@ import ChaiBigNumber = require('chai-bignumber');
import * as dirtyChai from 'dirty-chai';
export const chaiSetup = {
- configure() {
+ configure(): void {
chai.config.includeStack = true;
chai.use(ChaiBigNumber());
chai.use(dirtyChai);
diff --git a/packages/dev-utils/src/callback_error_reporter.ts b/packages/dev-utils/src/callback_error_reporter.ts
index c8e693673..8432bb5d4 100644
--- a/packages/dev-utils/src/callback_error_reporter.ts
+++ b/packages/dev-utils/src/callback_error_reporter.ts
@@ -6,7 +6,10 @@ import { DoneCallback } from '@0xproject/types';
const expect = chai.expect;
export const callbackErrorReporter = {
- reportNoErrorCallbackErrors(done: DoneCallback, expectToBeCalledOnce = true) {
+ reportNoErrorCallbackErrors(
+ done: DoneCallback,
+ expectToBeCalledOnce: boolean = true,
+ ): <T>(f?: ((value: T) => void) | undefined) => (value: T) => void {
const callback = <T>(f?: (value: T) => void) => {
const wrapped = (value: T) => {
if (_.isUndefined(f)) {
@@ -26,7 +29,10 @@ export const callbackErrorReporter = {
};
return callback;
},
- reportNodeCallbackErrors(done: DoneCallback, expectToBeCalledOnce = true) {
+ reportNodeCallbackErrors(
+ done: DoneCallback,
+ expectToBeCalledOnce: boolean = true,
+ ): <T>(f?: ((value: T) => void) | undefined) => (error: Error | null, value: T | undefined) => void {
const callback = <T>(f?: (value: T) => void) => {
const wrapped = (error: Error | null, value: T | undefined) => {
if (!_.isNull(error)) {
@@ -50,7 +56,10 @@ export const callbackErrorReporter = {
};
return callback;
},
- assertNodeCallbackError(done: DoneCallback, errMsg: string) {
+ assertNodeCallbackError(
+ done: DoneCallback,
+ errMsg: string,
+ ): <T>(error: Error | null, value: T | undefined) => void {
const wrapped = <T>(error: Error | null, value: T | undefined) => {
if (_.isNull(error)) {
done(new Error('Expected callback to receive an error'));
diff --git a/packages/monorepo-scripts/src/postpublish_utils.ts b/packages/monorepo-scripts/src/postpublish_utils.ts
index df2bcb128..5fbff938e 100644
--- a/packages/monorepo-scripts/src/postpublish_utils.ts
+++ b/packages/monorepo-scripts/src/postpublish_utils.ts
@@ -74,7 +74,7 @@ export const postpublishUtils = {
utils.log(`POSTPUBLISH: No S3Bucket config found for ${packageJSON.name}. Skipping doc JSON generation.`);
}
},
- async publishDocsToStagingAsync(packageJSON: any, tsConfigJSON: any, cwd: string) {
+ async publishDocsToStagingAsync(packageJSON: any, tsConfigJSON: any, cwd: string): Promise<void> {
const configs = this.generateConfig(packageJSON, tsConfigJSON, cwd);
if (_.isUndefined(configs.docPublishConfigs.s3StagingBucketPath)) {
utils.log('config.postpublish.docPublishConfigs.s3StagingBucketPath entry in package.json not found!');
@@ -109,7 +109,7 @@ export const postpublishUtils = {
assets,
});
},
- getReleaseNotes(packageName: string, version: string) {
+ getReleaseNotes(packageName: string, version: string): string {
const packageNameWithNamespace = packageName.replace('@0xproject/', '');
const changelogJSONPath = path.join(
constants.monorepoRootPath,
@@ -135,14 +135,14 @@ export const postpublishUtils = {
});
return notes;
},
- getTag(packageName: string, version: string) {
+ getTag(packageName: string, version: string): string {
return `${packageName}@${version}`;
},
getReleaseName(subPackageName: string, version: string): string {
const releaseName = `${subPackageName} v${version}`;
return releaseName;
},
- adjustAssetPaths(cwd: string, assets: string[]) {
+ adjustAssetPaths(cwd: string, assets: string[]): string[] {
const finalAssets: string[] = [];
_.each(assets, (asset: string) => {
finalAssets.push(`${cwd}/${asset}`);
@@ -164,7 +164,7 @@ export const postpublishUtils = {
});
return fileIncludesAdjusted;
},
- async generateAndUploadDocsAsync(cwd: string, fileIncludes: string[], version: string, S3BucketPath: string) {
+ async generateAndUploadDocsAsync(cwd: string, fileIncludes: string[], version: string, S3BucketPath: string): Promise<void> {
const fileIncludesAdjusted = this.adjustFileIncludePaths(fileIncludes, cwd);
const projectFiles = fileIncludesAdjusted.join(' ');
const jsonFilePath = `${cwd}/${generatedDocsDirectoryName}/index.json`;
diff --git a/packages/monorepo-scripts/src/publish.ts b/packages/monorepo-scripts/src/publish.ts
index a5be40014..9fa0230c8 100644
--- a/packages/monorepo-scripts/src/publish.ts
+++ b/packages/monorepo-scripts/src/publish.ts
@@ -72,7 +72,7 @@ const packageNameToWebsitePath: { [name: string]: string } = {
process.exit(1);
});
-async function confirmDocPagesRenderAsync(packages: LernaPackage[]) {
+async function confirmDocPagesRenderAsync(packages: LernaPackage[]): Promise<void> {
// push docs to staging
utils.log("Upload all docJson's to S3 staging...");
await execAsync(`yarn lerna:stage_docs`, { cwd: constants.monorepoRootPath });
@@ -162,7 +162,7 @@ async function checkPublishRequiredSetupAsync(): Promise<boolean> {
return true;
}
-async function pushChangelogsToGithubAsync() {
+async function pushChangelogsToGithubAsync(): Promise<void> {
await execAsync(`git add . --all`, { cwd: constants.monorepoRootPath });
await execAsync(`git commit -m "Updated CHANGELOGS"`, { cwd: constants.monorepoRootPath });
await execAsync(`git push`, { cwd: constants.monorepoRootPath });
@@ -228,7 +228,7 @@ async function updateChangeLogsAsync(updatedPublicLernaPackages: LernaPackage[])
return packageToVersionChange;
}
-async function lernaPublishAsync(packageToVersionChange: { [name: string]: string }) {
+async function lernaPublishAsync(packageToVersionChange: { [name: string]: string }): Promise<void> {
// HACK: Lerna publish does not provide a way to specify multiple package versions via
// flags so instead we need to interact with their interactive prompt interface.
const child = spawn('lerna', ['publish', '--registry=https://registry.npmjs.org/'], {
@@ -269,7 +269,7 @@ async function lernaPublishAsync(packageToVersionChange: { [name: string]: strin
});
}
-function updateVersionNumberIfNeeded(currentVersion: string, proposedNextVersion: string) {
+function updateVersionNumberIfNeeded(currentVersion: string, proposedNextVersion: string): string {
if (proposedNextVersion === currentVersion) {
return utils.getNextPatchVersion(currentVersion);
}
diff --git a/packages/monorepo-scripts/src/utils.ts b/packages/monorepo-scripts/src/utils.ts
index 4412f753a..480788ad8 100644
--- a/packages/monorepo-scripts/src/utils.ts
+++ b/packages/monorepo-scripts/src/utils.ts
@@ -17,7 +17,7 @@ export const utils = {
const newPatchVersion = `${versionSegments[0]}.${versionSegments[1]}.${newPatch}`;
return newPatchVersion;
},
- async prettifyAsync(filePath: string, cwd: string) {
+ async prettifyAsync(filePath: string, cwd: string): Promise<void> {
await execAsync(`prettier --write ${filePath} --config .prettierrc`, {
cwd,
});
@@ -43,7 +43,7 @@ export const utils = {
}
return updatedPackages;
},
- getChangelogJSONIfExists(changelogPath: string) {
+ getChangelogJSONIfExists(changelogPath: string): string|undefined {
try {
const changelogJSON = fs.readFileSync(changelogPath, 'utf-8');
return changelogJSON;
diff --git a/packages/order-watcher/src/utils/assert.ts b/packages/order-watcher/src/utils/assert.ts
index f96bcebc1..9e02f8bdc 100644
--- a/packages/order-watcher/src/utils/assert.ts
+++ b/packages/order-watcher/src/utils/assert.ts
@@ -12,7 +12,7 @@ import { isValidSignature } from '@0xproject/order-utils';
export const assert = {
...sharedAssert,
- isValidSignature(orderHash: string, ecSignature: ECSignature, signerAddress: string) {
+ isValidSignature(orderHash: string, ecSignature: ECSignature, signerAddress: string): void {
const isValid = isValidSignature(orderHash, ecSignature, signerAddress);
this.assert(isValid, `Expected order with hash '${orderHash}' to have a valid signature`);
},
diff --git a/packages/order-watcher/test/global_hooks.ts b/packages/order-watcher/test/global_hooks.ts
index 88f202761..53b3ef545 100644
--- a/packages/order-watcher/test/global_hooks.ts
+++ b/packages/order-watcher/test/global_hooks.ts
@@ -5,7 +5,7 @@ import * as path from 'path';
import { constants } from './utils/constants';
import { provider } from './utils/web3_wrapper';
-before('migrate contracts', async function() {
+before('migrate contracts', async function(): Promise<void> {
// HACK: Since the migrations take longer then our global mocha timeout limit
// we manually increase it for this before hook.
this.timeout(20000);
diff --git a/packages/order-watcher/test/utils/chai_setup.ts b/packages/order-watcher/test/utils/chai_setup.ts
index 078edd309..1a8733093 100644
--- a/packages/order-watcher/test/utils/chai_setup.ts
+++ b/packages/order-watcher/test/utils/chai_setup.ts
@@ -4,7 +4,7 @@ import ChaiBigNumber = require('chai-bignumber');
import * as dirtyChai from 'dirty-chai';
export const chaiSetup = {
- configure() {
+ configure(): void {
chai.config.includeStack = true;
chai.use(ChaiBigNumber());
chai.use(dirtyChai);