eslint-config: drop the globals dependency and browser-env override - #267
Merged
Conversation
`@wordpress/eslint-plugin` deliberately does not enable the browser environment
(see its jsdoc config comment). The v7 config re-added the full browser globals
set via a `globals` dependency, diverging from the WordPress default. Remove it
to stay a thin layer on top of WordPress.
- Remove `languageOptions.globals: { ...globals.browser }` from the flat config.
- Drop the `globals` dependency (eslint-config now has no dependencies).
Impact: `.ts`/`.tsx` are unaffected (`no-undef` is off for TS). In `.js`/`.jsx`,
bare DOM-only globals (MutationObserver, getComputedStyle, IntersectionObserver,
…) are no longer predefined and must be added per project or used via `window.`.
Documented in the changeset + README migration notes.
The flat-config migration changeset is already consumed by 7.0.0-alpha.0 (recorded in .changeset/pre.json), so editing it would not trigger a new release. Move the "no browser globals" note into its own changeset instead, so the change gets versioned into the next alpha (testable live) and lands as its own entry in the stable 7.0.0 changelog.
This was referenced Jul 19, 2026
ocean90
added a commit
that referenced
this pull request
Jul 19, 2026
* Group Dependabot updates and guard against missing changesets Two low-risk improvements instead of an auto-changeset writer — that writer would be dormant here, since the published packages have no runtime dependencies and Dependabot only touches root dev tooling + composer. - dependabot.yml: group the npm lint toolchain (@wordpress/*, eslint*, stylelint*, prettier, typescript) into one weekly PR, and batch all github-actions bumps. Composer stays ungrouped on purpose — the PHP stack is exact-pinned and each bump is a deliberate review against the PHP_CodeSniffer 3 ceiling. - ci.yml: add a "Changeset guard" job that fails a PR when a published package's package.json changes without a changeset — the peer/dependency class we handled by hand during the v7 alphas (#264/#266/#267). Skips pushes and the changesets "Version Packages" PR. * Changeset guard: only count newly added changesets Address Copilot review on #272: `changeset_added` came from `git diff --name-only`, so a merely *modified* (or moved) existing changeset would satisfy the guard despite the name/message meaning a new one. Editing an existing changeset does not version a new change (and in pre mode does not trigger a release), so switch to `git diff --name-status` and require an added (`A`) file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
@wordpress/eslint-plugindeliberately does not enable the browser environment — its own config even says so in a comment (configs/jsdoc.js: "we don't have thebrowserenvironment enabled for the project"). The v7 flat config re-added the full browser globals set via aglobalsdependency (mirroring the old v6env: { browser: true }), which diverges from the WordPress default and adds a dependency (+ Dependabot noise, e.g. #264).This removes it so
@wearerequired/eslint-configstays a thin layer on top of WordPress — and it now has nodependenciesat all.What we lose (measured)
.ts/.tsx@wordpress/eslint-pluginturnsno-undefoff for TypeScript..js/.jsxno-undef:MutationObserver,getComputedStyle,requestAnimationFrame,IntersectionObserver,ResizeObserver, …window,document,navigator,localStorage,fetch,console,setTimeoutstay defined.Consumers that use bare DOM globals in
.jsadd them per project (languageOptions.globals) or access viawindow.— the WordPress-idiomatic way. Documented in the changeset + README migration notes.Changes
languageOptions.globals: { ...globals.browser }from the flat config and theglobalsdependency.Closes the need for Dependabot #264 (globals 16 → 17).