Skip to content

feat: support {@attach ...} #714

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 15, 2025
Merged

feat: support {@attach ...} #714

merged 4 commits into from
May 15, 2025

Conversation

baseballyama
Copy link
Member

@baseballyama baseballyama commented May 14, 2025

Copy link

changeset-bot bot commented May 14, 2025

🦋 Changeset detected

Latest commit: 74351f7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
svelte-eslint-parser Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coveralls
Copy link

coveralls commented May 14, 2025

Pull Request Test Coverage Report for Build 15033208451

Details

  • 49 of 49 (100.0%) changed or added relevant lines in 4 files are covered.
  • 18 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.07%) to 94.741%

Files with Coverage Reduction New Missed Lines %
src/parser/converts/attr.ts 18 94.29%
Totals Coverage Status
Change from base Build 14806682841: 0.07%
Covered Lines: 10554
Relevant Lines: 11017

💛 - Coveralls

Copy link
Contributor

github-actions bot commented May 14, 2025

Try the Instant Preview in Online Playground

ESLint Online Playground

Install the Instant Preview to Your Local

npm i https://pkg.pr.new/svelte-eslint-parser@74351f7

Published Instant Preview Packages:

View Commit

@baseballyama baseballyama marked this pull request as ready for review May 14, 2025 23:39
@baseballyama baseballyama requested a review from ota-meshi May 14, 2025 23:39
@baseballyama
Copy link
Member Author

@ota-meshi This is my first time adding support for a new Node in the parser, so could you check if I missed anything?

Copy link
Member

@ota-meshi ota-meshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!!! Looks almost good!

I have made two comments so could you please make some easy fixes?

Also could you please add some documentation explaining that the new node indicates {@attach}?
https://github.com/sveltejs/svelte-eslint-parser/blob/main/docs/AST.md#directives

@@ -203,6 +203,12 @@ export interface AttributeShorthand extends BaseNode {
type: "AttributeShorthand";
expression: ESTree.Identifier;
}

export interface AttachTag extends BaseNode {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is an AST type for Svelte v4, so there is no need to add it here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see!

},
{
"type": "Punctuator",
"value": "@",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The @attach token is not valid. Please refer to the implementation of @const and @html 😉

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh I missed this point!

@baseballyama baseballyama requested a review from ota-meshi May 15, 2025 01:57
Copy link
Member

@ota-meshi ota-meshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks perfect! Thank you!

@ota-meshi ota-meshi merged commit 855af3b into main May 15, 2025
12 checks passed
@ota-meshi ota-meshi deleted the feat/attachments branch May 15, 2025 03:49
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.

3 participants