From cf0bf4ab098105a3fd4f5b5c8d0043a2d0721110 Mon Sep 17 00:00:00 2001 From: Sendil Kumar Date: Sat, 22 Sep 2018 00:55:28 +0200 Subject: [PATCH 1/3] chore(lint): fix tslint warnings --- packages/generators/add-generator.ts | 4 +++- tslint.json | 6 ------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/generators/add-generator.ts b/packages/generators/add-generator.ts index 127a74f5de3..933c00bd2de 100644 --- a/packages/generators/add-generator.ts +++ b/packages/generators/add-generator.ts @@ -461,7 +461,9 @@ export default class AddGenerator extends Generator { // Either we are adding directly at the property, else we're in a prop.theOne scenario const actionMessage: string = isDeepProp[1] === "other" - ? `What do you want the key on ${action} to be? (press enter if you want it directly as a value on the property)` + ? `What do you want the key on ${ + action + } to be? (press enter if you want it directly as a value on the property)` : `What do you want the value of ${isDeepProp[1]} to be?`; this.prompt([ diff --git a/tslint.json b/tslint.json index a021a8859b6..0c4e7909be6 100644 --- a/tslint.json +++ b/tslint.json @@ -15,12 +15,6 @@ ], "no-console": { "severity": "warning" - }, - "max-line-length": { - "options": { - "limit": 120 - }, - "severity": "warn" } }, "rulesDirectory": [], From db5f57085453828725b7f46af0b1118efb466dcc Mon Sep 17 00:00:00 2001 From: Sendil Kumar Date: Sat, 22 Sep 2018 00:55:49 +0200 Subject: [PATCH 2/3] chore(lint): turn off console log warning --- tslint.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tslint.json b/tslint.json index 0c4e7909be6..323befd7bd4 100644 --- a/tslint.json +++ b/tslint.json @@ -14,7 +14,7 @@ false ], "no-console": { - "severity": "warning" + "severity": "off" } }, "rulesDirectory": [], From e4256422260811431933da4d31dca82caf6621a5 Mon Sep 17 00:00:00 2001 From: Sendil Kumar Date: Sat, 22 Sep 2018 11:41:11 +0200 Subject: [PATCH 3/3] chore(lint): remove or replace console.log with console.error --- packages/generators/remove-generator.ts | 2 +- packages/make/index.ts | 2 +- packages/migrate/index.ts | 10 +++++----- .../removeDeprecatedPlugins.ts | 2 +- packages/serve/index.ts | 10 +++++----- packages/utils/recursive-parser.ts | 2 +- packages/utils/resolve-packages.ts | 14 +++++++------- tslint.json | 4 +--- 8 files changed, 22 insertions(+), 24 deletions(-) diff --git a/packages/generators/remove-generator.ts b/packages/generators/remove-generator.ts index 768b764ed6d..cec7c7a08a2 100644 --- a/packages/generators/remove-generator.ts +++ b/packages/generators/remove-generator.ts @@ -69,7 +69,7 @@ export default class RemoveGenerator extends Generator { ]) .then(({ propType }: { propType: string }): Promise<{}> => { if (!PROP_TYPES.has(propType)) { - console.log("Invalid webpack config prop"); + console.error("Invalid webpack config prop"); return; } diff --git a/packages/make/index.ts b/packages/make/index.ts index 9f86e798d4d..f1acd91a423 100644 --- a/packages/make/index.ts +++ b/packages/make/index.ts @@ -6,5 +6,5 @@ */ export default function make() { - return console.log("make me"); + return; } diff --git a/packages/migrate/index.ts b/packages/migrate/index.ts index 30adb7fc4b3..09b166c6adb 100644 --- a/packages/migrate/index.ts +++ b/packages/migrate/index.ts @@ -178,7 +178,7 @@ function runMigration(currentConfigPath: string, outputConfigPath: string): Prom }, ]); } else { - console.log(chalk.red("✖ Migration aborted")); + console.error(chalk.red("✖ Migration aborted")); } }) .then((answer: { @@ -198,7 +198,7 @@ function runMigration(currentConfigPath: string, outputConfigPath: string): Prom ); if (webpackOptionsValidationErrors.length) { - console.log( + console.error( chalk.red( "\n✖ Your configuration validation wasn't successful \n", ), @@ -211,18 +211,18 @@ function runMigration(currentConfigPath: string, outputConfigPath: string): Prom } } - console.log( + console.info( chalk.green( `\n✔︎ New webpack config file is at ${outputConfigPath}.`, ), ); - console.log( + console.info( chalk.green( "✔︎ Heads up! Updating to the latest version could contain breaking changes.", ), ); - console.log( + console.info( chalk.green( "✔︎ Plugin and loader dependencies may need to be updated.", ), diff --git a/packages/migrate/removeDeprecatedPlugins/removeDeprecatedPlugins.ts b/packages/migrate/removeDeprecatedPlugins/removeDeprecatedPlugins.ts index aecc0640353..5d83f3cce0a 100644 --- a/packages/migrate/removeDeprecatedPlugins/removeDeprecatedPlugins.ts +++ b/packages/migrate/removeDeprecatedPlugins/removeDeprecatedPlugins.ts @@ -39,7 +39,7 @@ export default function(j: IJSCodeshift, ast: INode) { j(path).remove(); } } else { - console.log(` + console.error(` ${chalk.red("Please remove deprecated plugins manually. ")} See ${chalk.underline( "https://webpack.js.org/guides/migrating/", diff --git a/packages/serve/index.ts b/packages/serve/index.ts index 280e76ff193..7272733435d 100644 --- a/packages/serve/index.ts +++ b/packages/serve/index.ts @@ -54,7 +54,7 @@ const getRootPathModule = (dep: string): string => path.resolve(process.cwd(), d function serve() { const packageJSONPath: string = getRootPathModule("package.json"); if (!packageJSONPath) { - console.log( + console.error( "\n", chalk.red("✖ Could not find your package.json file"), "\n", @@ -75,13 +75,13 @@ function serve() { "node_modules/webpack-dev-server/bin/webpack-dev-server.js", ); if (!WDSPath) { - console.log( + console.error( "\n", chalk.red( "✖ Could not find the webpack-dev-server dependency in node_modules root path", ), ); - console.log( + console.info( chalk.bold.green(" ✔︎"), "Try this command:", chalk.bold.green("rm -rf node_modules && npm install"), @@ -158,12 +158,12 @@ function serve() { }); }); } else { - console.log(chalk.bold.red("✖ Serve aborted due cancelling")); + console.error(chalk.bold.red("✖ Serve aborted due cancelling")); process.exitCode = 1; } }) .catch((err: object) => { - console.log(chalk.red("✖ Serve aborted due to some errors")); + console.error(chalk.red("✖ Serve aborted due to some errors")); console.error(err); process.exitCode = 1; }); diff --git a/packages/utils/recursive-parser.ts b/packages/utils/recursive-parser.ts index 1c6d1f2a060..f6c9f03b7eb 100644 --- a/packages/utils/recursive-parser.ts +++ b/packages/utils/recursive-parser.ts @@ -8,7 +8,7 @@ export default function recursiveTransform( if (Array.isArray(value)) { return utils.parseTopScope(j, ast, value, action); } - console.log("Error in parsing top scope, Array required"); + console.error("Error in parsing top scope, Array required"); return false; } else if (key === "merge") { if (typeof value === "string") { diff --git a/packages/utils/resolve-packages.ts b/packages/utils/resolve-packages.ts index 1a1a3825d7d..7e083f3583b 100644 --- a/packages/utils/resolve-packages.ts +++ b/packages/utils/resolve-packages.ts @@ -58,8 +58,8 @@ export function resolvePackages(pkg: string[]): Function | void { require.resolve(absolutePath); packageLocations.push(absolutePath); } catch (err) { - console.log(`Cannot find a generator at ${absolutePath}.`); - console.log("\nReason:\n"); + console.error(`Cannot find a generator at ${absolutePath}.`); + console.error("\nReason:\n"); console.error(chalk.bold.red(err)); process.exitCode = 1; } @@ -75,16 +75,16 @@ export function resolvePackages(pkg: string[]): Function | void { const globalPath: string = getPathToGlobalPackages(); packageLocations.push(path.resolve(globalPath, addon)); } catch (err) { - console.log("Package wasn't validated correctly.."); - console.log("Submit an issue for", pkg, "if this persists"); - console.log("\nReason: \n"); + console.error("Package wasn't validated correctly.."); + console.error("Submit an issue for", pkg, "if this persists"); + console.error("\nReason: \n"); console.error(chalk.bold.red(err)); process.exitCode = 1; } }) .catch((err: string) => { - console.log("Package couldn't be installed, aborting.."); - console.log("\nReason: \n"); + console.error("Package couldn't be installed, aborting.."); + console.error("\nReason: \n"); console.error(chalk.bold.red(err)); process.exitCode = 1; }) diff --git a/tslint.json b/tslint.json index 323befd7bd4..ee672ce2d93 100644 --- a/tslint.json +++ b/tslint.json @@ -13,9 +13,7 @@ "ban-types": [ false ], - "no-console": { - "severity": "off" - } + "no-console": [true, "log"] }, "rulesDirectory": [], "linterOptions": {