Merge pull request #19042 from Snuffleupagus/eslint-no-console
Enable the ESLint `no-console` rule in parts of the code-base
This commit is contained in:
commit
15a5e47e64
@ -313,6 +313,12 @@ export default [
|
|||||||
"template-curly-spacing": ["error", "never"],
|
"template-curly-spacing": ["error", "never"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
files: jsFiles("src"),
|
||||||
|
rules: {
|
||||||
|
"no-console": "error",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
/* ======================================================================== *\
|
/* ======================================================================== *\
|
||||||
Test-specific rules
|
Test-specific rules
|
||||||
@ -354,11 +360,13 @@ export default [
|
|||||||
files: jsFiles("test/unit"),
|
files: jsFiles("test/unit"),
|
||||||
rules: {
|
rules: {
|
||||||
"import/no-unresolved": ["error", { ignore: ["pdfjs/"] }],
|
"import/no-unresolved": ["error", { ignore: ["pdfjs/"] }],
|
||||||
|
"no-console": ["error", { allow: ["warn", "error"] }],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
files: jsFiles("test/integration"),
|
files: jsFiles("test/integration"),
|
||||||
rules: {
|
rules: {
|
||||||
|
"no-console": ["error", { allow: ["warn", "error"] }],
|
||||||
"no-restricted-syntax": [
|
"no-restricted-syntax": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
|
|||||||
@ -413,6 +413,7 @@ function noContextMenu(e) {
|
|||||||
|
|
||||||
// Deprecated API function -- display regardless of the `verbosity` setting.
|
// Deprecated API function -- display regardless of the `verbosity` setting.
|
||||||
function deprecated(details) {
|
function deprecated(details) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.log("Deprecated API usage: " + details);
|
console.log("Deprecated API usage: " + details);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -166,7 +166,7 @@ class ImageManager {
|
|||||||
}
|
}
|
||||||
data.refCounter = 1;
|
data.refCounter = 1;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
warn(e);
|
||||||
data = null;
|
data = null;
|
||||||
}
|
}
|
||||||
this.#cache.set(key, data);
|
this.#cache.set(key, data);
|
||||||
|
|||||||
@ -84,6 +84,7 @@ class Sandbox {
|
|||||||
[buf, this._alertOnError]
|
[buf, this._alertOnError]
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.error(error);
|
console.error(error);
|
||||||
} finally {
|
} finally {
|
||||||
if (buf) {
|
if (buf) {
|
||||||
|
|||||||
@ -363,6 +363,7 @@ function getVerbosityLevel() {
|
|||||||
// end users.
|
// end users.
|
||||||
function info(msg) {
|
function info(msg) {
|
||||||
if (verbosity >= VerbosityLevel.INFOS) {
|
if (verbosity >= VerbosityLevel.INFOS) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.log(`Info: ${msg}`);
|
console.log(`Info: ${msg}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -370,6 +371,7 @@ function info(msg) {
|
|||||||
// Non-fatal warnings.
|
// Non-fatal warnings.
|
||||||
function warn(msg) {
|
function warn(msg) {
|
||||||
if (verbosity >= VerbosityLevel.WARNINGS) {
|
if (verbosity >= VerbosityLevel.WARNINGS) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.log(`Warning: ${msg}`);
|
console.log(`Warning: ${msg}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -309,9 +309,11 @@ async function waitForEvent({
|
|||||||
|
|
||||||
const success = await awaitPromise(handle);
|
const success = await awaitPromise(handle);
|
||||||
if (success === null) {
|
if (success === null) {
|
||||||
console.log(`waitForEvent: ${eventName} didn't trigger within the timeout`);
|
console.warn(
|
||||||
|
`waitForEvent: ${eventName} didn't trigger within the timeout`
|
||||||
|
);
|
||||||
} else if (!success) {
|
} else if (!success) {
|
||||||
console.log(`waitForEvent: ${eventName} triggered, but validation failed`);
|
console.warn(`waitForEvent: ${eventName} triggered, but validation failed`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user