Skip to content

chore: fix tests to follow latest Svelte 5 #751

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions docs-svelte-kit/src/lib/components/ESLintPlayground.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,9 @@
<ol>
{#each messages as msg, i (`${msg.line}:${msg.column}:${msg.ruleId}@${i}`)}
<li class="message">
<!-- svelte-ignore a11y-invalid-attribute -->
<a href="#" on:click={(evt) => onClickMessage(evt, msg)} class="message-link"
>[{msg.line}:{msg.column}]</a
>:
<button on:click={(evt) => onClickMessage(evt, msg)} class="message-link">
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I resolved the warning.

[{msg.line}:{msg.column}]
</button>:
{msg.message}
<a
class="rule-link {getRule(msg.ruleId)?.classes}"
Expand Down Expand Up @@ -268,6 +267,12 @@
color: #8080f2;
}
.message-link {
background-color: transparent;
border: none;
cursor: pointer;
outline: none;
padding: 0;
appearance: none;
color: #40b3ff;
}
</style>
2 changes: 1 addition & 1 deletion docs-svelte-kit/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

<SideMenu {sidebarOpen} hiddenMenu={frontmatter.hiddenMenu} />

<!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
<!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
<main
class:hidden-menu={frontmatter.hiddenMenu}
on:click={sidebarOpen ? resetSidebarOpen : null}
Expand Down
3 changes: 2 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ const config = [
},
rules: {
'n/file-extension-in-import': 'off',
'n/no-unsupported-features/es-syntax': 'off'
'n/no-unsupported-features/es-syntax': 'off',
'n/no-unsupported-features/es-builtins': 'off'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I needed to disable n/no-unsupported-features/es-builtins for window.btoa.

}
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- svelte-ignore a11y-autofocus a11y-missing-attribute -->
<!-- svelte-ignore a11y_autofocus a11y_missing_attribute -->
<img src="foo" alt="Foo" />

<!-- svelte-ignore a11y-autofocus a11y-missing-attribute -->
<!-- svelte-ignore a11y_autofocus a11y_missing_attribute -->
<img src="foo" alt="Foo" autofocus />
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"svelte": ">=5.0.0-0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
- message: svelte-ignore comment is used, but not warned
line: 1
column: 20
suggestions: null
- message: svelte-ignore comment is used, but not warned
line: 1
column: 35
suggestions: null
- message: svelte-ignore comment is used, but not warned
line: 4
column: 35
suggestions: null
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!-- svelte-ignore a11y-autofocus a11y-missing-attribute -->
<img src="foo" alt="Foo" />

<!-- svelte-ignore a11y-autofocus a11y-missing-attribute -->
<img src="foo" alt="Foo" autofocus />
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"svelte": "^3.0.0 || ^4.0.0"
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div>
{#if true}
A
<!-- svelte-ignore a11y-label-has-associated-control a11y-no-noninteractive-tabindex -->
<!-- svelte-ignore a11y_label_has_associated_control a11y_no_noninteractive_tabindex -->
{:else}
<label tabindex="0">Click</label>
<ul tabindex="0"></ul>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"svelte": ">=5.0.0-0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- message: svelte-ignore comment is used, but not warned
line: 4
column: 22
suggestions: null
- message: svelte-ignore comment is used, but not warned
line: 4
column: 56
suggestions: null
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div>
{#if true}
A
<!-- svelte-ignore a11y-label-has-associated-control a11y-no-noninteractive-tabindex -->
{:else}
<label tabindex="0">Click</label>
<ul tabindex="0"></ul>
{/if}
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"svelte": "^3.0.0 || ^4.0.0"
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div>
{#each [] as e}
A
<!-- svelte-ignore a11y-label-has-associated-control a11y-no-noninteractive-tabindex -->
<!-- svelte-ignore a11y_label_has_associated_control a11y_no_noninteractive_tabindex -->
{:else}
<label tabindex="0">Click</label>
<ul tabindex="0"></ul>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"svelte": ">=5.0.0-0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- message: svelte-ignore comment is used, but not warned
line: 4
column: 22
suggestions: null
- message: svelte-ignore comment is used, but not warned
line: 4
column: 56
suggestions: null
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div>
{#each [] as e}
A
<!-- svelte-ignore a11y-label-has-associated-control a11y-no-noninteractive-tabindex -->
{:else}
<label tabindex="0">Click</label>
<ul tabindex="0"></ul>
{/each}
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"svelte": "^3.0.0 || ^4.0.0"
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<div>
{#await Promise.resolve(42)}
<!-- svelte-ignore a11y-label-has-associated-control a11y-no-noninteractive-tabindex -->
<!-- svelte-ignore a11y_label_has_associated_control a11y_no_noninteractive_tabindex -->
{:then name}
<label tabindex="0">Click</label>
<ul tabindex="0"></ul>
<!-- svelte-ignore a11y-label-has-associated-control a11y-no-noninteractive-tabindex -->
<!-- svelte-ignore a11y_label_has_associated_control a11y_no_noninteractive_tabindex -->
{:catch name}
<label tabindex="0">Click</label>
<ul tabindex="0"></ul>
{/await}
</div>
<div>
{#await Promise.resolve(42)}
<!-- svelte-ignore a11y-label-has-associated-control a11y-no-noninteractive-tabindex -->
<!-- svelte-ignore a11y_label_has_associated_control a11y_no_noninteractive_tabindex -->
{:then name}
<label tabindex="0">Click</label>
<ul tabindex="0"></ul>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"svelte": ">=5.0.0-0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
- message: svelte-ignore comment is used, but not warned
line: 3
column: 22
suggestions: null
- message: svelte-ignore comment is used, but not warned
line: 3
column: 56
suggestions: null
- message: svelte-ignore comment is used, but not warned
line: 7
column: 22
suggestions: null
- message: svelte-ignore comment is used, but not warned
line: 7
column: 56
suggestions: null
- message: svelte-ignore comment is used, but not warned
line: 15
column: 22
suggestions: null
- message: svelte-ignore comment is used, but not warned
line: 15
column: 56
suggestions: null
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<div>
{#await Promise.resolve(42)}
<!-- svelte-ignore a11y-label-has-associated-control a11y-no-noninteractive-tabindex -->
{:then name}
<label tabindex="0">Click</label>
<ul tabindex="0"></ul>
<!-- svelte-ignore a11y-label-has-associated-control a11y-no-noninteractive-tabindex -->
{:catch name}
<label tabindex="0">Click</label>
<ul tabindex="0"></ul>
{/await}
</div>
<div>
{#await Promise.resolve(42)}
<!-- svelte-ignore a11y-label-has-associated-control a11y-no-noninteractive-tabindex -->
{:then name}
<label tabindex="0">Click</label>
<ul tabindex="0"></ul>
{/await}
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"svelte": "^3.0.0 || ^4.0.0"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
- message: svelte-ignore comment is used, but not warned
line: 4
column: 19
suggestions: null
- message: svelte-ignore comment is used, but not warned
line: 7
column: 20
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
</script>

<!-- ✓ GOOD -->
<!-- svelte-ignore a11y-autofocus a11y-missing-attribute -->
<!-- svelte-ignore a11y_autofocus a11y_missing_attribute -->
<img src="https://example.com/img.png" autofocus />

<!-- ✗ BAD -->
<!-- svelte-ignore a11y-autofocus a11y-missing-attribute -->
<!-- svelte-ignore a11y_autofocus a11y_missing_attribute -->
<img src="https://example.com/img.png" alt="Foo" />

<div class="foo">
<div class="bar" />
</div>

<!-- svelte-ignore css-unused-selector -->
<!-- svelte-ignore css_unused_selector -->
<style lang="postcss">
.foo {
height: 20px;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"svelte": ">=5.0.0-0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
- message: svelte-ignore comment is used, but not warned
line: 9
column: 20
suggestions: null
- message: svelte-ignore comment is used, but not warned
line: 9
column: 35
suggestions: null
- message: svelte-ignore comment is used, but not warned
line: 16
column: 20
suggestions: null
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<script>
</script>

<!-- ✓ GOOD -->
<!-- svelte-ignore a11y-autofocus a11y-missing-attribute -->
<img src="https://example.com/img.png" autofocus />

<!-- ✗ BAD -->
<!-- svelte-ignore a11y-autofocus a11y-missing-attribute -->
<img src="https://example.com/img.png" alt="Foo" />

<div class="foo">
<div class="bar" />
</div>

<!-- svelte-ignore css-unused-selector -->
<style lang="postcss">
.foo {
height: 20px;
width: 20px;
& .bar {
height: 10px;
width: 10px;
}
}
</style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"svelte": "^3.0.0 || ^4.0.0"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
<!-- svelte-ignore a11y_no_noninteractive_tabindex -->
<span tabindex="0">
<span class="element"></span>
</span>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"svelte": ">=5.0.0-0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
<span tabindex="0">
<span class="element"></span>
</span>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"svelte": "^3.0.0 || ^4.0.0"
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<!-- svelte-ignore a11y-autofocus a11y-missing-attribute -->
<!-- svelte-ignore a11y_autofocus a11y_missing_attribute -->
<img src="foo" autofocus />
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"svelte": ">=5.0.0-0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!-- svelte-ignore a11y-autofocus a11y-missing-attribute -->
<img src="foo" autofocus />
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"svelte": "^3.0.0 || ^4.0.0"
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script>
let count = $state(0);
let doubled = $derived(count * 2);
// svelte-ignore static-state-reference
// svelte-ignore state_referenced_locally
console.log(count);
// svelte-ignore static-state-reference
// svelte-ignore state_referenced_locally
console.log(doubled);
</script>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- svelte-ignore a11y-label-has-associated-control a11y-no-noninteractive-tabindex -->
<!-- svelte-ignore a11y_label_has_associated_control a11y_no_noninteractive_tabindex -->
<div class="dropdown">
<label tabindex="0">Click</label>
<ul tabindex="0"></ul>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"svelte": ">=5.0.0-0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!-- svelte-ignore a11y-label-has-associated-control a11y-no-noninteractive-tabindex -->
<div class="dropdown">
<label tabindex="0">Click</label>
<ul tabindex="0"></ul>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"svelte": "^3.0.0 || ^4.0.0"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- svelte-ignore a11y-label-has-associated-control a11y-no-noninteractive-tabindex -->
TEXT
<!-- svelte-ignore a11y_label_has_associated_control a11y_no_noninteractive_tabindex -->
<div class="dropdown">
<label tabindex="0">Click</label>
<ul tabindex="0"></ul>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"svelte": ">=5.0.0-0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!-- svelte-ignore a11y-label-has-associated-control a11y-no-noninteractive-tabindex -->
TEXT
<div class="dropdown">
<label tabindex="0">Click</label>
<ul tabindex="0"></ul>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"svelte": "^3.0.0 || ^4.0.0"
}
Loading
Loading