Skip to content
Permalink
Browse files
perf: switch from object spread to Object.assign when merging globa…
…ls (#16311)

Refs #16302
  • Loading branch information
mdjermanovic committed Sep 16, 2022
1 parent 1729f9e commit 504fe59b0e0f4f5a2afb6a69aaed5cb4ca631012
Showing 1 changed file with 12 additions and 6 deletions.
@@ -1601,12 +1601,18 @@ class Linter {
languageOptions.ecmaVersion
);

// add configured globals and language globals
const configuredGlobals = {
...(getGlobalsForEcmaVersion(languageOptions.ecmaVersion)),
...(languageOptions.sourceType === "commonjs" ? globals.commonjs : void 0),
...languageOptions.globals
};
/*
* add configured globals and language globals
*
* using Object.assign instead of object spread for performance reasons
* https://github.com/eslint/eslint/issues/16302
*/
const configuredGlobals = Object.assign(
{},
getGlobalsForEcmaVersion(languageOptions.ecmaVersion),
languageOptions.sourceType === "commonjs" ? globals.commonjs : void 0,
languageOptions.globals
);

// double check that there is a parser to avoid mysterious error messages
if (!languageOptions.parser) {

0 comments on commit 504fe59

Please sign in to comment.