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-infix-ops: 2
spaced-comment: [2, always]
strict: 2
globals:
log: false

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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