@E18e/Global

1.0.5Last update Aug 9, 2024
by@e18e

Global Codemod

Introduction

This codemod replaces the usage of global, global/document, and global/window with the standardized globalThis, document, and window identifiers, respectively. This change helps to eliminate unnecessary dependencies and improves the compatibility and readability of the code by leveraging built-in global objects.

Before

import global from 'global';
import document from 'global/document';
import window from 'global/window';
const element = document.createElement('div');
window.alert('Hello, World!');

After

const element = document.createElement('div');
window.alert('Hello, World!');

Build custom codemods

Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community

background illustrationGet Started Now