From 7fdbe444f58a658c5d3b46a94198d256477c76b5 Mon Sep 17 00:00:00 2001 From: Michael Kauzmann Date: Thu, 26 Sep 2024 17:03:18 -0600 Subject: [PATCH] fix browser globals (out of root), https://github.com/phetsims/chipper/issues/1451 Signed-off-by: Michael Kauzmann --- eslint/chipper.eslint.config.mjs | 10 ---------- eslint/node.eslint.config.mjs | 3 --- eslint/root.eslint.config.mjs | 13 +++++++++---- eslint/sim.eslint.config.mjs | 3 ++- 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/eslint/chipper.eslint.config.mjs b/eslint/chipper.eslint.config.mjs index f39fb7b5..26f4c41b 100644 --- a/eslint/chipper.eslint.config.mjs +++ b/eslint/chipper.eslint.config.mjs @@ -1,7 +1,6 @@ // Copyright 2018, University of Colorado Boulder // @author Michael Kauzmann -import globals from 'globals'; import nodeEslintConfig from './node.eslint.config.mjs'; /** @@ -10,15 +9,6 @@ import nodeEslintConfig from './node.eslint.config.mjs'; export default [ ...nodeEslintConfig, { - - languageOptions: { - globals: { - - // TODO: we would like to say exclude browser, but we will have to remove it from root.eslint.config.mjs to do so. See https://github.com/phetsims/chipper/issues/1451 - // That is, we used to say browser: false. How to do that with flat? - ...globals.node - } - }, rules: { 'phet/bad-chipper-text': 'error' } diff --git a/eslint/node.eslint.config.mjs b/eslint/node.eslint.config.mjs index 91ea25b4..d55c7810 100644 --- a/eslint/node.eslint.config.mjs +++ b/eslint/node.eslint.config.mjs @@ -12,9 +12,6 @@ export default [ { languageOptions: { globals: { - - // TODO: we would like to say exclude browser, but we will have to remove it from root.eslint.config.mjs to do so. See https://github.com/phetsims/chipper/issues/1451 - // That is, we used to say browser: false. How to do that with flat? ...globals.node } }, diff --git a/eslint/root.eslint.config.mjs b/eslint/root.eslint.config.mjs index a2c572ef..c99f2a40 100644 --- a/eslint/root.eslint.config.mjs +++ b/eslint/root.eslint.config.mjs @@ -1750,9 +1750,6 @@ export default [ }, { languageOptions: { globals: { - - // ...globals.node, - ...globals.browser, ...globals.es2018, //============================================================================================= @@ -1898,4 +1895,12 @@ export default [ } } } -]; \ No newline at end of file +]; + +export const browserGlobals = { + languageOptions: { + globals: { + ...globals.browser + } + } +}; \ No newline at end of file diff --git a/eslint/sim.eslint.config.mjs b/eslint/sim.eslint.config.mjs index 4eb335a1..6f820a90 100644 --- a/eslint/sim.eslint.config.mjs +++ b/eslint/sim.eslint.config.mjs @@ -1,13 +1,14 @@ // Copyright 2018, University of Colorado Boulder // @author Michael Kauzmann -import rootEslintConfig from './root.eslint.config.mjs'; +import rootEslintConfig, { browserGlobals } from './root.eslint.config.mjs'; /** * Eslint config applied only to sims. */ export default [ ...rootEslintConfig, + browserGlobals, { rules: { 'phet/bad-sim-text': 'error'