@putout/plugin-apply-global-this
🐊Putout plugin adds ability to find and apply 'globalThis'
Last updated 6 months ago by coderaiser .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @putout/plugin-apply-global-this 
SYNC missed versions from official npm registry.

@putout/plugin-apply-global-this NPM version

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 only self will work. In Node.js none of these work, and you must instead use global

(c) MDN

🐊Putout plugin adds ability to find and apply globalThis.

Check out in 🐊Putout Editor.

Install

npm i @putout/plugin-apply-global-this

Rule

{
    "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

Current Tags

  • 2.0.0                                ...           latest (6 months ago)

3 Versions

  • 2.0.0                                ...           6 months ago
  • 1.0.1                                ...           10 months ago
  • 1.0.0                                ...           10 months ago
Maintainers (1)
Downloads
Total 3
Today 0
This Week 0
This Month 3
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (6)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE