Skip to content

Commit

Permalink
feat: Use globalThis if available (#1070)
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon authored May 28, 2022
1 parent f176285 commit c80809a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
},
"eslintConfig": {
"extends": "./node_modules/kcd-scripts/eslint.js",
"globals": {
"globalThis": "readonly"
},
"rules": {
"react/prop-types": "off",
"react/no-adjacent-inline-elements": "off",
Expand Down
4 changes: 4 additions & 0 deletions src/act-compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ const domAct = testUtils.act

function getGlobalThis() {
/* istanbul ignore else */
if (typeof globalThis !== 'undefined') {
return globalThis
}
/* istanbul ignore next */
if (typeof self !== 'undefined') {
return self
}
Expand Down

0 comments on commit c80809a

Please sign in to comment.