Fix TSLint issues
This commit is contained in:
		@@ -5,7 +5,7 @@ import * as path from 'path';
 | 
				
			|||||||
import { constants } from './utils/constants';
 | 
					import { constants } from './utils/constants';
 | 
				
			||||||
import { provider } from './utils/web3_wrapper';
 | 
					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
 | 
					    // HACK: Since the migrations take longer then our global mocha timeout limit
 | 
				
			||||||
    // we manually increase it for this before hook.
 | 
					    // we manually increase it for this before hook.
 | 
				
			||||||
    this.timeout(20000);
 | 
					    this.timeout(20000);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,7 @@ import ChaiBigNumber = require('chai-bignumber');
 | 
				
			|||||||
import * as dirtyChai from 'dirty-chai';
 | 
					import * as dirtyChai from 'dirty-chai';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const chaiSetup = {
 | 
					export const chaiSetup = {
 | 
				
			||||||
    configure() {
 | 
					    configure(): void {
 | 
				
			||||||
        chai.config.includeStack = true;
 | 
					        chai.config.includeStack = true;
 | 
				
			||||||
        chai.use(ChaiBigNumber());
 | 
					        chai.use(ChaiBigNumber());
 | 
				
			||||||
        chai.use(dirtyChai);
 | 
					        chai.use(dirtyChai);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,7 +6,10 @@ import { DoneCallback } from '@0xproject/types';
 | 
				
			|||||||
const expect = chai.expect;
 | 
					const expect = chai.expect;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const callbackErrorReporter = {
 | 
					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 callback = <T>(f?: (value: T) => void) => {
 | 
				
			||||||
            const wrapped = (value: T) => {
 | 
					            const wrapped = (value: T) => {
 | 
				
			||||||
                if (_.isUndefined(f)) {
 | 
					                if (_.isUndefined(f)) {
 | 
				
			||||||
@@ -26,7 +29,10 @@ export const callbackErrorReporter = {
 | 
				
			|||||||
        };
 | 
					        };
 | 
				
			||||||
        return callback;
 | 
					        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 callback = <T>(f?: (value: T) => void) => {
 | 
				
			||||||
            const wrapped = (error: Error | null, value: T | undefined) => {
 | 
					            const wrapped = (error: Error | null, value: T | undefined) => {
 | 
				
			||||||
                if (!_.isNull(error)) {
 | 
					                if (!_.isNull(error)) {
 | 
				
			||||||
@@ -50,7 +56,10 @@ export const callbackErrorReporter = {
 | 
				
			|||||||
        };
 | 
					        };
 | 
				
			||||||
        return callback;
 | 
					        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) => {
 | 
					        const wrapped = <T>(error: Error | null, value: T | undefined) => {
 | 
				
			||||||
            if (_.isNull(error)) {
 | 
					            if (_.isNull(error)) {
 | 
				
			||||||
                done(new Error('Expected callback to receive an error'));
 | 
					                done(new Error('Expected callback to receive an error'));
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -74,7 +74,7 @@ export const postpublishUtils = {
 | 
				
			|||||||
            utils.log(`POSTPUBLISH: No S3Bucket config found for ${packageJSON.name}. Skipping doc JSON generation.`);
 | 
					            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);
 | 
					        const configs = this.generateConfig(packageJSON, tsConfigJSON, cwd);
 | 
				
			||||||
        if (_.isUndefined(configs.docPublishConfigs.s3StagingBucketPath)) {
 | 
					        if (_.isUndefined(configs.docPublishConfigs.s3StagingBucketPath)) {
 | 
				
			||||||
            utils.log('config.postpublish.docPublishConfigs.s3StagingBucketPath entry in package.json not found!');
 | 
					            utils.log('config.postpublish.docPublishConfigs.s3StagingBucketPath entry in package.json not found!');
 | 
				
			||||||
@@ -109,7 +109,7 @@ export const postpublishUtils = {
 | 
				
			|||||||
            assets,
 | 
					            assets,
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    getReleaseNotes(packageName: string, version: string) {
 | 
					    getReleaseNotes(packageName: string, version: string): string {
 | 
				
			||||||
        const packageNameWithNamespace = packageName.replace('@0xproject/', '');
 | 
					        const packageNameWithNamespace = packageName.replace('@0xproject/', '');
 | 
				
			||||||
        const changelogJSONPath = path.join(
 | 
					        const changelogJSONPath = path.join(
 | 
				
			||||||
            constants.monorepoRootPath,
 | 
					            constants.monorepoRootPath,
 | 
				
			||||||
@@ -135,14 +135,14 @@ export const postpublishUtils = {
 | 
				
			|||||||
        });
 | 
					        });
 | 
				
			||||||
        return notes;
 | 
					        return notes;
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    getTag(packageName: string, version: string) {
 | 
					    getTag(packageName: string, version: string): string {
 | 
				
			||||||
        return `${packageName}@${version}`;
 | 
					        return `${packageName}@${version}`;
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    getReleaseName(subPackageName: string, version: string): string {
 | 
					    getReleaseName(subPackageName: string, version: string): string {
 | 
				
			||||||
        const releaseName = `${subPackageName} v${version}`;
 | 
					        const releaseName = `${subPackageName} v${version}`;
 | 
				
			||||||
        return releaseName;
 | 
					        return releaseName;
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    adjustAssetPaths(cwd: string, assets: string[]) {
 | 
					    adjustAssetPaths(cwd: string, assets: string[]): string[] {
 | 
				
			||||||
        const finalAssets: string[] = [];
 | 
					        const finalAssets: string[] = [];
 | 
				
			||||||
        _.each(assets, (asset: string) => {
 | 
					        _.each(assets, (asset: string) => {
 | 
				
			||||||
            finalAssets.push(`${cwd}/${asset}`);
 | 
					            finalAssets.push(`${cwd}/${asset}`);
 | 
				
			||||||
@@ -164,7 +164,7 @@ export const postpublishUtils = {
 | 
				
			|||||||
        });
 | 
					        });
 | 
				
			||||||
        return fileIncludesAdjusted;
 | 
					        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 fileIncludesAdjusted = this.adjustFileIncludePaths(fileIncludes, cwd);
 | 
				
			||||||
        const projectFiles = fileIncludesAdjusted.join(' ');
 | 
					        const projectFiles = fileIncludesAdjusted.join(' ');
 | 
				
			||||||
        const jsonFilePath = `${cwd}/${generatedDocsDirectoryName}/index.json`;
 | 
					        const jsonFilePath = `${cwd}/${generatedDocsDirectoryName}/index.json`;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -72,7 +72,7 @@ const packageNameToWebsitePath: { [name: string]: string } = {
 | 
				
			|||||||
    process.exit(1);
 | 
					    process.exit(1);
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function confirmDocPagesRenderAsync(packages: LernaPackage[]) {
 | 
					async function confirmDocPagesRenderAsync(packages: LernaPackage[]): Promise<void> {
 | 
				
			||||||
    // push docs to staging
 | 
					    // push docs to staging
 | 
				
			||||||
    utils.log("Upload all docJson's to S3 staging...");
 | 
					    utils.log("Upload all docJson's to S3 staging...");
 | 
				
			||||||
    await execAsync(`yarn lerna:stage_docs`, { cwd: constants.monorepoRootPath });
 | 
					    await execAsync(`yarn lerna:stage_docs`, { cwd: constants.monorepoRootPath });
 | 
				
			||||||
@@ -162,7 +162,7 @@ async function checkPublishRequiredSetupAsync(): Promise<boolean> {
 | 
				
			|||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function pushChangelogsToGithubAsync() {
 | 
					async function pushChangelogsToGithubAsync(): Promise<void> {
 | 
				
			||||||
    await execAsync(`git add . --all`, { cwd: constants.monorepoRootPath });
 | 
					    await execAsync(`git add . --all`, { cwd: constants.monorepoRootPath });
 | 
				
			||||||
    await execAsync(`git commit -m "Updated CHANGELOGS"`, { cwd: constants.monorepoRootPath });
 | 
					    await execAsync(`git commit -m "Updated CHANGELOGS"`, { cwd: constants.monorepoRootPath });
 | 
				
			||||||
    await execAsync(`git push`, { cwd: constants.monorepoRootPath });
 | 
					    await execAsync(`git push`, { cwd: constants.monorepoRootPath });
 | 
				
			||||||
@@ -228,7 +228,7 @@ async function updateChangeLogsAsync(updatedPublicLernaPackages: LernaPackage[])
 | 
				
			|||||||
    return packageToVersionChange;
 | 
					    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
 | 
					    // 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.
 | 
					    // flags so instead we need to interact with their interactive prompt interface.
 | 
				
			||||||
    const child = spawn('lerna', ['publish', '--registry=https://registry.npmjs.org/'], {
 | 
					    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) {
 | 
					    if (proposedNextVersion === currentVersion) {
 | 
				
			||||||
        return utils.getNextPatchVersion(currentVersion);
 | 
					        return utils.getNextPatchVersion(currentVersion);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,7 +17,7 @@ export const utils = {
 | 
				
			|||||||
        const newPatchVersion = `${versionSegments[0]}.${versionSegments[1]}.${newPatch}`;
 | 
					        const newPatchVersion = `${versionSegments[0]}.${versionSegments[1]}.${newPatch}`;
 | 
				
			||||||
        return newPatchVersion;
 | 
					        return newPatchVersion;
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    async prettifyAsync(filePath: string, cwd: string) {
 | 
					    async prettifyAsync(filePath: string, cwd: string): Promise<void> {
 | 
				
			||||||
        await execAsync(`prettier --write ${filePath} --config .prettierrc`, {
 | 
					        await execAsync(`prettier --write ${filePath} --config .prettierrc`, {
 | 
				
			||||||
            cwd,
 | 
					            cwd,
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
@@ -43,7 +43,7 @@ export const utils = {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        return updatedPackages;
 | 
					        return updatedPackages;
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    getChangelogJSONIfExists(changelogPath: string) {
 | 
					    getChangelogJSONIfExists(changelogPath: string): string|undefined {
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            const changelogJSON = fs.readFileSync(changelogPath, 'utf-8');
 | 
					            const changelogJSON = fs.readFileSync(changelogPath, 'utf-8');
 | 
				
			||||||
            return changelogJSON;
 | 
					            return changelogJSON;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,7 +12,7 @@ import { isValidSignature } from '@0xproject/order-utils';
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export const assert = {
 | 
					export const assert = {
 | 
				
			||||||
    ...sharedAssert,
 | 
					    ...sharedAssert,
 | 
				
			||||||
    isValidSignature(orderHash: string, ecSignature: ECSignature, signerAddress: string) {
 | 
					    isValidSignature(orderHash: string, ecSignature: ECSignature, signerAddress: string): void {
 | 
				
			||||||
        const isValid = isValidSignature(orderHash, ecSignature, signerAddress);
 | 
					        const isValid = isValidSignature(orderHash, ecSignature, signerAddress);
 | 
				
			||||||
        this.assert(isValid, `Expected order with hash '${orderHash}' to have a valid signature`);
 | 
					        this.assert(isValid, `Expected order with hash '${orderHash}' to have a valid signature`);
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,7 +5,7 @@ import * as path from 'path';
 | 
				
			|||||||
import { constants } from './utils/constants';
 | 
					import { constants } from './utils/constants';
 | 
				
			||||||
import { provider } from './utils/web3_wrapper';
 | 
					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
 | 
					    // HACK: Since the migrations take longer then our global mocha timeout limit
 | 
				
			||||||
    // we manually increase it for this before hook.
 | 
					    // we manually increase it for this before hook.
 | 
				
			||||||
    this.timeout(20000);
 | 
					    this.timeout(20000);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,7 @@ import ChaiBigNumber = require('chai-bignumber');
 | 
				
			|||||||
import * as dirtyChai from 'dirty-chai';
 | 
					import * as dirtyChai from 'dirty-chai';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const chaiSetup = {
 | 
					export const chaiSetup = {
 | 
				
			||||||
    configure() {
 | 
					    configure(): void {
 | 
				
			||||||
        chai.config.includeStack = true;
 | 
					        chai.config.includeStack = true;
 | 
				
			||||||
        chai.use(ChaiBigNumber());
 | 
					        chai.use(ChaiBigNumber());
 | 
				
			||||||
        chai.use(dirtyChai);
 | 
					        chai.use(dirtyChai);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user