Merge pull request #1538 from thelounge/astorije/eslint-console
Enable `no-console` and `no-alert` ESLint rules
This commit is contained in:
commit
2ea57a4133
@ -9,54 +9,54 @@ env:
|
|||||||
node: true
|
node: true
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
arrow-body-style: 2
|
arrow-body-style: error
|
||||||
arrow-parens: [2, always]
|
arrow-parens: [error, always]
|
||||||
arrow-spacing: 2
|
arrow-spacing: error
|
||||||
block-scoped-var: 2
|
block-scoped-var: error
|
||||||
block-spacing: [2, always]
|
block-spacing: [error, always]
|
||||||
brace-style: [2, 1tbs]
|
brace-style: [error, 1tbs]
|
||||||
comma-dangle: 0
|
comma-dangle: off
|
||||||
curly: [2, all]
|
curly: [error, all]
|
||||||
dot-location: [2, property]
|
dot-location: [error, property]
|
||||||
dot-notation: 2
|
dot-notation: error
|
||||||
eol-last: 2
|
eol-last: error
|
||||||
eqeqeq: 2
|
eqeqeq: error
|
||||||
handle-callback-err: 2
|
handle-callback-err: error
|
||||||
indent: [2, tab]
|
indent: [error, tab]
|
||||||
key-spacing: [2, {beforeColon: false, afterColon: true}]
|
key-spacing: [error, {beforeColon: false, afterColon: true}]
|
||||||
keyword-spacing: [2, {before: true, after: true}]
|
keyword-spacing: [error, {before: true, after: true}]
|
||||||
linebreak-style: [2, unix]
|
linebreak-style: [error, unix]
|
||||||
no-catch-shadow: 2
|
no-alert: error
|
||||||
no-confusing-arrow: 2
|
no-catch-shadow: error
|
||||||
no-console: 0
|
no-confusing-arrow: error
|
||||||
no-control-regex: 0
|
no-control-regex: off
|
||||||
no-duplicate-imports: 2
|
no-duplicate-imports: error
|
||||||
no-else-return: 2
|
no-else-return: error
|
||||||
no-implicit-globals: 2
|
no-implicit-globals: error
|
||||||
no-multi-spaces: 2
|
no-multi-spaces: error
|
||||||
no-multiple-empty-lines: [2, { "max": 1 }]
|
no-multiple-empty-lines: [error, { "max": 1 }]
|
||||||
no-shadow: 2
|
no-shadow: error
|
||||||
no-template-curly-in-string: 2
|
no-template-curly-in-string: error
|
||||||
no-trailing-spaces: 2
|
no-trailing-spaces: error
|
||||||
no-unsafe-negation: 2
|
no-unsafe-negation: error
|
||||||
no-useless-computed-key: 2
|
no-useless-computed-key: error
|
||||||
no-useless-return: 2
|
no-useless-return: error
|
||||||
object-curly-spacing: [2, never]
|
object-curly-spacing: [error, never]
|
||||||
padded-blocks: [2, never]
|
padded-blocks: [error, never]
|
||||||
prefer-const: 2
|
prefer-const: error
|
||||||
quote-props: [2, as-needed]
|
quote-props: [error, as-needed]
|
||||||
quotes: [2, double, avoid-escape]
|
quotes: [error, double, avoid-escape]
|
||||||
semi-spacing: 2
|
semi-spacing: error
|
||||||
semi-style: [2, last]
|
semi-style: [error, last]
|
||||||
semi: [2, always]
|
semi: [error, always]
|
||||||
space-before-blocks: 2
|
space-before-blocks: error
|
||||||
space-before-function-paren: [2, never]
|
space-before-function-paren: [error, never]
|
||||||
space-in-parens: [2, never]
|
space-in-parens: [error, never]
|
||||||
space-infix-ops: 2
|
space-infix-ops: error
|
||||||
spaced-comment: [2, always]
|
spaced-comment: [error, always]
|
||||||
strict: 2
|
strict: error
|
||||||
template-curly-spacing: 2
|
template-curly-spacing: error
|
||||||
yoda: 2
|
yoda: error
|
||||||
|
|
||||||
globals:
|
globals:
|
||||||
log: false
|
log: false
|
||||||
|
@ -418,7 +418,7 @@ $(function() {
|
|||||||
if (chan.hasClass("lobby")) {
|
if (chan.hasClass("lobby")) {
|
||||||
cmd = "/quit";
|
cmd = "/quit";
|
||||||
var server = chan.find(".name").html();
|
var server = chan.find(".name").html();
|
||||||
if (!confirm("Disconnect from " + server + "?")) {
|
if (!confirm("Disconnect from " + server + "?")) { // eslint-disable-line no-alert
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,6 @@ const socket = io({
|
|||||||
});
|
});
|
||||||
// Hides the "Send Message" button
|
// Hides the "Send Message" button
|
||||||
$("#submit").remove();
|
$("#submit").remove();
|
||||||
|
|
||||||
console.error(data);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
2
index.js
2
index.js
@ -8,9 +8,11 @@ process.chdir(__dirname);
|
|||||||
// Doing this check as soon as possible allows us to avoid ES6 parser errors or other issues
|
// Doing this check as soon as possible allows us to avoid ES6 parser errors or other issues
|
||||||
var pkg = require("./package.json");
|
var pkg = require("./package.json");
|
||||||
if (!require("semver").satisfies(process.version, pkg.engines.node)) {
|
if (!require("semver").satisfies(process.version, pkg.engines.node)) {
|
||||||
|
/* eslint-disable no-console */
|
||||||
console.error("=== WARNING!");
|
console.error("=== WARNING!");
|
||||||
console.error("=== The oldest supported Node.js version is", pkg.engines.node);
|
console.error("=== The oldest supported Node.js version is", pkg.engines.node);
|
||||||
console.error("=== We strongly encourage you to upgrade, see https://nodejs.org/en/download/package-manager/ for more details\n");
|
console.error("=== We strongly encourage you to upgrade, see https://nodejs.org/en/download/package-manager/ for more details\n");
|
||||||
|
/* eslint-enable no-console */
|
||||||
}
|
}
|
||||||
|
|
||||||
require("./src/command-line");
|
require("./src/command-line");
|
||||||
|
@ -1,25 +1,27 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var fs = require("fs-extra");
|
const colors = require("colors/safe");
|
||||||
|
const fs = require("fs-extra");
|
||||||
|
const log = require("../src/log");
|
||||||
|
|
||||||
var srcDir = "./node_modules/font-awesome/fonts/";
|
const srcDir = "./node_modules/font-awesome/fonts/";
|
||||||
var destDir = "./client/fonts/";
|
const destDir = "./client/fonts/";
|
||||||
var fonts = [
|
const fonts = [
|
||||||
"fontawesome-webfont.woff",
|
"fontawesome-webfont.woff",
|
||||||
"fontawesome-webfont.woff2"
|
"fontawesome-webfont.woff2"
|
||||||
];
|
];
|
||||||
|
|
||||||
fs.ensureDir(destDir, function(dirErr) {
|
fs.ensureDir(destDir, (dirErr) => {
|
||||||
if (dirErr) {
|
if (dirErr) {
|
||||||
console.error(dirErr);
|
log.error(dirErr);
|
||||||
}
|
}
|
||||||
|
|
||||||
fonts.forEach(function(font) {
|
fonts.forEach((font) => {
|
||||||
fs.copy(srcDir + font, destDir + font, function(err) {
|
fs.copy(srcDir + font, destDir + font, (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err);
|
log.error(err);
|
||||||
} else {
|
} else {
|
||||||
console.log(font + " successfully installed.");
|
log.info(colors.bold(font) + " successfully installed.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -15,7 +15,7 @@ class Utils {
|
|||||||
"",
|
"",
|
||||||
` LOUNGE_HOME Path for all configuration files and folders. Defaults to ${colors.green(Utils.defaultLoungeHome())}.`,
|
` LOUNGE_HOME Path for all configuration files and folders. Defaults to ${colors.green(Utils.defaultLoungeHome())}.`,
|
||||||
"",
|
"",
|
||||||
].forEach((e) => console.log(e));
|
].forEach((e) => console.log(e)); // eslint-disable-line no-console
|
||||||
}
|
}
|
||||||
|
|
||||||
static defaultLoungeHome() {
|
static defaultLoungeHome() {
|
||||||
|
@ -16,6 +16,7 @@ function timestamp(type, messageArgs) {
|
|||||||
return messageArgs;
|
return messageArgs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* eslint-disable no-console */
|
||||||
exports.error = function() {
|
exports.error = function() {
|
||||||
console.error.apply(console, timestamp(colors.red("[ERROR]"), arguments));
|
console.error.apply(console, timestamp(colors.red("[ERROR]"), arguments));
|
||||||
};
|
};
|
||||||
@ -31,6 +32,7 @@ exports.info = function() {
|
|||||||
exports.debug = function() {
|
exports.debug = function() {
|
||||||
console.log.apply(console, timestamp(colors.green("[DEBUG]"), arguments));
|
console.log.apply(console, timestamp(colors.green("[DEBUG]"), arguments));
|
||||||
};
|
};
|
||||||
|
/* eslint-enable no-console */
|
||||||
|
|
||||||
exports.prompt = (options, callback) => {
|
exports.prompt = (options, callback) => {
|
||||||
options.prompt = timestamp(colors.cyan("[PROMPT]"), [options.text]).join(" ");
|
options.prompt = timestamp(colors.cyan("[PROMPT]"), [options.text]).join(" ");
|
||||||
|
2
test/fixtures/env.js
vendored
2
test/fixtures/env.js
vendored
@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
global.log = {
|
global.log = {
|
||||||
error: () => console.error.apply(console, arguments),
|
error: () => console.error.apply(console, arguments), // eslint-disable-line no-console
|
||||||
warn: () => {},
|
warn: () => {},
|
||||||
info: () => {},
|
info: () => {},
|
||||||
debug: () => {},
|
debug: () => {},
|
||||||
|
@ -79,8 +79,6 @@ if (process.env.NODE_ENV === "production") {
|
|||||||
sourceMap: true,
|
sourceMap: true,
|
||||||
comments: false
|
comments: false
|
||||||
}));
|
}));
|
||||||
} else {
|
|
||||||
console.log("Building in development mode, bundles will not be minified.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = config;
|
module.exports = config;
|
||||||
|
Loading…
Reference in New Issue
Block a user