diff --git a/.eslintrc.js b/.eslintrc.js index 9eecfdb9f..60abf1402 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -5,12 +5,12 @@ module.exports = { "rules": { "func-names": "off", "global-require": "off", // Interfers with optional and eventual circular references - - // doesn't work in node v4 :( - "strict": "off", - "prefer-rest-params": "off", - "react/require-extension": "off", - "import/no-extraneous-dependencies": "off" + "import/no-extraneous-dependencies": ["error", {"devDependencies": ["**/*.test.js", "**/scripts/**", "**/tests/**"]}], + "react/require-extension": "off", // Forced by airbnb, not applicable (also deprecated) + "strict": ["error", "safe"], // airbnb implies we're transpiling with babel, we're not + }, + "parserOptions": { + "sourceType": "script", // airbnb assumes ESM, while we're CJS }, "env": { "mocha": true, diff --git a/lib/plugins/aws/lib/getServiceState.js b/lib/plugins/aws/lib/getServiceState.js index 0feefd37a..fe5b95b01 100644 --- a/lib/plugins/aws/lib/getServiceState.js +++ b/lib/plugins/aws/lib/getServiceState.js @@ -1,3 +1,5 @@ +'use strict'; + const path = require('path'); module.exports = { diff --git a/lib/utils/fs/readFileIfExists.js b/lib/utils/fs/readFileIfExists.js index 4876033db..9c7fdd70e 100644 --- a/lib/utils/fs/readFileIfExists.js +++ b/lib/utils/fs/readFileIfExists.js @@ -1,3 +1,5 @@ +'use strict'; + const fileExists = require('./fileExists'); const readFile = require('./readFile'); const BbPromise = require('bluebird'); diff --git a/lib/utils/log/consoleLog.js b/lib/utils/log/consoleLog.js index 2ba6c7017..4bbe99661 100644 --- a/lib/utils/log/consoleLog.js +++ b/lib/utils/log/consoleLog.js @@ -1,7 +1,7 @@ 'use strict'; -const consoleLog = function () { - console.log(arguments); // eslint-disable-line no-console +const consoleLog = function (...args) { + console.log(args); // eslint-disable-line no-console }; module.exports = consoleLog; diff --git a/lib/utils/log/fileLog.js b/lib/utils/log/fileLog.js index b8dd3549f..4b2c1f070 100644 --- a/lib/utils/log/fileLog.js +++ b/lib/utils/log/fileLog.js @@ -4,11 +4,10 @@ const _ = require('lodash'); const fs = require('fs'); const path = require('path'); -const fileLog = function () { +const fileLog = function (...args) { // TODO BRN: This does not guarentee order, is not multi process safe, // TODO BRN: and is not guarenteed to complete before exit. - fs.appendFileSync(path.join(process.cwd(), 'sls.log'), - _.join(Array.prototype.slice.call(arguments)) + '\n'); // eslint-disable-line prefer-template + fs.appendFileSync(path.join(process.cwd(), 'sls.log'), `${_.join(args)}\n`); }; module.exports = fileLog; diff --git a/lib/utils/log/log.js b/lib/utils/log/log.js index aa59e55ce..c9561f026 100644 --- a/lib/utils/log/log.js +++ b/lib/utils/log/log.js @@ -9,8 +9,8 @@ const loggers = [ fileLog, ]; -const log = function () { - _.each(loggers, (logger) => logger.apply(null, arguments)); // eslint-disable-line prefer-spread +const log = function (...args) { + _.each(loggers, (logger) => logger(...args)); }; module.exports = log; diff --git a/lib/utils/renameService.js b/lib/utils/renameService.js index ecb853c07..69dbd4fcf 100644 --- a/lib/utils/renameService.js +++ b/lib/utils/renameService.js @@ -1,3 +1,5 @@ +'use strict'; + const path = require('path'); const fse = require('fs-extra'); diff --git a/lib/utils/sentry.js b/lib/utils/sentry.js index 651a9302f..1a01325dc 100644 --- a/lib/utils/sentry.js +++ b/lib/utils/sentry.js @@ -1,3 +1,5 @@ +'use strict'; + const raven = require('raven'); const ci = require('ci-info'); const configUtils = require('./config'); diff --git a/lib/utils/userStats.js b/lib/utils/userStats.js index 435d6a7f9..7700a9b75 100644 --- a/lib/utils/userStats.js +++ b/lib/utils/userStats.js @@ -13,8 +13,8 @@ const TRACK_URL = 'https://serverless.com/api/framework/track'; const IDENTIFY_URL = 'https://serverless.com/api/framework/identify'; const DEBUG = false; -function debug() { - if (DEBUG) console.log(arguments); +function debug(...args) { + if (DEBUG) console.log(args); } /* note tracking swallows errors */ diff --git a/tests/setupTests.js b/tests/setupTests.js index 4da8b0798..01313fd46 100644 --- a/tests/setupTests.js +++ b/tests/setupTests.js @@ -1,3 +1,5 @@ +'use strict'; + // timeout is set to 5 minutes // eslint-disable-next-line no-undef jasmine.DEFAULT_TIMEOUT_INTERVAL = 300000;