Add TypeScript parser tests for shouldSkipReference#76611
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Size Change: 0 B Total Size: 8.76 MB ℹ️ View Unchanged
|
|
Flaky tests detected in 57261fa. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/23257871350
|
ciampo
left a comment
There was a problem hiding this comment.
LGTM 🚀
Thank you for the follow up!
Since shouldSkipReference is shared across the other no-dom-globals-* rules, should we add TS-parser tests to those tests too? Not a blocker, just a consideration.
Done. Thank you |
Co-authored-by: manzoorwanijk <manzoorwanijk@git.wordpress.org> Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: manzoorwanijk <manzoorwanijk@git.wordpress.org> Co-authored-by: ciampo <mciampini@git.wordpress.org>
What?
Follow-up to #76508.
Add TypeScript parser tests for the
shouldSkipReferenceutility in theno-dom-globals-*rules.Why?
#76508 added
TSTypeReference,TSInterfaceHeritage, andTSTypeQueryto the skip list inshouldSkipReference, but the tests used the default parser which doesn't produce TS AST nodes. These tests use@typescript-eslint/parserto verify the skip conditions actually work.How?
Added a separate
RuleTesterinstance configured with@typescript-eslint/parserinno-dom-globals-in-module-scopetests:const el: HTMLElement(TSTypeReference),interface MyEl extends HTMLElement(TSInterfaceHeritage),type Win = typeof window(TSTypeQuery)const width = window.innerWidth— value-level usage is still flagged in TS filesTesting Instructions
npm run test:unit -- packages/eslint-plugin/rules/__tests__/no-dom-globals-in-module-scope.jsScreenshots or screencast
N/A
Use of AI Tools
This PR was authored with Claude Code.