diff --git a/packages/generators/add-generator.ts b/packages/generators/add-generator.ts index 014ac28f798..985f7823547 100644 --- a/packages/generators/add-generator.ts +++ b/packages/generators/add-generator.ts @@ -9,7 +9,6 @@ import { } from "./utils/add/questions"; import { - replaceAt, traverseAndGetProperties, webpackDevServerSchema, webpackSchema @@ -112,7 +111,7 @@ export default class AddGenerator extends Generator { .then((mergeFileAnswer: { mergeFile: string, mergeConfigName: string - }) => { + }):void => { const resolvedPath = resolve(process.cwd(), mergeFileAnswer.mergeFile); // eslint-disable-next-line this.configuration.config[action] = [mergeFileAnswer.mergeConfigName, resolvedPath]; diff --git a/packages/generators/utils/add/questions/index.ts b/packages/generators/utils/add/questions/index.ts index 6b08b8709bf..fbbc0dfe138 100644 --- a/packages/generators/utils/add/questions/index.ts +++ b/packages/generators/utils/add/questions/index.ts @@ -16,7 +16,7 @@ import { Question } from "inquirer"; * @param {string} action action for which question has to be prompted * @returns {Question} Question for given action */ -export const manualOrListInput: (action: string) => Question = (action: string) => { +export const manualOrListInput = (action: string): Question => { const actionQuestion = `What do you want to add to ${action}?`; return Input("actionAnswer", actionQuestion); }; @@ -42,9 +42,9 @@ export const topScopeQuestion: Question = Input( "What do you want to add to topScope?", ); -const mergeFileQuestionsFunction = () => { +const mergeFileQuestionsFunction = (): Question[] => { const mergePathQuestion = "What is the location of webpack configuration with which you want to merge current configuration?"; - const mergePathValidator = (path: string) => { + const mergePathValidator = (path: string): boolean|string => { const resolvedPath = resolve(process.cwd(), path); if (existsSync(resolvedPath)) { if (/\.js$/.test(path)) { diff --git a/packages/utils/ast-utils.ts b/packages/utils/ast-utils.ts index 83b39f11f72..c1dc17a15f7 100644 --- a/packages/utils/ast-utils.ts +++ b/packages/utils/ast-utils.ts @@ -7,7 +7,7 @@ function isImportPresent (j: JSCodeshift, ast: Node, path: string): boolean { throw new Error(`path parameter should be string, recieved ${typeof path}`); } let isPresent = false; - ast.find(j.CallExpression).forEach(callExp => { + ast.find(j.CallExpression).forEach((callExp: Node): void => { if ((callExp.value as Node).callee.name === 'require' && (callExp.value as Node).arguments[0].value === path) { isPresent = true; } @@ -648,11 +648,11 @@ function parseMerge(j: JSCodeshift, ast: Node, value: string[], action: string): return false; // TODO: debug later } - function addMergeImports(configIdentifier: string, configPath: string) { + function addMergeImports(configIdentifier: string, configPath: string): void { if (typeof configIdentifier !== "string" || typeof configPath !== "string") { - throw new Error(`Both parameters should be string. Recieved ${configIdentifier}, ${configPath}`) + throw new Error(`Both parameters should be string. recieved ${typeof configIdentifier}, ${typeof configPath}`) } - ast.find(j.Program).forEach(p => { + ast.find(j.Program).forEach((p: Node): void => { if (!isImportPresent(j, ast, 'webpack-merge')) { (p.value as Node).body.splice(-1, 0, `const merge = require('webpack-merge')`); }