From de79ed6f37e9368ef46f2f276df1122c6e864023 Mon Sep 17 00:00:00 2001 From: GZolla <43836485+GZolla@users.noreply.github.com> Date: Thu, 31 Oct 2024 14:11:57 -0700 Subject: [PATCH 1/2] Update to eslint9 --- .eslintrc.json | 3 --- eslint.config.js | 26 ++++++++++++++++++++++++++ package.json | 9 ++++++--- test/.eslintrc.json | 3 --- 4 files changed, 32 insertions(+), 9 deletions(-) delete mode 100644 .eslintrc.json create mode 100644 eslint.config.js delete mode 100644 test/.eslintrc.json diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index fcf2d2f..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "brightspace/browser-config" -} diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..8eb0ee6 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,26 @@ +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import js from "@eslint/js"; +import { FlatCompat } from "@eslint/eslintrc"; +import { includeIgnoreFile } from "@eslint/compat"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const compat = new FlatCompat({ + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all +}); +const gitignorePath = path.resolve(__dirname, ".gitignore"); + +export default [ + includeIgnoreFile(gitignorePath), + ...compat.extends("brightspace/browser-config").map(c => ({ + ...c, + files:['**/*.js', '**/*.html'] + })), + ...compat.extends("brightspace/testing-config").map(c => ({ + ...c, + files:['test/**/*'] + })), +]; diff --git a/package.json b/package.json index d302798..fbe6098 100644 --- a/package.json +++ b/package.json @@ -6,15 +6,18 @@ "author": "D2L Corporation", "license": "Apache-2.0", "scripts": { - "lint": "eslint . --ext .js,.html", + "lint": "eslint .", "test": "npm run lint && npm run test:unit", "test:unit": "d2l-test-runner" }, "devDependencies": { "@brightspace-ui/testing": "^1", "@web/dev-server": "^0.4", - "eslint": "^8", - "eslint-config-brightspace": "^1", + "eslint": "^9", + "eslint-config-brightspace": "^1.2.1", + "@eslint/compat": "^1", + "@eslint/eslintrc": "^3", + "@eslint/js": "^9", "sinon": "^19" }, "version": "2.1.1", diff --git a/test/.eslintrc.json b/test/.eslintrc.json deleted file mode 100644 index 9c6a0b6..0000000 --- a/test/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "brightspace/testing-config" -} From 7cfc7c3163b14ca9d9bf87ba36c648fc861059ed Mon Sep 17 00:00:00 2001 From: GZolla <43836485+GZolla@users.noreply.github.com> Date: Thu, 31 Oct 2024 14:17:11 -0700 Subject: [PATCH 2/2] Appease Linter --- eslint.config.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 8eb0ee6..031cecc 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,25 +1,25 @@ -import path from "node:path"; -import { fileURLToPath } from "node:url"; -import js from "@eslint/js"; -import { FlatCompat } from "@eslint/eslintrc"; -import { includeIgnoreFile } from "@eslint/compat"; +import { fileURLToPath } from 'node:url'; +import { FlatCompat } from '@eslint/eslintrc'; +import { includeIgnoreFile } from '@eslint/compat'; +import js from '@eslint/js'; +import path from 'node:path'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); const compat = new FlatCompat({ - baseDirectory: __dirname, - recommendedConfig: js.configs.recommended, - allConfig: js.configs.all + baseDirectory: __dirname, + recommendedConfig: js.configs.recommended, + allConfig: js.configs.all }); -const gitignorePath = path.resolve(__dirname, ".gitignore"); +const gitignorePath = path.resolve(__dirname, '.gitignore'); export default [ - includeIgnoreFile(gitignorePath), - ...compat.extends("brightspace/browser-config").map(c => ({ + includeIgnoreFile(gitignorePath), + ...compat.extends('brightspace/browser-config').map(c => ({ ...c, files:['**/*.js', '**/*.html'] })), - ...compat.extends("brightspace/testing-config").map(c => ({ + ...compat.extends('brightspace/testing-config').map(c => ({ ...c, files:['test/**/*'] })),