Skip to content

feat: bump tree-sitter-javascript to 0.25, update CI and regenerate parsers#357

Draft
rbonestell wants to merge 4 commits intotree-sitter:masterfrom
rbonestell:tree-sitter-25-update
Draft

feat: bump tree-sitter-javascript to 0.25, update CI and regenerate parsers#357
rbonestell wants to merge 4 commits intotree-sitter:masterfrom
rbonestell:tree-sitter-25-update

Conversation

@rbonestell
Copy link
Copy Markdown

@rbonestell rbonestell commented Mar 7, 2026

Summary

Updates tree-sitter-typescript to track tree-sitter-javascript 0.25.0 and tree-sitter-cli 0.25.8, with regenerated parsers using tree-sitter v0.26.6.

Also fixes two reserved-word parsing regressions introduced by the 0.25 upgrade.

Resolves #345

Changes

  • deps: bump tree-sitter-javascript to ^0.25.0, tree-sitter-cli to ^0.25.8, tree-sitter peer to ^0.25.0
  • grammar: update rules for tree-sitter-javascript 0.25.0 compatibility
    • Remove using prefix from assignment_expression (now handled by upstream using_declaration)
    • Simplify decorator_parenthesized_expression to accept any expression
  • fix: JSX/TSX reserved-word identifiers (thanks to @SegaraRai for identifying and prototyping)
    • Add jsx_keyword_identifier rule allowing JS reserved words (class, for, const, delete, etc.) and contextual keywords (get, set, async, await, static, let) as JSX tag names, attribute names, and member expression components
    • Override _jsx_identifier to include keyword identifiers
    • Add jsx_member_expression rule for dotted keyword access (e.g. <Foo.class />)
    • Override _jsx_element_name to use jsx_member_expression
    • Add test corpus for JSX reserved-word identifiers (tsx_jsx_identifiers.txt)
  • fix: reserved words after optional chaining (?.)
    • The upstream reserved('properties', ...) mechanism allows keywords as property identifiers after . but fails after ?. in the TypeScript grammar due to parser state table interactions with the larger rule set
    • Add _keyword_identifier rule and override member_expression to include it as an explicit fallback
    • Use field('optional_chain', $.optional_chain) in call_expression to match upstream JS grammar structure
    • Add test corpus for a?.delete(b), myMap?.delete(key), a?.class, a?.return
  • test: add corpus tests for using declarations (plain, typed, await using, for-of)
  • ci: update setup-action/cli to v2 and parser-test-action to v3
    • Pin node-version to 22 for native binding compatibility
    • Migrate known parse failures from !files exclusions to invalid-files
  • build: regenerate TypeScript and TSX parsers with tree-sitter v0.26.6
  • style: fix JSDoc lint errors in define-grammar.js (@return@returns)

Prerequisites

Waiting on tree-sitter/tree-sitter-javascript#378 at which point I will update the reference to the new version of that package and clean up the invalid-files in ci.yml.

Bump tree-sitter-javascript to ^0.25.0, tree-sitter-cli to ^0.25.8, and tree-sitter peer dependency to ^0.25.0. Add tree-sitter as devDependency for node binding tests.
Update rules for tree-sitter-javascript 0.25.0 compatibility: remove 'using' prefix from assignment_expression (now handled by upstream using_declaration), simplify decorator_parenthesized_expression to accept any expression. Add corpus tests for using declarations (plain, typed, await using, for-of). Fix JSDoc lint errors (@return -> @returns).
Update setup-action/cli to v2 and parser-test-action to v3. Pin node-version to 22 for native binding compatibility. Migrate known parse failures to invalid-files.
@SegaraRai
Copy link
Copy Markdown

Thanks for putting this together. I tested this branch locally and found the corresponding issue on the TSX side as well:
reserved/contextual keywords in JSX/TSX tag names and attribute names no longer parse correctly.

Examples I used include:

  • <Element<T>>hi</Element>
  • <class />
  • <svg:true />
  • <Foo.class />
  • <a await="z" />

I also hit this in JSX inside object property values with attributes like for and const.

I fixed this on top of your branch here:
SegaraRai@3107ef3

Please feel free to reuse or cherry-pick that commit if helpful. I validated this locally against the affected TSX corpus cases, but I did not run the full CI matrix.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update tree-sitter-javascript to 0.25.0

2 participants