From 6ceacd8db12c9825ba4f8d5498a4f0baf3e9922e Mon Sep 17 00:00:00 2001 From: zanminkian Date: Wed, 18 Sep 2024 19:59:14 +0000 Subject: [PATCH] feat(eslint-config): ban `self` and `global`, prefer `globalThis` --- .changeset/polite-oranges-punch.md | 5 +++++ packages/eslint-config/src/config/javascript.ts | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 .changeset/polite-oranges-punch.md diff --git a/.changeset/polite-oranges-punch.md b/.changeset/polite-oranges-punch.md new file mode 100644 index 00000000..9a2d9f46 --- /dev/null +++ b/.changeset/polite-oranges-punch.md @@ -0,0 +1,5 @@ +--- +"@git-validator/eslint-config": patch +--- + +feat(eslint-config): ban `self` and `global`, prefer `globalThis` diff --git a/packages/eslint-config/src/config/javascript.ts b/packages/eslint-config/src/config/javascript.ts index 057eb447..c58bf1c1 100644 --- a/packages/eslint-config/src/config/javascript.ts +++ b/packages/eslint-config/src/config/javascript.ts @@ -271,9 +271,9 @@ export function javascript() { }, globals: { ...Object.fromEntries( - Object.entries(globals.browser).filter( - ([k]) => !confusingKeys.includes(k), - ), + Object.entries(globals.browser) + .filter(([k]) => !confusingKeys.includes(k)) + .filter(([k]) => !["self", "global"].includes(k)), // prefer `globalThis` ), }, },