-
Notifications
You must be signed in to change notification settings - Fork 44
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
Typescript? #68
Comments
This is not supported currently, and is blocked by support for preprocessors (#10) at the very least. I don't know what else might be involved beyond that. |
@Conduitry could you review this? |
@abalmos check this, maybe would be useful for your case |
Is there any news on this? If I understand correctly there is currently no way to get TS and es-lint working together in svelte files? |
So I currently setup .eslintrc
in .vscode
problem is, If I add eslint to Is it correct , or is there a trick to have linted typescript svelte file ? |
Hello, has there been any movement on this issue? We would very much like to use eslint with typescript in our project. |
We are using the following setup to allow eslint in typescript svelte projects (maybe it helps - if I remember correctly this setup allows for most typescript rules in svelte - check the rule section for which ones don't work):
|
@IgnusG Is it possible that you create a gist for your patch file? |
@ps73 Here you go https://gist.github.com/IgnusG/8d0b6271a294a263b4185a959d8b77e0
All credit goes to @NicoCevallos |
@IgnusG I'm not having much luck getting this to actually check svelte files unless I include Would you mind also posting your |
An actual deal-breaker for our team. Not being able to use TS + Eslint + Prettier without experimental patches is a clear no-no – as much as I enjoyed using svelte feature-wise. Subscribed, hoping very much for a hero to implement this. |
I'd love to see this fixed. I really want to use svelte in my next project but the lack of eslint support with typescript is holding me back! |
@alexfoxy You'll find information on how to make it work in #62 comments. TL;DR: Start with https://github.com/NicoCevallos/svelte-template and apply the code in https://gist.github.com/gustavopch/134513fa7c1f30050e968b5570c26994. |
@gustavopch thanks for the tip |
Hello Team, any updates regarding this fix? I see that 3.0 has been published but still seeing errors from eslint. Thanks! |
Any news on when this plugin will work with typescript without custom patches? |
I applied the custom patches but now, eslint takes absolutely forever to format anything: https://www.loom.com/share/651ae074b3774cc2be14fc16cf28da0e. Anyone else have this issue? Here's the repo I'm trying to format: https://github.com/swiftwinds/recommeddit-frontend |
EDIT: after applying the mentioned gist: https://gist.github.com/gustavopch/134513fa7c1f30050e968b5570c26994, it's a little less unbearable: https://www.loom.com/share/17b37bf96fbd4e22bc422b023f400635. Still, eslint formatting takes about 5 seconds, which is really slow. |
@SwiftWinds Are you using type-aware rules? I don't know why, but they are slow with {
files: ['**/*.ts?(x)'],
// This will include Svelte files, so don't use type-aware rules here
},
{
files: ['**/!(*.svelte)/*.ts'],
// This will exclude Svelte files, so you can use type-aware rules here
}, Read this for more info on why the first glob includes Svelte files even though they use |
Closes sveltejs#68 This does not introduce a generic preprocessor-option. Instead it provides a TypeScript-specific implementation. The advantage is that we don't need hacks like deasync because transpilation and mapping can happen synchronously. It also makes post-processing and interaction with ESLint easier. How it works: 1. transpile script contents from TS to JS 2. compile result to get Svelte compiler warnings 3. map those warnings back to its original positions 4. blank script contents 5. compile again to get the AST with original positions in the markdown part 6. use AST of step 5, vars of step 2 and blanked script content to produce the text which is handed to ESLint 7. Let the ESLint TypeScript plugin handle the TS code 8. adjust mappings
This won’t work correctly until <sveltejs/eslint-plugin-svelte3#68> is resolved.
This won’t work correctly until <sveltejs/eslint-plugin-svelte3#68> is resolved.
This won’t work correctly until <sveltejs/eslint-plugin-svelte3#68> is resolved.
I hope this isn't too much noise--I'm having some trouble stitching together Svelte Typescript support and I can not tell if it is a configuration issue or if I'm just ahead of support. Should this plugin be compatible with Typescript?
I've tried the below eslintrc.js (and others). It appears eslint is still trying to parse the
<script lang="ts>
block with a Javascript parser.If support is not ready, do you have an pointers on how I might try and contribute that?
The text was updated successfully, but these errors were encountered: