Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#10)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/codespell-project/codespell: v2.2.4 → v2.2.5](codespell-project/codespell@v2.2.4...v2.2.5)
- [github.com/pre-commit/mirrors-eslint: v8.43.0 → v8.44.0](pre-commit/mirrors-eslint@v8.43.0...v8.44.0)

* bump prettier to v3

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Janosh Riebesell <janosh.riebesell@gmail.com>
  • Loading branch information
pre-commit-ci[bot] and janosh committed Jul 8, 2023
1 parent b773a0e commit fea79e0
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 26 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0-alpha.9-for-vscode
rev: v3.0.0
hooks:
- id: prettier
args: [--write] # edit files in-place
Expand All @@ -29,14 +29,14 @@ repos:
- svelte

- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
rev: v2.2.5
hooks:
- id: codespell
stages: [commit, commit-msg]
args: [--ignore-words-list, falsy]

- repo: https://github.com/pre-commit/mirrors-eslint
rev: v8.43.0
rev: v8.44.0
hooks:
- id: eslint
types: [file]
Expand Down
2 changes: 1 addition & 1 deletion src/app.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<title>Svelte Zoo</title>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/actions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export function sortable(
node: HTMLElement,
{ header_selector = `thead th` } = {}
{ header_selector = `thead th` } = {},
) {
// this action can be applied to bob-standard HTML tables to make them sortable by
// clicking on column headers (and clicking again to toggle sorting direction)
Expand Down
2 changes: 1 addition & 1 deletion src/lib/stores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type StorageType = 'localStorage' | 'sessionStorage'
export function persisted_store<T>(
name: string,
initial: T,
type: StorageType = `localStorage`
type: StorageType = `localStorage`,
) {
function set_storage_val(name: string, val: T, type: StorageType) {
if (typeof window !== `undefined`) {
Expand Down
2 changes: 1 addition & 1 deletion svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const rehypePlugins = [
`svg`,
{ width: 16, height: 16, viewBox: `0 0 16 16` },
// symbol #octicon-link defined in app.html
s(`use`, { 'xlink:href': `#octicon-link` })
s(`use`, { 'xlink:href': `#octicon-link` }),
),
},
],
Expand Down
6 changes: 3 additions & 3 deletions tests/CodeExample.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test.each([[true, false]])(
await tick()
expect(document.querySelector(`pre.open`)).toBeInstanceOf(HTMLElement)
}
}
},
)

test(`calls clipboard.writeText with src when clicking the copy button`, () => {
Expand Down Expand Up @@ -73,7 +73,7 @@ test.each([
const code_links = document.querySelector(`aside`)
expect(
code_links?.querySelectorAll(`a`),
code_links?.innerHTML
code_links?.innerHTML,
).toHaveLength(n_expected)
}
},
)
6 changes: 3 additions & 3 deletions tests/CodeLinks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ describe.each([[true], [file]] as const)(
}
const repo_handle = repo.split(`/`).slice(-2).join(`/`)
const stackblitz_link = doc_query(
`a[href*='https://stackblitz.com/github/${repo_handle}${url_params}']`
`a[href*='https://stackblitz.com/github/${repo_handle}${url_params}']`,
)
expect(stackblitz_link).toBeInstanceOf(HTMLAnchorElement)
})
}
},
)

test.each([[`_blank`], [`_self`]] as const)(
Expand All @@ -40,5 +40,5 @@ test.each([[`_blank`], [`_self`]] as const)(
for (const link of document.querySelectorAll(`a`)) {
expect(link.target, `${link} has wrong target`).toBe(target)
}
}
},
)
4 changes: 2 additions & 2 deletions tests/Confetti.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ describe(`Confetti`, () => {
const wrapper = doc_query(`div`)
expect(wrapper.children.length).toBe(n_items ?? 50)
expect(new Set(wrapper.textContent)).toStrictEqual(
new Set([`✨`, ` `, `🥳`, `🎉`])
new Set([`✨`, ` `, `🥳`, `🎉`]),
)
}
},
)
})
4 changes: 2 additions & 2 deletions tests/GitHubCorner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ test.each([

expect(
doc_query(
`a[href='${href}'][target='${target}'][title='${title}'][aria-label='${aria_label}']`
)
`a[href='${href}'][target='${target}'][title='${title}'][aria-label='${aria_label}']`,
),
).toBeInstanceOf(HTMLAnchorElement)
})
2 changes: 1 addition & 1 deletion tests/RadioButtons.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ test.each([[true], [false]])(
await tick()

expect(spy).toHaveBeenCalledTimes(disabled ? 0 : 1)
}
},
)
12 changes: 6 additions & 6 deletions tests/icons.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@ import { expect, test, vi } from 'vitest'

test(`all icons have fill="currentColor" and take $$props`, () => {
for (const [key, code] of Object.entries(
import.meta.glob(`$lib/icons/*.svelte`, { as: `raw`, eager: true })
import.meta.glob(`$lib/icons/*.svelte`, { as: `raw`, eager: true }),
)) {
expect(code, `${key} missing fill='currentColor'`).toContain(
`fill="currentColor"`
`fill="currentColor"`,
)
expect(code, `${key} missing $$props`).toContain(`{...$$props}`)
}
})

test(`all icons reference source"`, () => {
for (const [key, code] of Object.entries(
import.meta.glob(`$lib/icons/*.svelte`, { as: `raw`, eager: true })
import.meta.glob(`$lib/icons/*.svelte`, { as: `raw`, eager: true }),
)) {
expect(
code.startsWith(`<!-- https://icones.js.org/collection/all?s=`),
`${key} missing source`
`${key} missing source`,
).toBe(true)
}
})

test(`all icons have a viewBox`, () => {
for (const [key, code] of Object.entries(
import.meta.glob(`$lib/icons/*.svelte`, { as: `raw`, eager: true })
import.meta.glob(`$lib/icons/*.svelte`, { as: `raw`, eager: true }),
)) {
expect(code, `${key} missing viewBox`).toContain(`viewBox="0 0 `)
}
Expand All @@ -40,5 +40,5 @@ test.each([[``], [`foo`]])(

expect(console.error).toHaveBeenCalledOnce()
expect(console.error).toHaveBeenCalledWith(`Icon '${icon}' not found`)
}
},
)
4 changes: 2 additions & 2 deletions tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import { doc_query } from '.'

test(`src/lib/index.ts re-exports all Svelte components`, () => {
const components = Object.keys(import.meta.glob(`$lib/*.svelte`)).map(
(path) => path.split(`/`).pop()?.split(`.`).shift()
(path) => path.split(`/`).pop()?.split(`.`).shift(),
)
// $lib is also allowed to export other things, so we use arrayContaining()
expect(Object.keys(lib)).toEqual(expect.arrayContaining(components))
})

test(`src/lib/icons/index.ts re-exports all icons`, () => {
const components = Object.keys(import.meta.glob(`$lib/icons/*.svelte`)).map(
(path) => path.split(`/`).pop()?.split(`.`).shift()
(path) => path.split(`/`).pop()?.split(`.`).shift(),
)
expect(Object.keys(icons)).toStrictEqual(components)
})
Expand Down

0 comments on commit fea79e0

Please sign in to comment.