Skip to content

Commit

Permalink
✅ Update Svelte ESLint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Frontendland committed Dec 13, 2024
1 parent c81ec2a commit 0212016
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"svelte.plugin.svelte.compilerWarnings": {},
"svelte.plugin.svelte.compilerWarnings": {
"element_invalid_self_closing_tag": "ignore"
},
"eslint.validate": [
"svelte"
],
Expand Down
4 changes: 3 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import svelteParser from 'svelte-eslint-parser'
import svelteConfig from './svelte.config.js'

import js from '@eslint/js'
import tsParser from '@typescript-eslint/parser'
Expand Down Expand Up @@ -212,7 +213,8 @@ export default [
languageOptions: {
parser: svelteParser,
parserOptions: {
parser: tsParser
parser: tsParser,
svelteConfig
}
},
rules: {
Expand Down
6 changes: 5 additions & 1 deletion src/components/Menu/Menu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@
</ConditionalWrapper>

{#if items?.length}
<button class={styles.hamburger} on:click={toggleMenu}>
<button
class={styles.hamburger}
on:click={toggleMenu}
aria-label="menu"
>
<span class={styles.meat}></span>
<span class={styles.meat}></span>
<span class={styles.meat}></span>
Expand Down
1 change: 1 addition & 0 deletions src/components/Pagination/Pagination.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
{#each generatedPages as _, index}
<li>
<button
aria-label={`page ${index + 1}`}
data-active={calculatedCurrentPage === index + 1 ? 'true' : null}
on:click={calculatedCurrentPage !== index + 1
? () => paginate(index + 1)
Expand Down
6 changes: 4 additions & 2 deletions svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ import { vitePreprocess } from '@astrojs/svelte'
export default {
preprocess: vitePreprocess(),
onwarn: (warning, handler) => {
// Suppress false positive warnings in terminal
// Suppress false positive warnings in terminal and eslint
// Edit .vscode/settings.json to also suppress warnings in VSCode
const ignoreWarnings = []
const ignoreWarnings = [
'element_invalid_self_closing_tag'
]

const warningText = [
warning.code,
Expand Down

0 comments on commit 0212016

Please sign in to comment.