Skip to content

fix(ast/estree): fix start span of Program in TS-ESTree AST where first statement is @dec export class C {}#10448

Merged
graphite-app[bot] merged 1 commit intomainfrom
04-16-fix_ast_estree_fix_start_span_of_program_in_ts-estree_ast_where_first_statement_is_dec_export_class_c_
Apr 16, 2025
Merged

fix(ast/estree): fix start span of Program in TS-ESTree AST where first statement is @dec export class C {}#10448
graphite-app[bot] merged 1 commit intomainfrom
04-16-fix_ast_estree_fix_start_span_of_program_in_ts-estree_ast_where_first_statement_is_dec_export_class_c_

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Apr 16, 2025

#10438 aligned the spans of @dec export class C {} and @dec export default class {} with TS-ESLint.

@dec export class C {}
     ^^^^^^^^^^^^^^^^^ ExportNamedDeclaration
            ^^^^^^^^^^ Class
^^^^                   Decorator

@dec export default class {}
     ^^^^^^^^^^^^^^^^^^^^^^^ ExportDefaultDeclaration
                    ^^^^^^^^ Class
^^^^                         Decorator

However, this causes a problem where one of these is the first statement in the file. In TS-ESTree, Program start is the start of the first token (excluding whitespace and comments). So we need to set Program start to the start of the decorator in these cases.

@github-actions github-actions bot added A-ast Area - AST C-bug Category - Bug labels Apr 16, 2025
Copy link
Member Author


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.

@overlookmotel overlookmotel marked this pull request as ready for review April 16, 2025 15:43
@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Apr 16, 2025
Copy link
Member Author

overlookmotel commented Apr 16, 2025

Merge activity

@codspeed-hq
Copy link

codspeed-hq bot commented Apr 16, 2025

CodSpeed Instrumentation Performance Report

Merging #10448 will not alter performance

Comparing 04-16-fix_ast_estree_fix_start_span_of_program_in_ts-estree_ast_where_first_statement_is_dec_export_class_c_ (77b6f7e) with main (a6b2232)

Summary

✅ 36 untouched benchmarks

…irst statement is `@dec export class C {}` (#10448)

#10438 aligned the spans of `@dec export class C {}` and `@dec export default class {}` with TS-ESLint.

```ts
@dec export class C {}
     ^^^^^^^^^^^^^^^^^ ExportNamedDeclaration
            ^^^^^^^^^^ Class
^^^^                   Decorator

@dec export default class {}
     ^^^^^^^^^^^^^^^^^^^^^^^ ExportDefaultDeclaration
                    ^^^^^^^^ Class
^^^^                         Decorator
```

However, this causes a problem where one of these is the first statement in the file. In TS-ESTree, `Program` start is the start of the first token (excluding whitespace and comments). So we need to set `Program` start to the start of the decorator in these cases.
@graphite-app graphite-app bot force-pushed the 04-16-fix_ast_estree_fix_start_span_of_program_in_ts-estree_ast_where_first_statement_is_dec_export_class_c_ branch from 3578759 to 77b6f7e Compare April 16, 2025 15:47
@graphite-app graphite-app bot merged commit 77b6f7e into main Apr 16, 2025
28 checks passed
@graphite-app graphite-app bot deleted the 04-16-fix_ast_estree_fix_start_span_of_program_in_ts-estree_ast_where_first_statement_is_dec_export_class_c_ branch April 16, 2025 15:54
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast Area - AST C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant