Skip to content

Commit e11ff2d

Browse files
committed
upgrade eslint
1 parent 801ea41 commit e11ff2d

13 files changed

+235
-236
lines changed

.eslintrc.js renamed to .eslintrc.cjs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,23 @@ module.exports = {
33
env: {
44
browser: true,
55
es6: true,
6-
jest: true
6+
jest: true,
77
},
8-
parser: 'babel-eslint',
9-
extends: [
10-
'standard'
11-
],
12-
plugins: [
13-
'svelte3',
14-
'simple-import-sort'
15-
],
8+
extends: ['standard'],
9+
plugins: ['svelte3', 'simple-import-sort'],
1610
rules: {
1711
'max-len': ['warn', { code: 100 }],
1812
'simple-import-sort/imports': 'error',
19-
'no-multiple-empty-lines': ['error', { max: 2, maxBOF: 2, maxEOF: 0 }]
13+
'no-multiple-empty-lines': ['error', { max: 2, maxBOF: 2, maxEOF: 0 }],
2014
},
2115
overrides: [
2216
{
2317
files: ['**/*.svelte'],
24-
processor: 'svelte3/svelte3'
25-
}
18+
processor: 'svelte3/svelte3',
19+
},
2620
],
2721
parserOptions: {
2822
ecmaVersion: 2019,
29-
sourceType: 'module'
30-
}
23+
sourceType: 'module',
24+
},
3125
}

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@
6060
"@vitest/coverage-c8": "^0.32.0",
6161
"all-contributors-cli": "^6.9.0",
6262
"doctoc": "^2.0.0",
63-
"eslint": "^7.2.0",
64-
"eslint-config-standard": "^16.0.0",
65-
"eslint-plugin-import": "^2.18.2",
66-
"eslint-plugin-node": "^11.0.0",
67-
"eslint-plugin-promise": "^5.1.0",
68-
"eslint-plugin-simple-import-sort": "^7.0.0",
69-
"eslint-plugin-svelte3": "^3.0.0",
63+
"eslint": "^8.42.0",
64+
"eslint-config-standard": "^17.1.0",
65+
"eslint-plugin-import": "^2.27.5",
66+
"eslint-plugin-node": "^11.1.0",
67+
"eslint-plugin-promise": "^6.1.1",
68+
"eslint-plugin-simple-import-sort": "^10.0.0",
69+
"eslint-plugin-svelte3": "^4.0.0",
7070
"husky": "^7.0.1",
7171
"jest": "^29.5.0",
7272
"jest-environment-jsdom": "^29.5.0",

src/__tests__/auto-cleanup.test.js

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,31 @@
1-
import { describe, test, expect } from 'vitest'
1+
import { describe, expect, test } from 'vitest'
2+
23
import { render } from '..'
34
import Comp from './fixtures/Comp.svelte'
45

56
describe('auto-cleanup', () => {
6-
// This just verifies that by importing STL in an
7-
// environment which supports afterEach (like jest)
8-
// we'll get automatic cleanup between tests.
9-
test('first', () => {
10-
render(Comp, { props: { name: 'world' } })
11-
})
7+
// This just verifies that by importing STL in an
8+
// environment which supports afterEach (like jest)
9+
// we'll get automatic cleanup between tests.
10+
test('first', () => {
11+
render(Comp, { props: { name: 'world' } })
12+
})
1213

13-
test('second', () => {
14-
expect(document.body.innerHTML).toEqual('')
15-
})
14+
test('second', () => {
15+
expect(document.body.innerHTML).toEqual('')
16+
})
1617
})
1718

1819
describe('cleanup of two components', () => {
19-
// This just verifies that by importing STL in an
20-
// environment which supports afterEach (like jest)
21-
// we'll get automatic cleanup between tests.
22-
test('first', () => {
23-
render(Comp, { props: { name: 'world' } })
24-
render(Comp, { props: { name: 'universe' } })
25-
})
20+
// This just verifies that by importing STL in an
21+
// environment which supports afterEach (like jest)
22+
// we'll get automatic cleanup between tests.
23+
test('first', () => {
24+
render(Comp, { props: { name: 'world' } })
25+
render(Comp, { props: { name: 'universe' } })
26+
})
2627

27-
test('second', () => {
28-
expect(document.body.innerHTML).toEqual('')
29-
})
28+
test('second', () => {
29+
expect(document.body.innerHTML).toEqual('')
30+
})
3031
})

src/__tests__/debug.test.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
import { describe, test, expect, beforeEach, afterEach, vi } from 'vitest'
21
import { prettyDOM } from '@testing-library/dom'
2+
import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'
33

44
import { render } from '..'
55
import Comp from './fixtures/Comp.svelte'
66

77
describe('debug', () => {
8-
beforeEach(() => {
9-
vi.spyOn(console, 'log').mockImplementation(() => { })
10-
})
8+
beforeEach(() => {
9+
vi.spyOn(console, 'log').mockImplementation(() => { })
10+
})
1111

12-
afterEach(() => {
13-
console.log.mockRestore()
14-
})
12+
afterEach(() => {
13+
console.log.mockRestore()
14+
})
1515

16-
test('pretty prints the container', () => {
17-
const { container, debug } = render(Comp, { props: { name: 'world' } })
16+
test('pretty prints the container', () => {
17+
const { container, debug } = render(Comp, { props: { name: 'world' } })
1818

19-
debug()
19+
debug()
2020

21-
expect(console.log).toHaveBeenCalledTimes(1)
22-
expect(console.log).toHaveBeenCalledWith(prettyDOM(container))
23-
})
21+
expect(console.log).toHaveBeenCalledTimes(1)
22+
expect(console.log).toHaveBeenCalledWith(prettyDOM(container))
23+
})
2424
})

src/__tests__/events.test.js

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,30 @@
1-
import { describe, test, expect } from 'vitest'
1+
import { describe, expect, test } from 'vitest'
2+
23
import { fireEvent, render } from '..'
34
import Comp from './fixtures/Comp.svelte'
45

56
describe('events', () => {
6-
test('state changes are flushed after firing an event', async () => {
7-
const { getByText } = render(Comp, { props: { name: 'World' } })
8-
const button = getByText('Button')
7+
test('state changes are flushed after firing an event', async () => {
8+
const { getByText } = render(Comp, { props: { name: 'World' } })
9+
const button = getByText('Button')
910

10-
await fireEvent.click(button)
11+
await fireEvent.click(button)
1112

12-
expect(button).toHaveTextContent('Button Clicked')
13-
})
13+
expect(button).toHaveTextContent('Button Clicked')
14+
})
1415

15-
test('calling `fireEvent` directly works too', async () => {
16-
const { getByText } = render(Comp, { props: { name: 'World' } })
17-
const button = getByText('Button')
16+
test('calling `fireEvent` directly works too', async () => {
17+
const { getByText } = render(Comp, { props: { name: 'World' } })
18+
const button = getByText('Button')
1819

19-
await fireEvent(
20-
button,
21-
new MouseEvent('click', {
22-
bubbles: true,
23-
cancelable: true,
24-
})
25-
)
20+
await fireEvent(
21+
button,
22+
new MouseEvent('click', {
23+
bubbles: true,
24+
cancelable: true
25+
})
26+
)
2627

27-
expect(button).toHaveTextContent('Button Clicked')
28-
})
28+
expect(button).toHaveTextContent('Button Clicked')
29+
})
2930
})

src/__tests__/fixtures/Comp.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
1010
const contextName = getContext('name')
1111
12-
function handleClick() {
12+
function handleClick () {
1313
buttonText = 'Button Clicked'
1414
}
1515
</script>

src/__tests__/fixtures/Comp2.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<script>
22
export let name
33
4-
let buttonText = "Button Text"
4+
let buttonText = 'Button Text'
55
6-
function handleClick() {
7-
buttonText = "Button Clicked"
6+
function handleClick () {
7+
buttonText = 'Button Clicked'
88
}
99
</script>
1010

src/__tests__/multi-base.test.js

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,42 @@
1-
import { describe, test, expect } from 'vitest'
1+
import { describe, expect, test } from 'vitest'
2+
23
import { render } from '..'
34
import Comp from './fixtures/Comp.svelte'
45

56
describe('multi-base', () => {
6-
const treeA = document.createElement('div')
7-
const treeB = document.createElement('div')
7+
const treeA = document.createElement('div')
8+
const treeB = document.createElement('div')
89

9-
test('container isolates trees from one another', () => {
10-
const { getByText: getByTextInA } = render(
11-
Comp,
12-
{
13-
target: treeA,
14-
props: {
15-
name: 'Tree A',
16-
},
17-
},
18-
{
19-
container: treeA,
20-
}
21-
)
10+
test('container isolates trees from one another', () => {
11+
const { getByText: getByTextInA } = render(
12+
Comp,
13+
{
14+
target: treeA,
15+
props: {
16+
name: 'Tree A'
17+
}
18+
},
19+
{
20+
container: treeA
21+
}
22+
)
2223

23-
const { getByText: getByTextInB } = render(
24-
Comp,
25-
{
26-
target: treeB,
27-
props: {
28-
name: 'Tree B',
29-
},
30-
},
31-
{
32-
container: treeB,
33-
}
34-
)
24+
const { getByText: getByTextInB } = render(
25+
Comp,
26+
{
27+
target: treeB,
28+
props: {
29+
name: 'Tree B'
30+
}
31+
},
32+
{
33+
container: treeB
34+
}
35+
)
3536

36-
expect(() => getByTextInA('Hello Tree A!')).not.toThrow()
37-
expect(() => getByTextInB('Hello Tree A!')).toThrow()
38-
expect(() => getByTextInA('Hello Tree B!')).toThrow()
39-
expect(() => getByTextInB('Hello Tree B!')).not.toThrow()
40-
})
37+
expect(() => getByTextInA('Hello Tree A!')).not.toThrow()
38+
expect(() => getByTextInB('Hello Tree A!')).toThrow()
39+
expect(() => getByTextInA('Hello Tree B!')).toThrow()
40+
expect(() => getByTextInB('Hello Tree B!')).not.toThrow()
41+
})
4142
})

0 commit comments

Comments
 (0)