Rule proposal: `prefer-global-this`
See original GitHub issueglobalThis
is the unified way to access the “global” object.
This has the benefit of making code more cross-platform and more consistent.
globalThis
requires Node.js 12, so we cannot add it to the recommended preset until April 2021 (date of Node.js 10 obsoletion).
Fail
window.foo; // Browser
self.foo; // Web Worker
global.foo; // Node.js
Pass
globalThis.foo;
Issue Analytics
- State:
- Created 3 years ago
- Reactions:6
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Proposed rule: Order Competition Rule - SEC.gov
proposed rule would prohibit a restricted competition trading center from internally executing certain orders of individual investors at a ...
Read more >The Most Curious Rule Proposal in Securities and Exchange ...
The Proposed Rules are of three categories: Disclosure Rules, Audit Rules, and Prohibited Activity Rules. These comments relate solely to the ...
Read more >Wikipedia:SOPA initiative
For more information on the proposed law itself, see SOPA ... Voice your support or opposition to the proposals by voting. You may...
Read more >eslint-plugin-unicorn - Bountysource
I wanted to propose a new rule to address a pattern that I have seen from a lot of our students at @upleveled...
Read more >sindresorhus/eslint-plugin-unicorn (Raised $2856.00)
Rule proposal : Prefer explicit array check over `Array#flat()`. Unfunded#1719created byfisker. $0.00.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Changed my mind.
globalThis
is more clear 👍@fregante The REPL doesn’t represent a proper Node.js environment. Try running the same in a file instead.