From da9000e06b98ed5ab8f22a8ab2cc5f8860e9b705 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C3=ABl=20Minelli?= <michael@minelli.me>
Date: Fri, 19 Apr 2024 15:29:17 +0200
Subject: [PATCH] ESLint => Bug fix: eslint is seen as module

---
 .../{eslint.config.js => eslint.config.mjs}   |   2 +-
 NodeApp/package-lock.json                     |  19 ++-
 NodeApp/package.json                          | 109 +++++++++---------
 NodeApp/src/helpers/Dojo/ExerciseRunHelper.ts |   1 -
 NodeApp/tsconfig.json                         |  23 ++--
 5 files changed, 82 insertions(+), 72 deletions(-)
 rename NodeApp/{eslint.config.js => eslint.config.mjs} (96%)

diff --git a/NodeApp/eslint.config.js b/NodeApp/eslint.config.mjs
similarity index 96%
rename from NodeApp/eslint.config.js
rename to NodeApp/eslint.config.mjs
index 961e9fb..ca40422 100644
--- a/NodeApp/eslint.config.js
+++ b/NodeApp/eslint.config.mjs
@@ -6,7 +6,7 @@ import tseslint from 'typescript-eslint';
 
 
 export default tseslint.config({
-                                   ignores: [ 'dist/*', 'node_modules/*', '.gitlab-ci.yml', 'eslint.config.js' ]
+                                   ignores: [ 'dist/*', 'node_modules/*', '.gitlab-ci.yml', 'eslint.config.mjs' ]
                                }, eslint.configs.recommended, ...tseslint.configs.recommendedTypeChecked, {
                                    languageOptions: {
                                        parserOptions: {
diff --git a/NodeApp/package-lock.json b/NodeApp/package-lock.json
index c546489..0f20b70 100644
--- a/NodeApp/package-lock.json
+++ b/NodeApp/package-lock.json
@@ -10,6 +10,7 @@
             "license": "AGPLv3",
             "dependencies": {
                 "@dotenvx/dotenvx": "^0.34.0",
+                "@eslint/js": "^9.0.0",
                 "@gitbeaker/core": "^40.0.3",
                 "@gitbeaker/requester-utils": "^40.0.3",
                 "@gitbeaker/rest": "^40.0.3",
@@ -682,12 +683,11 @@
             }
         },
         "node_modules/@eslint/js": {
-            "version": "8.57.0",
-            "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz",
-            "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==",
-            "dev": true,
+            "version": "9.0.0",
+            "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.0.0.tgz",
+            "integrity": "sha512-RThY/MnKrhubF6+s1JflwUjPEsnCEmYCWwqa/aRISKWNXGZ9epUwft4bUMM35SdKF9xvBrLydAM1RDHd1Z//ZQ==",
             "engines": {
-                "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+                "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
             }
         },
         "node_modules/@fastify/busboy": {
@@ -2958,6 +2958,15 @@
                 "url": "https://opencollective.com/eslint"
             }
         },
+        "node_modules/eslint/node_modules/@eslint/js": {
+            "version": "8.57.0",
+            "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz",
+            "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==",
+            "dev": true,
+            "engines": {
+                "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+            }
+        },
         "node_modules/eslint/node_modules/ajv": {
             "version": "6.12.6",
             "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
diff --git a/NodeApp/package.json b/NodeApp/package.json
index 19a689e..f323aef 100644
--- a/NodeApp/package.json
+++ b/NodeApp/package.json
@@ -1,16 +1,16 @@
 {
-    "name"           : "dojo_cli",
-    "description"    : "CLI of the Dojo project",
-    "version"        : "4.0.0",
-    "license"        : "AGPLv3",
-    "author"         : "Michaël Minelli <dojo@minelli.me>",
-    "main"           : "dist/app.js",
-    "bin"            : {
+    "name": "dojo_cli",
+    "description": "CLI of the Dojo project",
+    "version": "4.0.0",
+    "license": "AGPLv3",
+    "author": "Michaël Minelli <dojo@minelli.me>",
+    "main": "dist/app.js",
+    "bin": {
         "dojo": "./dist/app.js"
     },
-    "pkg"            : {
+    "pkg": {
         "scripts": [],
-        "assets" : [
+        "assets": [
             "node_modules/axios/dist/node/axios.cjs",
             ".env",
             "assets/**/*"
@@ -24,56 +24,57 @@
             "node18-win-x86"
         ]
     },
-    "scripts"        : {
+    "scripts": {
         "dotenv:build": "npx dotenvx encrypt",
-        "lint"        : "npx eslint .",
-        "genversion"  : "npx genversion -s -e src/config/Version.ts",
-        "build"       : "npm run genversion; npx tsc",
-        "start:dev"   : "npm run genversion; npm run lint; tsc --noEmit && npx tsx dist/app.js",
-        "test"        : "echo \"Error: no test specified\" && exit 1"
+        "lint": "npx eslint .",
+        "genversion": "npx genversion -s -e src/config/Version.ts",
+        "build": "npm run genversion; npx tsc",
+        "start:dev": "npm run genversion; npm run lint; tsc --noEmit && npx tsx dist/app.js",
+        "test": "echo \"Error: no test specified\" && exit 1"
     },
-    "dependencies"   : {
-        "@dotenvx/dotenvx"          : "^0.34.0",
-        "@gitbeaker/rest"           : "^40.0.3",
-        "@gitbeaker/core"           : "^40.0.3",
+    "dependencies": {
+        "@dotenvx/dotenvx": "^0.34.0",
+        "@eslint/js": "^9.0.0",
+        "@gitbeaker/core": "^40.0.3",
         "@gitbeaker/requester-utils": "^40.0.3",
-        "appdata-path"              : "^1.0.0",
-        "axios"                     : "^1.6.8",
-        "boxen"                     : "^5.1.2",
-        "chalk"                     : "^4.1.2",
-        "commander"                 : "^12.0.0",
-        "form-data"                 : "^4.0.0",
-        "fs-extra"                  : "^11.2.0",
-        "http-status-codes"         : "^2.3.0",
-        "inquirer"                  : "^8.2.6",
-        "json5"                     : "^2.2.3",
-        "jsonwebtoken"              : "^8.5.1",
-        "open"                      : "^8.4.2",
-        "ora"                       : "^5.4.1",
-        "semver"                    : "^7.6.0",
-        "tar-stream"                : "^3.1.7",
-        "winston"                   : "^3.13.0",
-        "winston-transport"         : "^4.7.0",
-        "yaml"                      : "^2.4.1",
-        "zod"                       : "^3.22.5",
-        "zod-validation-error"      : "^3.1.0"
+        "@gitbeaker/rest": "^40.0.3",
+        "appdata-path": "^1.0.0",
+        "axios": "^1.6.8",
+        "boxen": "^5.1.2",
+        "chalk": "^4.1.2",
+        "commander": "^12.0.0",
+        "form-data": "^4.0.0",
+        "fs-extra": "^11.2.0",
+        "http-status-codes": "^2.3.0",
+        "inquirer": "^8.2.6",
+        "json5": "^2.2.3",
+        "jsonwebtoken": "^8.5.1",
+        "open": "^8.4.2",
+        "ora": "^5.4.1",
+        "semver": "^7.6.0",
+        "tar-stream": "^3.1.7",
+        "winston": "^3.13.0",
+        "winston-transport": "^4.7.0",
+        "yaml": "^2.4.1",
+        "zod": "^3.22.5",
+        "zod-validation-error": "^3.1.0"
     },
     "devDependencies": {
-        "@types/fs-extra"                 : "^11.0.4",
-        "@types/inquirer"                 : "^8.2.10",
-        "@types/jsonwebtoken"             : "^8.5.9",
-        "@types/node"                     : "^18.19.31",
-        "@types/semver"                   : "^7.5.8",
-        "@types/tar-stream"               : "^3.1.3",
+        "@types/fs-extra": "^11.0.4",
+        "@types/inquirer": "^8.2.10",
+        "@types/jsonwebtoken": "^8.5.9",
+        "@types/node": "^18.19.31",
+        "@types/semver": "^7.5.8",
+        "@types/tar-stream": "^3.1.3",
         "@typescript-eslint/eslint-plugin": "^7.7.0",
-        "@typescript-eslint/parser"       : "^7.7.0",
-        "dotenv-vault"                    : "^1.26.1",
-        "eslint"                          : "^8.57.0",
-        "genversion"                      : "^3.2.0",
-        "pkg"                             : "^5.8.1",
-        "tiny-typed-emitter"              : "^2.1.0",
-        "tsx"                             : "^4.7.2",
-        "typescript"                      : "^5.4.5",
-        "typescript-eslint"               : "^7.7.0"
+        "@typescript-eslint/parser": "^7.7.0",
+        "dotenv-vault": "^1.26.1",
+        "eslint": "^8.57.0",
+        "genversion": "^3.2.0",
+        "pkg": "^5.8.1",
+        "tiny-typed-emitter": "^2.1.0",
+        "tsx": "^4.7.2",
+        "typescript": "^5.4.5",
+        "typescript-eslint": "^7.7.0"
     }
 }
diff --git a/NodeApp/src/helpers/Dojo/ExerciseRunHelper.ts b/NodeApp/src/helpers/Dojo/ExerciseRunHelper.ts
index 1da0453..235bc74 100644
--- a/NodeApp/src/helpers/Dojo/ExerciseRunHelper.ts
+++ b/NodeApp/src/helpers/Dojo/ExerciseRunHelper.ts
@@ -15,7 +15,6 @@ import util                                 from 'util';
 import { exec }                             from 'child_process';
 import SharedConfig                         from '../../shared/config/SharedConfig.js';
 import TextStyle                            from '../../types/TextStyle.js';
-import { fileURLToPath }                    from 'url';
 
 
 const execAsync = util.promisify(exec);
diff --git a/NodeApp/tsconfig.json b/NodeApp/tsconfig.json
index 96fb474..bdd2d43 100644
--- a/NodeApp/tsconfig.json
+++ b/NodeApp/tsconfig.json
@@ -1,18 +1,18 @@
 {
     "compilerOptions": {
-        "rootDir"         : "src",
-        "outDir"          : "dist",
-        "strict"          : true,
-        "target"          : "ES2022",
-        "module"          : "commonjs",
-        "sourceMap"       : true,
-        "noImplicitAny"   : true,
-        "esModuleInterop" : true,
-        "lib"             : [
+        "rootDir"        : "src",
+        "outDir"         : "dist",
+        "strict"         : true,
+        "target"         : "ES2022",
+        "module"         : "commonjs",
+        "sourceMap"      : true,
+        "noImplicitAny"  : true,
+        "esModuleInterop": true,
+        "lib"            : [
             "ES2022",
             "DOM"
         ],
-        "types"           : [
+        "types"          : [
             "node"
         ]
     },
@@ -20,6 +20,7 @@
         "node_modules"
     ],
     "include"        : [
-        "src/**/*.ts"
+        "src/**/*.ts",
+        "eslint.config.mjs"
     ]
 }
\ No newline at end of file
-- 
GitLab