From c91d11bc85fd1a6a91b74d9f4432dadff944c32f Mon Sep 17 00:00:00 2001 From: Frazer Smith Date: Sat, 8 Jul 2023 11:40:30 +0100 Subject: [PATCH] fix: add missing strict mode directives (#180) --- .eslintrc.js | 5 +++++ scripts/.eslintrc.js | 2 ++ scripts/license-checker.js | 3 +++ src/index.js | 2 ++ src/index.test.js | 2 ++ 5 files changed, 14 insertions(+) diff --git a/.eslintrc.js b/.eslintrc.js index fc011d7..f5b8013 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { env: { es2019: true, @@ -34,6 +36,8 @@ module.exports = { ], parserOptions: { ecmaVersion: 2019, + // Explicitly tell ESLint to parse JavaScript as CommonJS, as airbnb-base sets this to "modules" for ECMAScript + sourceType: "script", }, plugins: [ "import", @@ -51,5 +55,6 @@ module.exports = { "prefer-destructuring": ["error", { object: true, array: false }], "promise/prefer-await-to-callbacks": "warn", "promise/prefer-await-to-then": "warn", + strict: ["error", "global"], }, }; diff --git a/scripts/.eslintrc.js b/scripts/.eslintrc.js index 927bd73..975e027 100644 --- a/scripts/.eslintrc.js +++ b/scripts/.eslintrc.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { rules: { "import/no-extraneous-dependencies": [ diff --git a/scripts/license-checker.js b/scripts/license-checker.js index f7bdd48..f71ac76 100644 --- a/scripts/license-checker.js +++ b/scripts/license-checker.js @@ -1,5 +1,8 @@ /* eslint-disable security/detect-object-injection */ /* eslint-disable security-node/detect-crlf */ + +"use strict"; + const checker = require("license-checker"); const copyLeftLicenses = require("spdx-copyleft"); const { promisify } = require("util"); diff --git a/src/index.js b/src/index.js index b6b1081..594e440 100644 --- a/src/index.js +++ b/src/index.js @@ -1,3 +1,5 @@ +"use strict"; + const fp = require("fastify-plugin"); /** * @author Frazer Smith diff --git a/src/index.test.js b/src/index.test.js index 8facac9..87aeaf6 100644 --- a/src/index.test.js +++ b/src/index.test.js @@ -1,3 +1,5 @@ +"use strict"; + const Fastify = require("fastify"); const plugin = require(".");