diff --git a/eslint.config.mjs b/eslint.config.mjs index 28349226c..ab944b62c 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,6 +1,30 @@ import baseConfig from "@mintel/eslint-config"; import { nextConfig } from "@mintel/eslint-config/next"; +/** + * Cleanup function to fix potential whitespace issues in global keys + * (e.g. "AudioWorkletGlobalScope " bug in some versions of globals/eslint) + */ +function cleanupConfig(configs) { + return configs.map(config => { + if (config.languageOptions && config.languageOptions.globals) { + const cleanGlobals = {}; + for (const [key, value] of Object.entries(config.languageOptions.globals)) { + cleanGlobals[key.trim()] = value; + } + // Return a new object to avoid mutating the original if it's reused + return { + ...config, + languageOptions: { + ...config.languageOptions, + globals: cleanGlobals + } + }; + } + return config; + }); +} + export default [ { ignores: [ @@ -29,8 +53,8 @@ export default [ ], }, - ...baseConfig, - ...nextConfig.map((config) => ({ + ...cleanupConfig(baseConfig), + ...cleanupConfig(nextConfig).map((config) => ({ ...config, files: ["**/*.{ts,tsx}"], rules: {