Skip to content

Conversation

@Boshen
Copy link
Member

@Boshen Boshen commented Apr 16, 2025

closes #10409

Copy link
Member Author

Boshen commented Apr 16, 2025


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.

@github-actions github-actions bot added A-parser Area - Parser C-bug Category - Bug labels Apr 16, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Apr 16, 2025

CodSpeed Instrumentation Performance Report

Merging #10438 will not alter performance

Comparing 04-16-fix_parser_adjust_class_start_position_when_decorators_are_involved (58ab8ff) with main (93b8e86)

Summary

✅ 36 untouched benchmarks

@Boshen Boshen force-pushed the 04-16-fix_parser_adjust_class_start_position_when_decorators_are_involved branch from 1b8b64d to 39540f7 Compare April 16, 2025 08:56
@github-actions github-actions bot added the A-linter Area - Linter label Apr 16, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Apr 16, 2025

Merge activity

@graphite-app graphite-app bot force-pushed the 04-16-fix_parser_adjust_class_start_position_when_decorators_are_involved branch from 39540f7 to 58ab8ff Compare April 16, 2025 09:03
@graphite-app graphite-app bot merged commit 58ab8ff into main Apr 16, 2025
29 checks passed
@graphite-app graphite-app bot deleted the 04-16-fix_parser_adjust_class_start_position_when_decorators_are_involved branch April 16, 2025 09:09
graphite-app bot pushed a commit that referenced this pull request Apr 16, 2025
…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 bot pushed a commit that referenced this pull request Apr 17, 2025
#10449)

#10438 altered span of `Class` so it starts later in the case of `@dec export class C {}` and `@dec export default class {}`.

Update `Utf8ToUtf16Converter` to handle this odd case, and visit decorators before the `export` keyword before processing the span start of `ExportNamedDeclaration` / `ExportDefaultDeclaration`, so that span offsets are still processed in ascending order.
This was referenced Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter A-parser Area - Parser C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Strange spans for exported classes with decorators

2 participants