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

Support lang="ts" on all blocks except <template> #207

Open
Tahul opened this issue Sep 13, 2023 · 1 comment
Open

Support lang="ts" on all blocks except <template> #207

Tahul opened this issue Sep 13, 2023 · 1 comment

Comments

@Tahul
Copy link

Tahul commented Sep 13, 2023

As for now, I have been using <style lang="ts"> blocks for https://pinceau.dev

Most users complained that there is no way to get ESLint working in that context.

I already get syntax coloring and syntax checking from VSCode and TypeScript, as lang="ts" properly triggers it.

Now, I would like to make ESLint compatible with such blocks, whether they are <style> ones or any other <customBlock>.

As seen here, Vue supports customBlocks as any other SFCBlock, and so it supports lang="ts" attribute:
https://github.com/vuejs/core/blob/b775b71c788499ec7ee58bc2cf4cd04ed388e072/packages/compiler-sfc/src/parse.ts#L72C3-L72C15

Following a discussion with @ota-meshi, I will try to support lang="ts" in any other block.

With that feature, any lang="ts" block would be treated as an extension of <script> block and be appended to linted content as is.

That would mean it is not supported to redeclare the same variable name in both blocks, but I think it is expected behavior as a component can only output a single JS chunk anyways.

@Muratovnik
Copy link

Any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants