diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 852ba9e..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "brightspace/browser-config", - "env": { - "node": true - }, - "rules": { - "no-empty": ["error", { "allowEmptyCatch": true }] - } -} diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..215479f --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,31 @@ +import { fileURLToPath } from 'node:url'; +import { FlatCompat } from '@eslint/eslintrc'; +import globals from 'globals'; +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 +}); +export default [...compat.extends('brightspace/browser-config'), { + languageOptions: { + globals: { + ...globals.node, + }, + }, + + rules: { + 'no-empty': ['error', { + allowEmptyCatch: true, + }], + }, +}, +...compat.extends('brightspace/testing-config').map(c => ({ + ...c, + files: ['test/**/*'] +})) +]; diff --git a/package.json b/package.json index e71c396..82b2122 100644 --- a/package.json +++ b/package.json @@ -39,10 +39,14 @@ "devDependencies": { "@babel/core": "^7", "@babel/eslint-parser": "^7", + "@eslint/compat": "^1", + "@eslint/eslintrc": "^3", + "@eslint/js": "^9", + "globals": "^15", "chai": "^4", "chai-as-promised": "^8", - "eslint": "^8", - "eslint-config-brightspace": "^1.0", + "eslint": "^9", + "eslint-config-brightspace": "^1.2.1", "eslint-plugin-html": "^8", "eslint-plugin-import": "^2", "eslint-plugin-sort-class-members": "^1", diff --git a/plugins/sync-css-variable/host.js b/plugins/sync-css-variable/host.js index cfbbefe..c234190 100644 --- a/plugins/sync-css-variable/host.js +++ b/plugins/sync-css-variable/host.js @@ -6,7 +6,7 @@ export function hostSyncCssVariable(host) { return JSON.parse( htmlElems[0].getAttribute('data-css-vars') ); - } catch (e) {} + } catch {} } return {}; }); diff --git a/plugins/sync-intl/host.js b/plugins/sync-intl/host.js index c34e09c..dd32a85 100644 --- a/plugins/sync-intl/host.js +++ b/plugins/sync-intl/host.js @@ -6,7 +6,7 @@ export function hostSyncIntl(host) { return JSON.parse( htmlElems[0].getAttribute('data-intl-overrides') ); - } catch (e) {} + } catch {} } return {}; }); diff --git a/plugins/sync-oslo/host.js b/plugins/sync-oslo/host.js index ba3e7f2..d834075 100644 --- a/plugins/sync-oslo/host.js +++ b/plugins/sync-oslo/host.js @@ -10,7 +10,7 @@ export function hostSyncOslo(host) { osloData.collection = new window.URL(osloData.collection, window.location.origin).href; return osloData; - } catch (e) {} + } catch {} } return; }); diff --git a/plugins/sync-timezone/host.js b/plugins/sync-timezone/host.js index b61d5cc..7e7e77a 100644 --- a/plugins/sync-timezone/host.js +++ b/plugins/sync-timezone/host.js @@ -6,7 +6,7 @@ export function hostSyncTimezone(host) { return JSON.parse( htmlElems[0].getAttribute('data-timezone') ); - } catch (e) {} + } catch {} } return { identifier: '', diff --git a/test/.eslintrc.json b/test/.eslintrc.json deleted file mode 100644 index 60b5f72..0000000 --- a/test/.eslintrc.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "env": { - "es6": true, - "mocha": true - } -}