Node.js based forum software built for the modern web
ESlint strict
Peter Jaszkowiakf3a8256f3531
diff --git a/.eslintrc b/.eslintrcindex abfaa76baf..62762f2426 100644--- a/.eslintrc+++ b/.eslintrc@@ -1,124 +1,129 @@{- "extends": "airbnb",+ "extends": "airbnb-base",+ "parserOptions": {+ "sourceType": "script"+ },- "rules": {- // Customized- "handle-callback-err": [ "error","^(e$|(e|(.*(_e|E)))rr)" ],- "comma-dangle": ["error", {- "arrays": "always-multiline",- "objects": "always-multiline",- "imports": "always-multiline",- "exports": "always-multiline",- "functions": "never"- }],- "no-empty": ["error", { "allowEmptyCatch": true }],- "no-underscore-dangle": "off",- "newline-per-chained-call": "off",- "no-console": "off",- "no-mixed-operators": ["error", { "allowSamePrecedence": true }],+ "rules": {+ // Customized+ "handle-callback-err": [ "error","^(e$|(e|(.*(_e|E)))rr)" ],+ "comma-dangle": ["error", {+ "arrays": "always-multiline",+ "objects": "always-multiline",+ "imports": "always-multiline",+ "exports": "always-multiline",+ "functions": "never"+ }],+ "no-empty": ["error", { "allowEmptyCatch": true }],+ "no-underscore-dangle": "off",+ "newline-per-chained-call": "off",+ "no-console": "off",+ "no-mixed-operators": ["error", { "allowSamePrecedence": true }],+ "strict": ["error", "global"],- // ES6- "prefer-rest-params": "off",- "prefer-spread": "off",+ // ES6+ "prefer-rest-params": "off",+ "prefer-spread": "off",+ "prefer-arrow-callback": "off",- // TODO- "import/no-unresolved": "off",- "import/no-extraneous-dependencies": "off",- "import/no-dynamic-require": "off",- "import/newline-after-import": "off",- "no-bitwise": "off",- "global-require": "off",+ // TODO+ "import/no-unresolved": "off",+ "import/no-extraneous-dependencies": "off",+ "import/no-dynamic-require": "off",+ "import/newline-after-import": "off",+ "no-bitwise": "off",+ "global-require": "off",- // "linebreak-style": "off",- // "one-var": "off",- // "no-undef": "off",- "max-len": "off",- "no-new": "off",- "max-nested-callbacks": "off",- "no-mixed-requires": "off",- // "brace-style": "off",- "max-statements-per-line": "off",- "no-unused-vars": "off",- "no-mixed-spaces-and-tabs": "off",- "no-useless-concat": "off",- "require-jsdoc": "off",- "eqeqeq": "off",- "camelcase": "off",- "no-negated-condition": "off",- "one-var-declaration-per-line": "off",- "new-cap": "off",- "no-lonely-if": "off",- "radix": "off",- "no-else-return": "off",- "no-useless-escape": "off",- "block-scoped-var": "off",- "operator-assignment": "off",- "default-case": "off",- "yoda": "off",- "no-use-before-define": "off",- "no-loop-func": "off",- "no-void": "off",- "valid-jsdoc": "off",- "o-eq-null": "off",- "no-cond-assign": "off",- "no-eq-null": "off",- "no-redeclare": "off",- "no-unreachable": "off",- "no-nested-ternary": "off",- "operator-linebreak": "off",- "guard-for-in": "off",- "no-unneeded-ternary": "off",- "no-sequences": "off",- "no-extend-native": "off",- "no-shadow-restricted-names": "off",- "no-extra-boolean-cast": "off",- "no-script-url": "off",- "no-path-concat": "off",- "no-unused-expressions": "off",- "no-restricted-module": "off",- "no-return-assign": "off",- "no-restricted-modules": "off",- "no-tabs": "off",- "indent": "off",- "func-names": "off",- "prefer-arrow-callback": "off",- "object-curly-spacing": "off",- "no-var": "off",- "no-shadow": "off",- "prefer-template": "off",- "padded-blocks": "off",- "eol-last": "off",- "lines-around-directive": "off",- "no-restricted-syntax": "off",- "vars-on-top": "off",- "no-prototype-builtins": "off",- "object-shorthand": "off",- "no-param-reassign": "off",- "consistent-return": "off",- "strict": "off",- // "comma-dangle": "off",- // "no-multi-spaces": "off",- // "quotes": "off",- // "keyword-spacing": "off",- // "no-mixed-operators": "off",- // "comma-spacing": "off",- // "no-trailing-spaces": "off",- // "key-spacing": "off",- // "no-multiple-empty-lines": "off",- // "spaced-comment": "off",- // "space-in-parens": "off",- // "block-spacing": "off",- // "quote-props": "off",- // "space-unary-ops": "off",- // "no-plusplus": "off",- // "no-empty": "off",- // "dot-notation": "off",- // "func-call-spacing": "off",- // "array-bracket-spacing": "off",- // "object-property-newline": "off",- // "no-continue": "off",- // "no-extra-semi": "off",- // "no-spaced-func": "off",- // "no-useless-return": "off"- }+ // "linebreak-style": "off",+ // "one-var": "off",+ // "no-undef": "off",+ "max-len": "off",+ "no-new": "off",+ "max-nested-callbacks": "off",+ "no-mixed-requires": "off",+ // "brace-style": "off",+ "max-statements-per-line": "off",+ "no-unused-vars": "off",+ "no-mixed-spaces-and-tabs": "off",+ "no-useless-concat": "off",+ "require-jsdoc": "off",+ "eqeqeq": "off",+ "camelcase": "off",+ "no-negated-condition": "off",+ "one-var-declaration-per-line": "off",+ "new-cap": "off",+ "no-lonely-if": "off",+ "radix": "off",+ "no-else-return": "off",+ "no-useless-escape": "off",+ "block-scoped-var": "off",+ "operator-assignment": "off",+ "default-case": "off",+ "yoda": "off",+ "no-use-before-define": "off",+ "no-loop-func": "off",+ "no-void": "off",+ "valid-jsdoc": "off",+ "o-eq-null": "off",+ "no-cond-assign": "off",+ "no-eq-null": "off",+ "no-redeclare": "off",+ "no-unreachable": "off",+ "no-nested-ternary": "off",+ "operator-linebreak": "off",+ "guard-for-in": "off",+ "no-unneeded-ternary": "off",+ "no-sequences": "off",+ "no-extend-native": "off",+ "no-shadow-restricted-names": "off",+ "no-extra-boolean-cast": "off",+ "no-script-url": "off",+ "no-path-concat": "off",+ "no-unused-expressions": "off",+ "no-restricted-module": "off",+ "no-return-assign": "off",+ "no-restricted-modules": "off",+ "no-tabs": "off",+ "indent": "off",+ "func-names": "off",+ "object-curly-spacing": "off",+ "no-var": "off",+ "no-shadow": "off",+ "prefer-template": "off",+ "padded-blocks": "off",+ "eol-last": "off",+ "lines-around-directive": "off",+ "no-restricted-syntax": "off",+ "vars-on-top": "off",+ "no-prototype-builtins": "off",+ "object-shorthand": "off",+ "no-param-reassign": "off",+ "consistent-return": "off",+ "no-multi-assign": "off",+ // "strict": "off",+ // "comma-dangle": "off",+ // "no-multi-spaces": "off",+ // "quotes": "off",+ // "keyword-spacing": "off",+ // "no-mixed-operators": "off",+ // "comma-spacing": "off",+ // "no-trailing-spaces": "off",+ // "key-spacing": "off",+ // "no-multiple-empty-lines": "off",+ // "spaced-comment": "off",+ // "space-in-parens": "off",+ // "block-spacing": "off",+ // "quote-props": "off",+ // "space-unary-ops": "off",+ // "no-plusplus": "off",+ // "no-empty": "off",+ // "dot-notation": "off",+ // "func-call-spacing": "off",+ // "array-bracket-spacing": "off",+ // "object-property-newline": "off",+ // "no-continue": "off",+ // "no-extra-semi": "off",+ // "no-spaced-func": "off",+ // "no-useless-return": "off"+ }}diff --git a/package.json b/package.jsonindex e5907c0378..69fb210e96 100644--- a/package.json+++ b/package.json@@ -99,10 +99,8 @@"devDependencies": {"coveralls": "^2.11.14","eslint": "^3.12.0",- "eslint-config-airbnb": "^13.0.0",- "eslint-plugin-import": "^2.0.0",- "eslint-plugin-jsx-a11y": "^2.2.3",- "eslint-plugin-react": "^6.8.0",+ "eslint-config-airbnb-base": "^11.1.0",+ "eslint-plugin-import": "^2.2.0","grunt": "~1.0.0","grunt-contrib-watch": "^1.0.0","istanbul": "^0.4.2",diff --git a/public/src/modules/helpers.js b/public/src/modules/helpers.jsindex a3251706b3..98d8aeae7b 100644--- a/public/src/modules/helpers.js+++ b/public/src/modules/helpers.js@@ -1,7 +1,6 @@-(function (exports) {- 'use strict';-+'use strict';+(function (exports) {// export the class if we are in a Node-like system.if (typeof module === 'object' && module.exports === exports) {exports = module.exports/* = SemVer*/;diff --git a/public/src/modules/settings/array.js b/public/src/modules/settings/array.jsindex c0753ad0c0..e2f606d1db 100644--- a/public/src/modules/settings/array.js+++ b/public/src/modules/settings/array.js@@ -1,3 +1,5 @@+'use strict';+define('settings/array', function () {var Settings = null;diff --git a/public/src/modules/settings/checkbox.js b/public/src/modules/settings/checkbox.jsindex f9f233d7c6..e1fd6fd614 100644--- a/public/src/modules/settings/checkbox.js+++ b/public/src/modules/settings/checkbox.js@@ -1,3 +1,5 @@+'use strict';+define('settings/checkbox', function () {var Settings = null;diff --git a/public/src/modules/settings/key.js b/public/src/modules/settings/key.jsindex 0e5de046ec..d5cf969693 100644--- a/public/src/modules/settings/key.js+++ b/public/src/modules/settings/key.js@@ -1,3 +1,5 @@+'use strict';+define('settings/key', function () {var Settings = null;diff --git a/public/src/modules/settings/number.js b/public/src/modules/settings/number.jsindex b31296c6fd..e8703eef28 100644--- a/public/src/modules/settings/number.js+++ b/public/src/modules/settings/number.js@@ -1,3 +1,5 @@+'use strict';+define('settings/number', function () {return {diff --git a/public/src/modules/settings/object.js b/public/src/modules/settings/object.jsindex 8bf7e8400b..5f4d897700 100644--- a/public/src/modules/settings/object.js+++ b/public/src/modules/settings/object.js@@ -1,3 +1,5 @@+'use strict';+define('settings/object', function () {var Settings = null;diff --git a/public/src/modules/settings/select.js b/public/src/modules/settings/select.jsindex 78f98b4cea..164d2c2cb7 100644--- a/public/src/modules/settings/select.js+++ b/public/src/modules/settings/select.js@@ -1,3 +1,5 @@+'use strict';+define('settings/select', function () {var Settings = null;diff --git a/public/src/modules/settings/textarea.js b/public/src/modules/settings/textarea.jsindex 86a96be935..d8e4cb2268 100644--- a/public/src/modules/settings/textarea.js+++ b/public/src/modules/settings/textarea.js@@ -1,3 +1,5 @@+'use strict';+define('settings/textarea', function () {var Settings = null;diff --git a/public/src/modules/translator.js b/public/src/modules/translator.jsindex 8765540d09..9722e51ec8 100644--- a/public/src/modules/translator.js+++ b/public/src/modules/translator.js@@ -1,7 +1,6 @@-+'use strict';(function (factory) {- 'use strict';function loadClient(language, namespace) {return Promise.resolve(jQuery.getJSON(config.relative_path + '/assets/language/' + language + '/' + namespace + '.json?' + config['cache-buster']));}@@ -44,7 +43,6 @@window.translator = factory(window.string, loadClient, warn);}}(function (string, load, warn) {- 'use strict';var assign = Object.assign || jQuery.extend;function classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }diff --git a/public/src/require-config.js b/public/src/require-config.jsindex b102a5abae..a7c70ac70e 100644--- a/public/src/require-config.js+++ b/public/src/require-config.js@@ -1,3 +1,5 @@+'use strict';+require.config({baseUrl: config.relative_path + '/assets/src/modules',waitSeconds: 7,diff --git a/public/src/utils.js b/public/src/utils.jsindex 504db54ef6..16cd44d998 100644--- a/public/src/utils.js+++ b/public/src/utils.js@@ -1,6 +1,6 @@-(function (module) {- 'use strict';+'use strict';+(function (module) {var utils;var fs;var XRegExp;diff --git a/src/posts/cache.js b/src/posts/cache.jsindex a9050c8a73..c43b3ef430 100644--- a/src/posts/cache.js+++ b/src/posts/cache.js@@ -1,3 +1,5 @@+'use strict';+var LRU = require('lru-cache');var meta = require('../meta');diff --git a/src/routes/authentication.js b/src/routes/authentication.jsindex 1f3a401755..f2735ab8a9 100644--- a/src/routes/authentication.js+++ b/src/routes/authentication.js@@ -1,6 +1,6 @@-(function (Auth) {- 'use strict';+'use strict';+(function (Auth) {var passport = require('passport');var passportLocal = require('passport-local').Strategy;var nconf = require('nconf');diff --git a/test/mocks/databasemock.js b/test/mocks/databasemock.jsindex dd4424c959..20eee3b5b9 100644--- a/test/mocks/databasemock.js+++ b/test/mocks/databasemock.js@@ -1,12 +1,11 @@+'use strict';+/*** Database Mock - wrapper for database.js, makes system use separate test db, instead of production* ATTENTION: testing db is flushed before every use!*/(function (module) {- 'use strict';--var async = require('async');var winston = require('winston');var path = require('path');diff --git a/test/mocks/newXhr.js b/test/mocks/newXhr.jsindex 2288b8073c..1e223a8f19 100644--- a/test/mocks/newXhr.js+++ b/test/mocks/newXhr.js@@ -1,3 +1,5 @@+'use strict';+// see https://gist.github.com/jfromaniello/4087861#gistcomment-1447029// XMLHttpRequest to override.