feat(config): supports importing rules from http url#7
Merged
Conversation
johnsoncodehk
added a commit
that referenced
this pull request
Jun 8, 2024
johnsoncodehk
added a commit
that referenced
this pull request
May 2, 2026
Hardens the test suite against the bug class fixed earlier in this
PR (JSXAttribute.parent corruption via phantom TSJsxAttributes).
Master's tests had three blind spots:
1. lazy-estree.test's `compare()` walks tree TOP-DOWN through child
getters, where parent is set correctly even on master. Bottom-up
`materialise(tsNode)` (what tsScanTraverse does on selector match)
was never exercised. The function also explicitly skips the
`parent` field — so even top-down parent-chain corruption would
not have failed parity.
2. compat-pipeline's JSXAttribute listener pushed `attr:${n.name}`
events but never read `n.parent`, leaving the listener-API parent
contract unverified.
3. Nothing checked the invariant "no node has a 'TS<KindName>' type
for kinds typescript-estree elides" — the property the
TSJsxAttributes regression directly violated.
Three new test blocks address each:
Bottom-up parity sweep (lazy-estree.test): 9 JSX-attribute fixtures
(self-closing, non-self-closing, spread, sibling attrs, multi-attr
mixed, fragment, nested attr value, deeply nested), each walks every
TS node, runs `lazy.materialise(tsNode, ctx)`, and compares the
resulting type / parent.type / parent.parent.type against eager's
`astMaps.tsNodeToESTreeNodeMap` lookup. Eager parents are stitched
ourselves (typescript-estree's astConverter doesn't set parent —
ESLint's SourceCode does that downstream). 117 type asserts + 108
parent asserts on the fix branch; 7 unique mismatches on master.
Phantom-types invariant (lazy-estree.test): 5 comprehensive fixtures
(jsx-attrs-everything, ts-everything, imports-everything, patterns-
everything, jsx-fragment-mix), each walks via visitor-keys and ALSO
bottom-up materialises every TS node that has an eager counterpart.
Asserts no produced type starts with 'TS' AND isn't in typescript-
estree's published TS-* type list. The published list is hard-coded
inline (~75 entries) so the test fails immediately if a future
PR-added GenericTSNode fallback emits a name not in eager's spec.
JSX listener parent assertion (compat-pipeline): test #7's
JSXAttribute / JSXSpreadAttribute listeners now also assert
`parents[0] === 'JSXOpeningElement'` — the contract any
jsx-a11y / react/jsx-* rule relies on. The contract is correct in
spec; whether each listener path independently fails on master
depends on whether sibling listeners pre-warm the cache top-down,
but the assert still locks the contract from inside the actual
ESLint listener API surface.
Out of scope (real but unrelated impedance with eager that the broad
sweep also surfaces — left as separate follow-ups):
- export wrapper identity (lazy maps the TS node to ExportNamed/
DefaultWrapper, eager maps to the inner declaration)
- chain-expression wrapping for `a?.b?.c`
- destructuring with defaults
- CatchClause param lifted from ts.VariableDeclaration shim
- TSStringKeyword / TSVoidKeyword direct-on-Signature
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.
Supports directly using HTTP URL to import single or multiple rules without adding dependencies in package.json.