Skip to content

svelteKitFileType parsing broken in Windows #1120

Closed
@james-camilleri

Description

@james-camilleri

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.

What version of ESLint are you using?

9.22.0

What version of eslint-plugin-svelte are you using?

3.0.3

What did you do?

I came across this issue while debugging the valid-prop-names-in-kit-pages rule, which always passed locally on my Windows machine but failed on my Cloudflare-hosted build. At first I thought it was a dependency issue, but I eventually realised the rule wasn't running on windows at all.

I eventually traced this to the svelteKitFileType in the svelteContext being null.

What did you expect to happen?

I expected the same rule to fail/pass the same way on my local machine as my Cloudflare build.

What actually happened?

Could not reproduce the same failure on my local machine.

Link to GitHub Repo with Minimal Reproducible Example

https://github.com/james-camilleri/eslint-plugin-svelte-repro

Additional comments

The problem is here:

const fileName = filePath.split('/').pop();

Switching this to path.sep seems to handle the issue. Not sure if there are any other repercussions to this though, or if the same issue is present anywhere else in the codebase. Or if the paths should have been normalised elsewhere but weren't.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions