You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/rules/valid-compile.md
+39
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,45 @@ This rule uses Svelte compiler to check the source code.
37
37
38
38
Note that we exclude reports for some checks, such as `missing-declaration`, and `dynamic-slot-name`, which you can check with different ESLint rules.
39
39
40
+
### Using `svelte.config.js`
41
+
42
+
If you want to suppress messages using [`onwarn` like `vite-plugin-svelte`](https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/config.md#onwarn), Use `eslint.config.js` and specify the information in `svelte.config.js` in your parser configuration.
43
+
44
+
```js
45
+
importsvelteConfigfrom'./svelte.config.js';
46
+
exportdefault [
47
+
// ...
48
+
{
49
+
files: ['**/*.svelte', '*.svelte'],
50
+
languageOptions: {
51
+
parserOptions: {
52
+
svelteConfig: svelteConfig
53
+
}
54
+
}
55
+
}
56
+
];
57
+
```
58
+
59
+
See also [User Guide > Specify `svelte.config.js`](../user-guide.md#specify-svelte-config-js)
60
+
61
+
#### onwarn
62
+
63
+
This rule can use [`onwarn` like `vite-plugin-svelte`](https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/config.md#onwarn).
64
+
65
+
Example:
66
+
67
+
```js
68
+
// svelte.config.js
69
+
exportdefault {
70
+
onwarn: (warning, handler) => {
71
+
if (warning.code==='a11y-distracting-elements') return;
72
+
if (warning.code==='a11y_distracting_elements') return; // for Svelte v5
0 commit comments