mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
feat(linter): disable no-unused-labels for svelte (#1919)
This commit is contained in:
parent
f2ed83ca3b
commit
c2e8ef56a5
2 changed files with 21 additions and 0 deletions
|
|
@ -1,5 +1,23 @@
|
|||
<script>
|
||||
debugger;
|
||||
|
||||
export let title;
|
||||
export let person;
|
||||
|
||||
// this will update `document.title` whenever
|
||||
// the `title` prop changes
|
||||
$: document.title = title;
|
||||
|
||||
$: {
|
||||
console.log(`multiple statements can be combined`);
|
||||
console.log(`the current title is ${title}`);
|
||||
}
|
||||
|
||||
// this will update `name` when 'person' changes
|
||||
$: ({ name } = person);
|
||||
|
||||
// don't do this. it will run before the previous line
|
||||
let name2 = name;
|
||||
</script>
|
||||
|
||||
<h1>Hello {name}!</h1>
|
||||
|
|
|
|||
|
|
@ -42,6 +42,9 @@ declare_oxc_lint!(
|
|||
|
||||
impl Rule for NoUnusedLabels {
|
||||
fn run_once(&self, ctx: &LintContext) {
|
||||
if ctx.file_path().extension().is_some_and(|ext| ext == "svelte") {
|
||||
return;
|
||||
}
|
||||
for id in ctx.semantic().unused_labels() {
|
||||
let node = ctx.semantic().nodes().get_node(*id);
|
||||
if let AstKind::LabeledStatement(stmt) = node.kind() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue