Skip to content
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

fix: assign actual runes value to SvelteParseContext #633

Merged
merged 3 commits into from
Jan 12, 2025

Conversation

baseballyama
Copy link
Member

No description provided.

Copy link

changeset-bot bot commented Jan 12, 2025

🦋 Changeset detected

Latest commit: 6de6d8d

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 Patch

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

Copy link

pkg-pr-new bot commented Jan 12, 2025

Open in Stackblitz

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

commit: 6de6d8d

@baseballyama baseballyama marked this pull request as draft January 12, 2025 04:38
@baseballyama baseballyama force-pushed the fix/runes-in-SvelteParseContext branch from 83a4ff3 to 9ecc8be Compare January 12, 2025 06:13
@coveralls
Copy link

coveralls commented Jan 12, 2025

Pull Request Test Coverage Report for Build 12731320009

Details

  • 65 of 71 (91.55%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.04%) to 94.71%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/parser/svelte-parse-context.ts 60 66 90.91%
Totals Coverage Status
Change from base Build 12626215623: -0.04%
Covered Lines: 10302
Relevant Lines: 10754

💛 - Coveralls

@baseballyama baseballyama marked this pull request as ready for review January 12, 2025 06:46
Comment on lines +120 to +121
(parserOptions.filePath.endsWith(".svelte.js") ||
parserOptions.filePath.endsWith(".svelte.ts"))
Copy link
Member Author

Choose a reason for hiding this comment

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

I think only js and ts file can be svelte script file. So I think we can make the terms simpler.

https://svelte.dev/docs/svelte/svelte-js-files

@baseballyama
Copy link
Member Author

Merge this because I need this for sveltejs/eslint-plugin-svelte#1006

@baseballyama baseballyama merged commit 1178032 into main Jan 12, 2025
13 checks passed
@baseballyama baseballyama deleted the fix/runes-in-SvelteParseContext branch January 12, 2025 06:56
@KieranP
Copy link

KieranP commented Jan 13, 2025

@baseballyama This change (released in 1.0.0-next.7) has started causing a bunch of lint issues (pasted below) where previously things were working fine with 1.0.0-next.6. These errors appear to erroneous.

   24:7   error  Unsafe assignment of an error typed value                                                   @typescript-eslint/no-unsafe-assignment
   24:21  error  Unsafe call of a(n) `error` type typed value                                                @typescript-eslint/no-unsafe-call
   25:7   error  Unsafe assignment of an error typed value                                                   @typescript-eslint/no-unsafe-assignment
   25:21  error  Unsafe call of a(n) `error` type typed value                                                @typescript-eslint/no-unsafe-call
   26:7   error  Unsafe assignment of an error typed value                                                   @typescript-eslint/no-unsafe-assignment
   26:17  error  Unsafe call of a(n) `error` type typed value                                                @typescript-eslint/no-unsafe-call
   27:7   error  Unsafe assignment of an error typed value                                                   @typescript-eslint/no-unsafe-assignment
   27:18  error  Unsafe call of a(n) `error` type typed value                                                @typescript-eslint/no-unsafe-call
   28:7   error  Unsafe assignment of an error typed value                                                   @typescript-eslint/no-unsafe-assignment
   28:15  error  Unsafe call of a(n) `error` type typed value                                                @typescript-eslint/no-unsafe-call
   82:29  error  Unsafe assignment of an error typed value                                                   @typescript-eslint/no-unsafe-assignment
  154:7   error  Unsafe call of a(n) `error` type typed value                                                @typescript-eslint/no-unsafe-call
  154:19  error  Unsafe member access .push on an `error` typed value                                        @typescript-eslint/no-unsafe-member-access
  155:7   error  Unsafe call of a(n) `error` type typed value                                                @typescript-eslint/no-unsafe-call
  155:19  error  Unsafe member access .sort on an `error` typed value                                        @typescript-eslint/no-unsafe-member-access
  156:32  error  Unsafe argument of type `any` assigned to a parameter of type `string | number | Date`      @typescript-eslint/no-unsafe-argument
  156:34  error  Unsafe member access .publishedAt on an `any` value                                         @typescript-eslint/no-unsafe-member-access
  157:32  error  Unsafe argument of type `any` assigned to a parameter of type `string | number | Date`      @typescript-eslint/no-unsafe-argument
  157:34  error  Unsafe member access .publishedAt on an `any` value                                         @typescript-eslint/no-unsafe-member-access
  227:11  error  Unsafe assignment of an error typed value                                                   @typescript-eslint/no-unsafe-assignment
  227:24  error  Unsafe call of a(n) `error` type typed value                                                @typescript-eslint/no-unsafe-call
  227:36  error  Unsafe member access .find on an `error` typed value                                        @typescript-eslint/no-unsafe-member-access
  227:62  error  Unsafe member access .id on an `any` value                                                  @typescript-eslint/no-unsafe-member-access
  229:9   error  Unexpected any value in conditional. An explicit comparison or type conversion is required  @typescript-eslint/strict-boolean-expressions
  230:18  error  Unsafe member access .descriptionHTML on an `error` typed value                             @typescript-eslint/no-unsafe-member-access

Consider the first one, line 24, column 7. The line in question is:

let githubToken = $state<string | null>(null)

As far as I can tell, this is a perfectly normal way to declare $state

Code is here: https://github.com/KieranP/Github-Releases-Feed

Just bump "svelte-eslint-parser" in package.json and run yarn lint to see the issues appear.

@baseballyama
Copy link
Member Author

@KieranP

Thank you for the report. It certainly occurs. I will investigate this.

@baseballyama
Copy link
Member Author

@KieranP Can you try to use 1.0.0-next.10? I believe this issue is fixed.

@KieranP
Copy link

KieranP commented Jan 13, 2025

@baseballyama Appears to be working correctly with next.10. Thanks

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