Skip to content

fix(getter/js-family): JsxText reaches neither Halstead half #1483

Description

@dekobon

Summary

JsxText — the text content of a JSX element, hi in
<span>hi</span> — is in no arm of the JavaScript, MozJS or TSX
getters, so it reaches neither n1 nor n2. Found while reviewing
#1395, which fixed the operator sibling of this gap (</ and />).

Evidence

rg -n 'JsxText' big-code-analysis-ast/src/getter/ returns nothing.
bca ops --no-config on <div><span>hi</span></div> in a .jsx,
.js or .tsx file lists div and span as operands and no hi.
TypeScript's enum carries JsxText (163) but no JSX element kinds, so
it is unaffected.

Decision needed

Operand seems right — it is a literal, like a string's contents — but
check grammar-dispatch §5 first: confirm jsx_text is childless and
that no containing node is classified, and check how whitespace-only
jsx_text nodes (the newlines between tags in a multi-line element)
should score, since billing each as an operand would inflate N2 by
the source's formatting. No JSX exists in any corpus, so unit fixtures
only.

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions