Skip to content

Commit e425642

Browse files
committed
chore(lint): remove or replace console.log with console.error
1 parent db5f570 commit e425642

File tree

8 files changed

+22
-24
lines changed

8 files changed

+22
-24
lines changed

packages/generators/remove-generator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export default class RemoveGenerator extends Generator {
6969
])
7070
.then(({ propType }: { propType: string }): Promise<{}> => {
7171
if (!PROP_TYPES.has(propType)) {
72-
console.log("Invalid webpack config prop");
72+
console.error("Invalid webpack config prop");
7373
return;
7474
}
7575

packages/make/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
*/
77

88
export default function make() {
9-
return console.log("make me");
9+
return;
1010
}

packages/migrate/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ function runMigration(currentConfigPath: string, outputConfigPath: string): Prom
178178
},
179179
]);
180180
} else {
181-
console.log(chalk.red("✖ Migration aborted"));
181+
console.error(chalk.red("✖ Migration aborted"));
182182
}
183183
})
184184
.then((answer: {
@@ -198,7 +198,7 @@ function runMigration(currentConfigPath: string, outputConfigPath: string): Prom
198198
);
199199

200200
if (webpackOptionsValidationErrors.length) {
201-
console.log(
201+
console.error(
202202
chalk.red(
203203
"\n✖ Your configuration validation wasn't successful \n",
204204
),
@@ -211,18 +211,18 @@ function runMigration(currentConfigPath: string, outputConfigPath: string): Prom
211211
}
212212
}
213213

214-
console.log(
214+
console.info(
215215
chalk.green(
216216
`\n✔︎ New webpack config file is at ${outputConfigPath}.`,
217217
),
218218
);
219-
console.log(
219+
console.info(
220220
chalk.green(
221221
"✔︎ Heads up! Updating to the latest version could contain breaking changes.",
222222
),
223223
);
224224

225-
console.log(
225+
console.info(
226226
chalk.green(
227227
"✔︎ Plugin and loader dependencies may need to be updated.",
228228
),

packages/migrate/removeDeprecatedPlugins/removeDeprecatedPlugins.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default function(j: IJSCodeshift, ast: INode) {
3939
j(path).remove();
4040
}
4141
} else {
42-
console.log(`
42+
console.error(`
4343
${chalk.red("Please remove deprecated plugins manually. ")}
4444
See ${chalk.underline(
4545
"https://webpack.js.org/guides/migrating/",

packages/serve/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const getRootPathModule = (dep: string): string => path.resolve(process.cwd(), d
5454
function serve() {
5555
const packageJSONPath: string = getRootPathModule("package.json");
5656
if (!packageJSONPath) {
57-
console.log(
57+
console.error(
5858
"\n",
5959
chalk.red("✖ Could not find your package.json file"),
6060
"\n",
@@ -75,13 +75,13 @@ function serve() {
7575
"node_modules/webpack-dev-server/bin/webpack-dev-server.js",
7676
);
7777
if (!WDSPath) {
78-
console.log(
78+
console.error(
7979
"\n",
8080
chalk.red(
8181
"✖ Could not find the webpack-dev-server dependency in node_modules root path",
8282
),
8383
);
84-
console.log(
84+
console.info(
8585
chalk.bold.green(" ✔︎"),
8686
"Try this command:",
8787
chalk.bold.green("rm -rf node_modules && npm install"),
@@ -158,12 +158,12 @@ function serve() {
158158
});
159159
});
160160
} else {
161-
console.log(chalk.bold.red("✖ Serve aborted due cancelling"));
161+
console.error(chalk.bold.red("✖ Serve aborted due cancelling"));
162162
process.exitCode = 1;
163163
}
164164
})
165165
.catch((err: object) => {
166-
console.log(chalk.red("✖ Serve aborted due to some errors"));
166+
console.error(chalk.red("✖ Serve aborted due to some errors"));
167167
console.error(err);
168168
process.exitCode = 1;
169169
});

packages/utils/recursive-parser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default function recursiveTransform(
88
if (Array.isArray(value)) {
99
return utils.parseTopScope(j, ast, value, action);
1010
}
11-
console.log("Error in parsing top scope, Array required");
11+
console.error("Error in parsing top scope, Array required");
1212
return false;
1313
} else if (key === "merge") {
1414
if (typeof value === "string") {

packages/utils/resolve-packages.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ export function resolvePackages(pkg: string[]): Function | void {
5858
require.resolve(absolutePath);
5959
packageLocations.push(absolutePath);
6060
} catch (err) {
61-
console.log(`Cannot find a generator at ${absolutePath}.`);
62-
console.log("\nReason:\n");
61+
console.error(`Cannot find a generator at ${absolutePath}.`);
62+
console.error("\nReason:\n");
6363
console.error(chalk.bold.red(err));
6464
process.exitCode = 1;
6565
}
@@ -75,16 +75,16 @@ export function resolvePackages(pkg: string[]): Function | void {
7575
const globalPath: string = getPathToGlobalPackages();
7676
packageLocations.push(path.resolve(globalPath, addon));
7777
} catch (err) {
78-
console.log("Package wasn't validated correctly..");
79-
console.log("Submit an issue for", pkg, "if this persists");
80-
console.log("\nReason: \n");
78+
console.error("Package wasn't validated correctly..");
79+
console.error("Submit an issue for", pkg, "if this persists");
80+
console.error("\nReason: \n");
8181
console.error(chalk.bold.red(err));
8282
process.exitCode = 1;
8383
}
8484
})
8585
.catch((err: string) => {
86-
console.log("Package couldn't be installed, aborting..");
87-
console.log("\nReason: \n");
86+
console.error("Package couldn't be installed, aborting..");
87+
console.error("\nReason: \n");
8888
console.error(chalk.bold.red(err));
8989
process.exitCode = 1;
9090
})

tslint.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
"ban-types": [
1414
false
1515
],
16-
"no-console": {
17-
"severity": "off"
18-
}
16+
"no-console": [true, "log"]
1917
},
2018
"rulesDirectory": [],
2119
"linterOptions": {

0 commit comments

Comments
 (0)