I am trying to configure eslint for my svelte project.
Here is my .eslintrc.json:
{
"env": {
"es6": true,
"jest": true
},
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:import/typescript"
],
"plugins": ["svelte3"],
"overrides": [
{
"files": ["**/*.svelte"],
"processor": "svelte3/svelte3"
}
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"modules": true
},
"ecmaVersion": 2019,
"sourceType": "module",
"extraFileExtensions": [".svelte"]
},
"settings": {
"import/resolver": {
"typescript": {}
}
}
}
I have configured rollback, and it works fine, but eslint gives me "Identifier is expected" whenever I am trying to use typescript typing.
Will be added support for typescript and most popular css preprocessors (sass, scss, less)?
For example we could defined typescript script this way:
<script type="typescript">
</script>
And style:
<style type="less">
</style>
You can achieve this by using a preprocessor like svelte-preprocess.
@PatrickG I have used it, and rollup compiles everything without a problem, but eslint returns me syntax errors, whenever I use typescript syntax inside svelte component.
With the svelte.config.js?
Svelte doesn't officially support Typescript yet, and github issues is not the right place for eslint support questions. Please come and chat to us in https://svelte.dev/chat where we will be able to assist you better.
Svelte officially support TypeScript, let's resolve issues with ESLint against Svelte
Most helpful comment
Svelte officially support TypeScript, let's resolve issues with ESLint against Svelte