@putout/plugin-apply-global-this
v1.0.1
Published
🐊Putout plugin adds ability to find and apply 'globalThis'
Downloads
153
Maintainers
Readme
@putout/plugin-apply-global-this 
Historically, accessing the global object has required different syntax in different JavaScript environments. On the web you can use
window,self, or frames - but in Web Workers onlyselfwill work. In Node.js none of these work, and you must instead useglobal(c) MDN
🐊Putout plugin adds ability to find and apply globalThis.
Check out in 🐊Putout Editor.
Install
npm i @putout/plugin-apply-global-thisRule
{
"rules": {
"apply-global-this": "on"
}
}❌ Example of incorrect code
globalThis.__putout_debug = debugFn;
globalThis.CloudCmd = {};✅ Example of correct code
globalThis.__putout_debug = debugFn;
globalThis.CloudCmd = {};Comparison
Linter | Rule | Fix
-------|------|------------|
🐊 Putout | apply-global-this | ✅
⏣ ESLint | no-node-globals | ❌
License
MIT
