From 2a29bda34f162d6b4db31655d3644ea0a59526a2 Mon Sep 17 00:00:00 2001 From: James Brunton Date: Mon, 6 Oct 2025 13:10:00 +0100 Subject: [PATCH] Enable ESLint no-undef rule (#4346) # Description of Changes Enable ESLint [no-undef rule](https://eslint.org/docs/latest/rules/no-undef) --- frontend/eslint.config.mjs | 30 ++++++++++++++++++++++++++++-- frontend/package-lock.json | 21 +++++++++++++++++---- frontend/package.json | 1 + 3 files changed, 46 insertions(+), 6 deletions(-) diff --git a/frontend/eslint.config.mjs b/frontend/eslint.config.mjs index c0f9fd678..0b92de05b 100644 --- a/frontend/eslint.config.mjs +++ b/frontend/eslint.config.mjs @@ -1,9 +1,18 @@ // @ts-check import eslint from '@eslint/js'; +import globals from "globals"; import { defineConfig } from 'eslint/config'; import tseslint from 'typescript-eslint'; +const srcGlobs = [ + 'src/**/*.{js,mjs,jsx,ts,tsx}', +]; +const nodeGlobs = [ + 'scripts/**/*.{js,ts,mjs}', + '*.config.{js,ts,mjs}', +]; + export default defineConfig( eslint.configs.recommended, tseslint.configs.recommended, @@ -15,7 +24,6 @@ export default defineConfig( }, { rules: { - "no-undef": "off", // Temporarily disabled until codebase conformant "@typescript-eslint/no-empty-object-type": [ "error", { @@ -38,5 +46,23 @@ export default defineConfig( }, ], }, - } + }, + // Config for browser scripts + { + files: srcGlobs, + languageOptions: { + globals: { + ...globals.browser, + } + } + }, + // Config for node scripts + { + files: nodeGlobs, + languageOptions: { + globals: { + ...globals.node, + } + } + }, ); diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 316e1af8a..f73143e83 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -41,6 +41,7 @@ "@tanstack/react-virtual": "^3.13.12", "autoprefixer": "^10.4.21", "axios": "^1.12.2", + "globals": "^16.4.0", "i18next": "^25.5.2", "i18next-browser-languagedetector": "^8.2.0", "i18next-http-backend": "^3.0.2", @@ -1760,6 +1761,19 @@ "mlly": "^1.7.4" } }, + "node_modules/@iconify/utils/node_modules/globals": { + "version": "15.15.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-15.15.0.tgz", + "integrity": "sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -6415,10 +6429,9 @@ } }, "node_modules/globals": { - "version": "15.15.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-15.15.0.tgz", - "integrity": "sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg==", - "dev": true, + "version": "16.4.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-16.4.0.tgz", + "integrity": "sha512-ob/2LcVVaVGCYN+r14cnwnoDPUufjiYgSqRhiFD0Q1iI4Odora5RE8Iv1D24hAz5oMophRGkGz+yuvQmmUMnMw==", "license": "MIT", "engines": { "node": ">=18" diff --git a/frontend/package.json b/frontend/package.json index 0ec14e357..319653af1 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -37,6 +37,7 @@ "@tanstack/react-virtual": "^3.13.12", "autoprefixer": "^10.4.21", "axios": "^1.12.2", + "globals": "^16.4.0", "i18next": "^25.5.2", "i18next-browser-languagedetector": "^8.2.0", "i18next-http-backend": "^3.0.2",