Enforce strict mode across all JS files with ESLint

Several ES6 additions are only available in strict mode. Example:
> SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode

Strict mode was also enabled in a few of our files already, and it is a good thing to have anyway.
This commit is contained in:
Jérémie Astori 2016-10-09 15:14:02 -04:00
parent 56fb04c81e
commit caa46042bf
70 changed files with 140 additions and 0 deletions

View File

@ -34,6 +34,7 @@ rules:
space-before-blocks: 2 space-before-blocks: 2
space-infix-ops: 2 space-infix-ops: 2
spaced-comment: [2, always] spaced-comment: [2, always]
strict: 2
globals: globals:
log: false log: false

View File

@ -1,3 +1,5 @@
"use strict";
var diff; var diff;
Handlebars.registerHelper( Handlebars.registerHelper(

View File

@ -1,3 +1,5 @@
"use strict";
Handlebars.registerHelper( Handlebars.registerHelper(
"equal", function(a, b, opt) { "equal", function(a, b, opt) {
a = a.toString(); a = a.toString();

View File

@ -1,3 +1,5 @@
"use strict";
Handlebars.registerHelper( Handlebars.registerHelper(
"modes", function(mode) { "modes", function(mode) {
var modes = { var modes = {

View File

@ -1,3 +1,5 @@
"use strict";
Handlebars.registerHelper( Handlebars.registerHelper(
"parse", function(text) { "parse", function(text) {
text = Handlebars.Utils.escapeExpression(text); text = Handlebars.Utils.escapeExpression(text);

View File

@ -1,3 +1,5 @@
"use strict";
Handlebars.registerHelper( Handlebars.registerHelper(
"roundBadgeNumber", function(count) { "roundBadgeNumber", function(count) {
if (count < 1000) { if (count < 1000) {

View File

@ -1,3 +1,5 @@
"use strict";
Handlebars.registerHelper( Handlebars.registerHelper(
"tz", function(time) { "tz", function(time) {
time = new Date(time); time = new Date(time);

View File

@ -1,3 +1,5 @@
"use strict";
Handlebars.registerHelper( Handlebars.registerHelper(
"users", function(count) { "users", function(count) {
return count + " " + (count === 1 ? "user" : "users"); return count + " " + (count === 1 ? "user" : "users");

View File

@ -1,3 +1,5 @@
"use strict";
/* /*
* This is a separate file for two reasons: * This is a separate file for two reasons:
* 1. CSP policy does not allow inline javascript * 1. CSP policy does not allow inline javascript

View File

@ -1,3 +1,5 @@
"use strict";
$(function() { $(function() {
$("#loading-page-message").text("Connecting…"); $("#loading-page-message").text("Connecting…");

View File

@ -1,3 +1,5 @@
"use strict";
module.exports = { module.exports = {
// //
// Set the server mode. // Set the server mode.

View File

@ -1,4 +1,7 @@
#!/usr/bin/env node #!/usr/bin/env node
"use strict";
process.chdir(__dirname); process.chdir(__dirname);
// Perform node version check before loading any other files or modules // Perform node version check before loading any other files or modules

View File

@ -1,3 +1,5 @@
"use strict";
var _ = require("lodash"); var _ = require("lodash");
var package = require("../package.json"); var package = require("../package.json");
var Chan = require("./models/chan"); var Chan = require("./models/chan");

View File

@ -1,3 +1,5 @@
"use strict";
var _ = require("lodash"); var _ = require("lodash");
var fs = require("fs"); var fs = require("fs");
var Client = require("./client"); var Client = require("./client");

View File

@ -1,3 +1,5 @@
"use strict";
var ClientManager = new require("../clientManager"); var ClientManager = new require("../clientManager");
var bcrypt = require("bcrypt-nodejs"); var bcrypt = require("bcrypt-nodejs");
var program = require("commander"); var program = require("commander");

View File

@ -1,3 +1,5 @@
"use strict";
var program = require("commander"); var program = require("commander");
var child = require("child_process"); var child = require("child_process");
var Helper = require("../helper"); var Helper = require("../helper");

View File

@ -1,3 +1,5 @@
"use strict";
var ClientManager = new require("../clientManager"); var ClientManager = new require("../clientManager");
var program = require("commander"); var program = require("commander");
var child = require("child_process"); var child = require("child_process");

View File

@ -1,3 +1,5 @@
"use strict";
global.log = require("../log.js"); global.log = require("../log.js");
var program = require("commander"); var program = require("commander");

View File

@ -1,3 +1,5 @@
"use strict";
var ClientManager = new require("../clientManager"); var ClientManager = new require("../clientManager");
var program = require("commander"); var program = require("commander");

View File

@ -1,3 +1,5 @@
"use strict";
var ClientManager = new require("../clientManager"); var ClientManager = new require("../clientManager");
var program = require("commander"); var program = require("commander");

View File

@ -1,3 +1,5 @@
"use strict";
var bcrypt = require("bcrypt-nodejs"); var bcrypt = require("bcrypt-nodejs");
var ClientManager = new require("../clientManager"); var ClientManager = new require("../clientManager");
var fs = require("fs"); var fs = require("fs");

View File

@ -1,3 +1,5 @@
"use strict";
var ClientManager = new require("../clientManager"); var ClientManager = new require("../clientManager");
var program = require("commander"); var program = require("commander");
var server = require("../server"); var server = require("../server");

View File

@ -1,3 +1,5 @@
"use strict";
var _ = require("lodash"); var _ = require("lodash");
var path = require("path"); var path = require("path");
var os = require("os"); var os = require("os");

View File

@ -1,3 +1,5 @@
"use strict";
var _ = require("lodash"); var _ = require("lodash");
var net = require("net"); var net = require("net");

View File

@ -1,3 +1,5 @@
"use strict";
var colors = require("colors/safe"); var colors = require("colors/safe");
var moment = require("moment"); var moment = require("moment");
var Helper = require("./helper"); var Helper = require("./helper");

View File

@ -1,3 +1,5 @@
"use strict";
var _ = require("lodash"); var _ = require("lodash");
var Helper = require("../helper"); var Helper = require("../helper");

View File

@ -1,3 +1,5 @@
"use strict";
var _ = require("lodash"); var _ = require("lodash");
Msg.Type = { Msg.Type = {

View File

@ -1,3 +1,5 @@
"use strict";
var _ = require("lodash"); var _ = require("lodash");
var Chan = require("./chan"); var Chan = require("./chan");

View File

@ -1,3 +1,5 @@
"use strict";
var _ = require("lodash"); var _ = require("lodash");
module.exports = User; module.exports = User;

View File

@ -1,3 +1,5 @@
"use strict";
var fs = require("fs"); var fs = require("fs");
var Helper = require("./helper"); var Helper = require("./helper");

View File

@ -1,3 +1,5 @@
"use strict";
exports.commands = ["slap", "me"]; exports.commands = ["slap", "me"];
exports.input = function(network, chan, cmd, args) { exports.input = function(network, chan, cmd, args) {

View File

@ -1,3 +1,5 @@
"use strict";
var Msg = require("../../models/msg"); var Msg = require("../../models/msg");
exports.commands = ["connect", "server"]; exports.commands = ["connect", "server"];

View File

@ -1,3 +1,5 @@
"use strict";
exports.commands = ["ctcp"]; exports.commands = ["ctcp"];
exports.input = function(network, chan, cmd, args) { exports.input = function(network, chan, cmd, args) {

View File

@ -1,3 +1,5 @@
"use strict";
exports.commands = ["disconnect"]; exports.commands = ["disconnect"];
exports.input = function(network, chan, cmd, args) { exports.input = function(network, chan, cmd, args) {

View File

@ -1,3 +1,5 @@
"use strict";
var Chan = require("../../models/chan"); var Chan = require("../../models/chan");
exports.commands = ["invite"]; exports.commands = ["invite"];

View File

@ -1,3 +1,5 @@
"use strict";
exports.commands = ["kick"]; exports.commands = ["kick"];
exports.input = function(network, chan, cmd, args) { exports.input = function(network, chan, cmd, args) {

View File

@ -1,3 +1,5 @@
"use strict";
exports.commands = ["list"]; exports.commands = ["list"];
exports.input = function(network, chan, cmd, args) { exports.input = function(network, chan, cmd, args) {

View File

@ -1,3 +1,5 @@
"use strict";
exports.commands = ["mode", "op", "voice", "deop", "devoice"]; exports.commands = ["mode", "op", "voice", "deop", "devoice"];
exports.input = function(network, chan, cmd, args) { exports.input = function(network, chan, cmd, args) {

View File

@ -1,3 +1,5 @@
"use strict";
exports.commands = ["msg", "say"]; exports.commands = ["msg", "say"];
exports.input = function(network, chan, cmd, args) { exports.input = function(network, chan, cmd, args) {

View File

@ -1,3 +1,5 @@
"use strict";
var Msg = require("../../models/msg"); var Msg = require("../../models/msg");
exports.commands = ["nick"]; exports.commands = ["nick"];

View File

@ -1,3 +1,5 @@
"use strict";
exports.commands = ["notice"]; exports.commands = ["notice"];
exports.input = function(network, chan, cmd, args) { exports.input = function(network, chan, cmd, args) {

View File

@ -1,3 +1,5 @@
"use strict";
var _ = require("lodash"); var _ = require("lodash");
var Msg = require("../../models/msg"); var Msg = require("../../models/msg");
var Chan = require("../../models/chan"); var Chan = require("../../models/chan");

View File

@ -1,3 +1,5 @@
"use strict";
var _ = require("lodash"); var _ = require("lodash");
var Chan = require("../../models/chan"); var Chan = require("../../models/chan");
var Msg = require("../../models/msg"); var Msg = require("../../models/msg");

View File

@ -1,3 +1,5 @@
"use strict";
var _ = require("lodash"); var _ = require("lodash");
exports.commands = ["quit"]; exports.commands = ["quit"];

View File

@ -1,3 +1,5 @@
"use strict";
exports.commands = ["raw", "send", "quote"]; exports.commands = ["raw", "send", "quote"];
exports.input = function(network, chan, cmd, args) { exports.input = function(network, chan, cmd, args) {

View File

@ -1,3 +1,5 @@
"use strict";
exports.commands = ["topic"]; exports.commands = ["topic"];
exports.input = function(network, chan, cmd, args) { exports.input = function(network, chan, cmd, args) {

View File

@ -1,3 +1,5 @@
"use strict";
var _ = require("lodash"); var _ = require("lodash");
var identd = require("../../identd"); var identd = require("../../identd");
var Msg = require("../../models/msg"); var Msg = require("../../models/msg");

View File

@ -1,3 +1,5 @@
"use strict";
var Msg = require("../../models/msg"); var Msg = require("../../models/msg");
module.exports = function(irc, network) { module.exports = function(irc, network) {

View File

@ -1,3 +1,5 @@
"use strict";
var Msg = require("../../models/msg"); var Msg = require("../../models/msg");
module.exports = function(irc, network) { module.exports = function(irc, network) {

View File

@ -1,3 +1,5 @@
"use strict";
var Msg = require("../../models/msg"); var Msg = require("../../models/msg");
module.exports = function(irc, network) { module.exports = function(irc, network) {

View File

@ -1,3 +1,5 @@
"use strict";
var Chan = require("../../models/chan"); var Chan = require("../../models/chan");
var Msg = require("../../models/msg"); var Msg = require("../../models/msg");
var User = require("../../models/user"); var User = require("../../models/user");

View File

@ -1,3 +1,5 @@
"use strict";
var _ = require("lodash"); var _ = require("lodash");
var Msg = require("../../models/msg"); var Msg = require("../../models/msg");

View File

@ -1,3 +1,5 @@
"use strict";
var _ = require("lodash"); var _ = require("lodash");
var cheerio = require("cheerio"); var cheerio = require("cheerio");
var Msg = require("../../models/msg"); var Msg = require("../../models/msg");

View File

@ -1,3 +1,5 @@
"use strict";
var Chan = require("../../models/chan"); var Chan = require("../../models/chan");
var Msg = require("../../models/msg"); var Msg = require("../../models/msg");

View File

@ -1,3 +1,5 @@
"use strict";
var Chan = require("../../models/chan"); var Chan = require("../../models/chan");
var Msg = require("../../models/msg"); var Msg = require("../../models/msg");

View File

@ -1,3 +1,5 @@
"use strict";
var _ = require("lodash"); var _ = require("lodash");
var Chan = require("../../models/chan"); var Chan = require("../../models/chan");
var Msg = require("../../models/msg"); var Msg = require("../../models/msg");

View File

@ -1,3 +1,5 @@
"use strict";
var Msg = require("../../models/msg"); var Msg = require("../../models/msg");
module.exports = function(irc, network) { module.exports = function(irc, network) {

View File

@ -1,3 +1,5 @@
"use strict";
var _ = require("lodash"); var _ = require("lodash");
var User = require("../../models/user"); var User = require("../../models/user");

View File

@ -1,3 +1,5 @@
"use strict";
var _ = require("lodash"); var _ = require("lodash");
var Msg = require("../../models/msg"); var Msg = require("../../models/msg");

View File

@ -1,3 +1,5 @@
"use strict";
var _ = require("lodash"); var _ = require("lodash");
var Msg = require("../../models/msg"); var Msg = require("../../models/msg");

View File

@ -1,3 +1,5 @@
"use strict";
var _ = require("lodash"); var _ = require("lodash");
var Msg = require("../../models/msg"); var Msg = require("../../models/msg");

View File

@ -1,3 +1,5 @@
"use strict";
var Msg = require("../../models/msg"); var Msg = require("../../models/msg");
module.exports = function(irc, network) { module.exports = function(irc, network) {

View File

@ -1,3 +1,5 @@
"use strict";
var Msg = require("../../models/msg"); var Msg = require("../../models/msg");
module.exports = function(irc, network) { module.exports = function(irc, network) {

View File

@ -1,3 +1,5 @@
"use strict";
var Msg = require("../../models/msg"); var Msg = require("../../models/msg");
module.exports = function(irc, network) { module.exports = function(irc, network) {

View File

@ -1,3 +1,5 @@
"use strict";
var Chan = require("../../models/chan"); var Chan = require("../../models/chan");
var Msg = require("../../models/msg"); var Msg = require("../../models/msg");

View File

@ -1,3 +1,5 @@
"use strict";
var fs = require("fs"); var fs = require("fs");
var fsextra = require("fs-extra"); var fsextra = require("fs-extra");
var moment = require("moment"); var moment = require("moment");

View File

@ -1,3 +1,5 @@
"use strict";
var config = require("../../../defaults/config.js"); var config = require("../../../defaults/config.js");
config.prefetch = true; config.prefetch = true;

View File

@ -1,2 +1,4 @@
"use strict";
var home = require("path").join(__dirname, ".lounge"); var home = require("path").join(__dirname, ".lounge");
require("../../src/helper").setHome(home); require("../../src/helper").setHome(home);

View File

@ -1,3 +1,5 @@
"use strict";
var assert = require("assert"); var assert = require("assert");
var util = require("../util"); var util = require("../util");

View File

@ -1,3 +1,5 @@
"use strict";
var EventEmitter = require("events").EventEmitter; var EventEmitter = require("events").EventEmitter;
var util = require("util"); var util = require("util");
var _ = require("lodash"); var _ = require("lodash");