Skip to content

refactor(ast/estree): add regex and bigint fields to all Literal nodes in ESTree AST#10877

Closed
overlookmotel wants to merge 1 commit intomainfrom
05-07-refactor_ast_estree_add_regex_and_bigint_fields_to_all_literal_nodes_in_estree_ast
Closed

refactor(ast/estree): add regex and bigint fields to all Literal nodes in ESTree AST#10877
overlookmotel wants to merge 1 commit intomainfrom
05-07-refactor_ast_estree_add_regex_and_bigint_fields_to_all_literal_nodes_in_estree_ast

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented May 7, 2025

Add regex and bigint fields to all Literal nodes, so all Literals have a consistent object shape.

Bump acorn-test262, which performs the some alterations to AST in the test fixtures in oxc-project/estree-conformance#28.

This is a divergence from both Acorn and TS-ESLint, but in my opinion it's likely a good idea regardless.

@github-actions github-actions bot added A-ast Area - AST C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels May 7, 2025
Copy link
Member Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

Base automatically changed from 05-07-fix_ast_estree_fix_ts_type_def_for_regexpliteral_ to main May 7, 2025 18:10
@overlookmotel
Copy link
Member Author

overlookmotel commented May 7, 2025

Actually... is this a good idea?

I figured adding a field that ESTree doesn't have wouldn't break any user code - like TS-ESLint adds more fields to the AST. But... people might test for whether a Literal is a regexp with Object.hasOwn(node, "regex"). Previously that'd return false for e.g. a StringLiteral, but now it'd return true.

🤔

@codspeed-hq
Copy link

codspeed-hq bot commented May 7, 2025

CodSpeed Instrumentation Performance Report

Merging #10877 will create unknown performance changes

Comparing 05-07-refactor_ast_estree_add_regex_and_bigint_fields_to_all_literal_nodes_in_estree_ast (ec8e337) with main (581d068)

Summary

🆕 36 new benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
🆕 codegen[checker.ts] N/A 22.2 ms N/A
🆕 codegen_sourcemap[checker.ts] N/A 65.2 ms N/A
🆕 formatter[antd.js] N/A 714.4 ms N/A
🆕 formatter[react.development.js] N/A 8.1 ms N/A
🆕 formatter[typescript.js] N/A 1.1 s N/A
🆕 isolated-declarations[vue-id.ts] N/A 58.4 ms N/A
🆕 lexer[RadixUIAdoptionSection.jsx] N/A 21.6 µs N/A
🆕 lexer[antd.js] N/A 24.1 ms N/A
🆕 lexer[cal.com.tsx] N/A 5.8 ms N/A
🆕 lexer[checker.ts] N/A 14.4 ms N/A
🆕 lexer[pdf.mjs] N/A 3.9 ms N/A
🆕 linter[RadixUIAdoptionSection.jsx] N/A 2.7 ms N/A
🆕 linter[cal.com.tsx] N/A 1.2 s N/A
🆕 linter[checker.ts] N/A 3.1 s N/A
🆕 mangler[antd.js] N/A 16 ms N/A
🆕 mangler[react.development.js] N/A 293.8 µs N/A
🆕 mangler[typescript.js] N/A 39.6 ms N/A
🆕 minifier[antd.js] N/A 164.4 ms N/A
🆕 minifier[react.development.js] N/A 1.8 ms N/A
🆕 minifier[typescript.js] N/A 288.7 ms N/A
... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

@overlookmotel
Copy link
Member Author

Actually... is this a good idea?

Upon reflection, no it's not! Closing.

@Boshen Boshen deleted the 05-07-refactor_ast_estree_add_regex_and_bigint_fields_to_all_literal_nodes_in_estree_ast branch August 30, 2025 05:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast Area - AST C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant