mirror of https://github.com/sveltejs/svelte
feat: add ability to ignore warnings through compiler option (#12296)
* feat: add ability to ignore warnings through compiler option Some people want to disable certain warnings for their whole application without having to add svelte-ignore comments everywhere. This new option makes that possible. closes #9188 part of https://github.com/sveltejs/language-tools/issues/650 * make it a function * singular * warningFilter * make internal filter non-nullable * Update .changeset/little-seals-reflect.md * filter_warning -> warning_filter, for symmetry with public option * fix --------- Co-authored-by: Rich Harris <rich.harris@vercel.com>pull/12456/head
parent
c92620dcbe
commit
d9569d052e
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
feat: add ability to ignore warnings through `warningFilter` compiler option
|
@ -0,0 +1,8 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
compileOptions: {
|
||||
warningFilter: (warning) =>
|
||||
!['a11y_missing_attribute', 'a11y_misplaced_scope'].includes(warning.code)
|
||||
}
|
||||
});
|
@ -0,0 +1,8 @@
|
||||
<div>
|
||||
<img src="this-is-fine.jpg" />
|
||||
<marquee>but this is still discouraged</marquee>
|
||||
</div>
|
||||
|
||||
<div scope></div>
|
||||
|
||||
<img src="potato.jpg" />
|
@ -0,0 +1,14 @@
|
||||
[
|
||||
{
|
||||
"code": "a11y_distracting_elements",
|
||||
"end": {
|
||||
"column": 49,
|
||||
"line": 3
|
||||
},
|
||||
"message": "Avoid `<marquee>` elements",
|
||||
"start": {
|
||||
"column": 1,
|
||||
"line": 3
|
||||
}
|
||||
}
|
||||
]
|
Loading…
Reference in new issue