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

feat: Add Svelte and Vue parsers to oxc #8171

Open
baseballyama opened this issue Dec 29, 2024 · 0 comments
Open

feat: Add Svelte and Vue parsers to oxc #8171

baseballyama opened this issue Dec 29, 2024 · 0 comments
Labels
C-enhancement Category - New feature or request

Comments

@baseballyama
Copy link
Contributor

baseballyama commented Dec 29, 2024

Background

Currently oxlint only supports the <script> part of the svelte/vue file.
This is useful, but the no_unused_vars rule, for example, does not work correctly. Therefore, the rule itself must be turned off at this time. (I've created #8170)

For example, the following code will report no_unused_vars error but this is false positive.

<script>
// Svelte component
let foo = $state(0);
</script>

{foo}

By adding support for Svelte and Vue, we can solve these issues and provide nicer linting and formatting.

Proposal

This proposal aims to achieve the following goals:

  1. Add Svelte Parser: Introduce a parser that supports Svelte 5. The goal is to make the parser available as an external package at this stage (for example, use it from inclusion-vapor).
  2. Migrate eslint-plugin-svelte: Gradually migrate rules related to Svelte 5.
  3. Support for Formatter: Once the rework of the formatter is complete, add support for Svelte files (this will likely involve migrating prettier-plugin-svelte).
  4. Vue Support: If the approach works well for Svelte, expand it to support Vue as well.

Out of Scope

At this stage, migrating the Svelte compiler itself is out of scope.

Additional Notes

The current documentation states that there are no plans to officially support eslint-plugin-svelte or eslint-plugin-vue. However, I believe this contribution can add value to oxc.

I plan to start working on this once I get a go sign from @Boshen or other core team members. (Since this is likely not part of void0's milestones, I intend to work on it gradually at my own pace.)
For the parser, I plan to submit small, incremental PRs rather than one large PR to make the process more manageable.
If there are any policies or guidelines regarding how to proceed, I’d appreciate it if you could share them with me.

(I am a member of the Svelte core team and the maintainer of eslint-plugin-svelte and svelte-eslint-parser, so I believe I am relatively well-suited to take on this task.)

@baseballyama baseballyama added the C-enhancement Category - New feature or request label Dec 29, 2024
@baseballyama baseballyama changed the title feat: Add Svelte and Vue Parsers to Oxc feat: Add Svelte and Vue Parsers to xxc Dec 29, 2024
@baseballyama baseballyama changed the title feat: Add Svelte and Vue Parsers to xxc feat: Add Svelte and Vue Parsers to oxc Dec 29, 2024
@baseballyama baseballyama changed the title feat: Add Svelte and Vue Parsers to oxc feat: Add Svelte and Vue parsers to oxc Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category - New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant