Skip to content

Commit 5578474

Browse files
committed
fix to work with worker for vs-code eslint plugin
1 parent a2eeb74 commit 5578474

7 files changed

+9121
-174
lines changed

README.md

100644100755
+35-27
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22

33
## Purpose
44

5-
It's a preprocessor to use with [`eslint-plugin-svelte3`](https://github.com/sveltejs/eslint-plugin-svelte3) to produce AST valid to the original code.
5+
It's a preprocessor to use with
6+
[`eslint-plugin-svelte3`](https://github.com/sveltejs/eslint-plugin-svelte3) to
7+
produce AST valid to the original code.
68

7-
For now only TypeScript is supported but the idea is to add Coffeescript and Pug support, like the [`svelte-preprocess`](https://github.com/sveltejs/svelte-preprocess) package.
9+
For now only TypeScript is supported but the idea is to add Coffeescript and Pug
10+
support, like the
11+
[`svelte-preprocess`](https://github.com/sveltejs/svelte-preprocess) package.
812

9-
Many thanks to [Conduitry](https://github.com/Conduitry) and her/his initial work on her/his [fork](https://github.com/Conduitry/eslint-plugin-svelte3).
13+
Many thanks to [Conduitry](https://github.com/Conduitry) and her/his initial
14+
work on her/his [fork](https://github.com/Conduitry/eslint-plugin-svelte3).
1015

1116
## Install
1217

@@ -16,57 +21,60 @@ pnpm i -D eslint-svelte3-preprocess
1621

1722
## Usage
1823

19-
After following the docs of [`eslint-plugin-svelte3`](https://github.com/sveltejs/eslint-plugin-svelte3) to configure your `eslintrc.js` file, you will need to add some props required by [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser) and finally import your `svelte.config` file (if you would like to use the same configuration) and call the `elint-plugin-svelte3-preprocess` passing your preprocess as a parameter.
24+
x After following the docs of
25+
[`eslint-plugin-svelte3`](https://github.com/sveltejs/eslint-plugin-svelte3) to
26+
configure your `eslintrc.js` file, you will need to add some props required by
27+
[@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser)
28+
and finally import your `svelte.config` file (if you would like to use the same
29+
configuration) and call the `elint-plugin-svelte3-preprocess` passing your
30+
preprocess as a parameter.
2031

2132
This is a example that works!
2233

2334
```js
24-
const eslintSveltePreprocess = require('eslint-svelte3-preprocess');
25-
const svelteConfig = require('./svelte.config');
35+
const eslintSveltePreprocess = require("eslint-svelte3-preprocess");
36+
const svelteConfig = require("./svelte.config");
2637

2738
module.exports = {
2839
parserOptions: {
2940
ecmaVersion: 2019,
30-
sourceType: 'module',
41+
sourceType: "module",
3142
},
3243
parser: "@typescript-eslint/parser",
3344
env: {
3445
es6: true,
35-
browser: true
46+
browser: true,
3647
},
37-
extends: [
38-
"eslint:recommended",
39-
"plugin:@typescript-eslint/recommended",
40-
],
41-
plugins: [
42-
'svelte3',
43-
"@typescript-eslint",
44-
],
48+
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
49+
plugins: ["svelte3", "@typescript-eslint"],
4550
overrides: [
4651
{
47-
files: ['*.svelte'],
48-
processor: 'svelte3/svelte3',
49-
}
52+
files: ["*.svelte"],
53+
processor: "svelte3/svelte3",
54+
},
5055
],
5156
settings: {
52-
'svelte3/preprocess': eslintSveltePreprocess(svelteConfig.preprocess),
53-
},
57+
"svelte3/preprocess": eslintSveltePreprocess(svelteConfig.preprocess),
58+
},
5459
};
55-
5660
```
5761

5862
## Editor support
5963

60-
I only tested it on Visual Studio Code, but I guess it should be similar for other editors. If you find the way to solve it, I would appreciate your collaboration to improve this documentation.
64+
I only tested it on Visual Studio Code, but I guess it should be similar for
65+
other editors. If you find the way to solve it, I would appreciate your
66+
collaboration to improve this documentation.
6167

6268
### Visual Studio Code
6369

64-
Having [Svelte Beta](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode) and [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) extensions, you need to add this to your configuration.
70+
Having
71+
[Svelte for VS Code](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode)
72+
and
73+
[ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
74+
extensions, you need to add this to your configuration.
6575

6676
```json
6777
{
68-
"eslint.validate": [
69-
"svelte"
70-
]
78+
"eslint.validate": ["svelte"]
7179
}
7280
```

0 commit comments

Comments
 (0)