Limit supported console methods
Replaced all console.log with console.info, limit supported
console methods.
`console.info`, `warn`, `error`, `assert` are more meaningful
than generic `log`. This will also help prevent having log prints
left by accident.
Updated rule:
`"no-console": ["error",
{ allow: ["warn", "error", "info", "assert", "group", "groupEnd"] }
]`
Change-Id: I88e8b1b0aea8659a206ddae642023efc1572f5f1
This commit is contained in:
@@ -70,7 +70,7 @@ module.exports = {
|
||||
"capIsNewExceptions": ["Polymer", "GestureEventListeners"],
|
||||
"capIsNewExceptionPattern": "^.*Mixin$"
|
||||
}],
|
||||
"no-console": "off",
|
||||
"no-console": ["error", { allow: ["warn", "error", "info", "assert", "group", "groupEnd"] }],
|
||||
"no-multiple-empty-lines": ["error", {"max": 1}],
|
||||
"no-prototype-builtins": "off",
|
||||
"no-redeclare": "off",
|
||||
|
||||
@@ -1294,7 +1294,7 @@ class GrFileList extends KeyboardShortcutMixin(
|
||||
this._cancelForEachDiff = cancel;
|
||||
|
||||
iter++;
|
||||
console.log('Expanding diff', iter, 'of', initialCount, ':',
|
||||
console.info('Expanding diff', iter, 'of', initialCount, ':',
|
||||
path);
|
||||
const diffElem = this._findDiffByPath(path, diffElements);
|
||||
if (!diffElem) {
|
||||
@@ -1311,7 +1311,7 @@ class GrFileList extends KeyboardShortcutMixin(
|
||||
}).then(() => {
|
||||
this._cancelForEachDiff = null;
|
||||
this._nextRenderParams = null;
|
||||
console.log('Finished expanding', initialCount, 'diff(s)');
|
||||
console.info('Finished expanding', initialCount, 'diff(s)');
|
||||
this.reporting.timeEndWithAverage(EXPAND_ALL_TIMING_LABEL,
|
||||
EXPAND_ALL_AVG_TIMING_LABEL, initialCount);
|
||||
/* Block diff cursor from auto scrolling after files are done rendering.
|
||||
|
||||
@@ -457,7 +457,7 @@ class GrReplyDialog extends KeyboardShortcutMixin(GestureEventListeners(
|
||||
for (const splice of indexSplices) {
|
||||
for (const account of splice.removed) {
|
||||
if (!this._reviewersPendingRemove[type]) {
|
||||
console.err('Invalid type ' + type + ' for reviewer.');
|
||||
console.error('Invalid type ' + type + ' for reviewer.');
|
||||
return;
|
||||
}
|
||||
this._reviewersPendingRemove[type].push(account);
|
||||
|
||||
@@ -194,7 +194,7 @@ class GrErrorManager extends GestureEventListeners(
|
||||
}));
|
||||
}
|
||||
}
|
||||
console.log(`server error: ${errorText}`);
|
||||
console.info(`server error: ${errorText}`);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ const REPO_TOKEN_PATTERN = /\${(project|repo)}/g;
|
||||
// gr-router and gr-app in the PolyGerritIndexHtml.soy file if needed
|
||||
const app = document.querySelector('#app');
|
||||
if (!app) {
|
||||
console.log('No gr-app found (running tests)');
|
||||
console.info('No gr-app found (running tests)');
|
||||
}
|
||||
|
||||
// Setup listeners outside of the router component initialization.
|
||||
|
||||
@@ -575,13 +575,13 @@ class GrAppElement extends KeyboardShortcutMixin(
|
||||
|
||||
_logWelcome() {
|
||||
console.group('Runtime Info');
|
||||
console.log('Gerrit UI (PolyGerrit)');
|
||||
console.log(`Gerrit Server Version: ${this._version}`);
|
||||
console.info('Gerrit UI (PolyGerrit)');
|
||||
console.info(`Gerrit Server Version: ${this._version}`);
|
||||
if (window.VERSION_INFO) {
|
||||
console.log(`UI Version Info: ${window.VERSION_INFO}`);
|
||||
console.info(`UI Version Info: ${window.VERSION_INFO}`);
|
||||
}
|
||||
if (this._feedbackUrl) {
|
||||
console.log(`Please file bugs and feedback at: ${this._feedbackUrl}`);
|
||||
console.info(`Please file bugs and feedback at: ${this._feedbackUrl}`);
|
||||
}
|
||||
console.groupEnd();
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ export class PluginLoader {
|
||||
const pluginObj = this._updatePluginState(url, PluginState.LOADED);
|
||||
pluginObj.plugin = plugin;
|
||||
this._getReporting().pluginLoaded(plugin.getPluginName() || url);
|
||||
console.log(`Plugin ${plugin.getPluginName() || url} installed.`);
|
||||
console.info(`Plugin ${plugin.getPluginName() || url} installed.`);
|
||||
this._checkIfCompleted();
|
||||
}
|
||||
|
||||
|
||||
@@ -327,7 +327,7 @@ const deprecatedAPI = {
|
||||
_loadedGwt: () => {},
|
||||
|
||||
install() {
|
||||
console.log('Installing deprecated APIs is deprecated!');
|
||||
console.info('Installing deprecated APIs is deprecated!');
|
||||
for (const method in this.deprecated) {
|
||||
if (method === 'install') continue;
|
||||
this[method] = this.deprecated[method];
|
||||
|
||||
@@ -150,7 +150,7 @@ export class GrRestApiHelper {
|
||||
const elapsed = (endTime - startTime);
|
||||
const startAt = new Date(startTime);
|
||||
const endAt = new Date(endTime);
|
||||
console.log([
|
||||
console.info([
|
||||
'HTTP',
|
||||
status,
|
||||
method,
|
||||
|
||||
@@ -51,7 +51,7 @@ class MyBindSample extends PolymerElement {
|
||||
}
|
||||
|
||||
_onRevisionChanged(value) {
|
||||
console.log(`(attributeHelper.bind) revision number: ${value._number}`);
|
||||
console.info(`(attributeHelper.bind) revision number: ${value._number}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@ class RepoCommandLow extends PolymerElement {
|
||||
|
||||
connectedCallback() {
|
||||
super.connectedCallback();
|
||||
console.log(this.repoName);
|
||||
console.log(this.config);
|
||||
console.info(this.repoName);
|
||||
console.info(this.config);
|
||||
this.hidden = this.repoName !== 'All-Projects';
|
||||
}
|
||||
|
||||
|
||||
@@ -286,9 +286,9 @@ export class GrReporting {
|
||||
if (opt_noLog) { return; }
|
||||
if (type !== ERROR.TYPE) {
|
||||
if (value !== undefined) {
|
||||
console.log(`Reporting: ${name}: ${value}`);
|
||||
console.info(`Reporting: ${name}: ${value}`);
|
||||
} else {
|
||||
console.log(`Reporting: ${name}`);
|
||||
console.info(`Reporting: ${name}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user