Skip to content

Commit bd94643

Browse files
authored
chore(oxlint.config): enable 'vitest-js/padding-around-*' rules and add blank lines around test blocks and hooks (#610)
1 parent 3c2dbad commit bd94643

5 files changed

Lines changed: 21 additions & 0 deletions

File tree

‎oxlint.config.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ export default defineConfig({
9292
'vitest/require-to-throw-message': 'error',
9393
'vitest/require-top-level-describe': 'error',
9494
'vitest-js/no-conditional-in-test': 'error',
95+
'vitest-js/padding-around-after-all-blocks': 'error',
96+
'vitest-js/padding-around-after-each-blocks': 'error',
97+
'vitest-js/padding-around-before-all-blocks': 'error',
98+
'vitest-js/padding-around-before-each-blocks': 'error',
99+
'vitest-js/padding-around-describe-blocks': 'error',
100+
'vitest-js/padding-around-test-blocks': 'error',
95101
'vitest-js/prefer-vi-mocked': 'error',
96102
},
97103
},

‎packages/devtools-bundler-core/src/connection.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ describe('connection singleton', () => {
1515
})
1616
expect(getDevtoolsFileId()).toBeNull()
1717
})
18+
1819
it('round-trips connection and file id', () => {
1920
setDevtoolsConnection({ port: 5000, host: '0.0.0.0', protocol: 'https' })
2021
expect(getDevtoolsConnection()).toStrictEqual({

‎packages/devtools-bundler-core/src/inject-source.test.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ describe('inject source', () => {
2929
)
3030
expect(output).toBeUndefined()
3131
})
32+
3233
it("shouldn't augment react fragments if they start with React.Fragment", () => {
3334
const output = addSourceToJsx(
3435
`
@@ -40,6 +41,7 @@ describe('inject source', () => {
4041
)
4142
expect(output).toBeUndefined()
4243
})
44+
4345
describe('FunctionExpression', () => {
4446
it('should work with deeply nested custom JSX syntax', () => {
4547
const output = removeEmptySpace(
@@ -195,6 +197,7 @@ describe('inject source', () => {
195197
)
196198
})
197199
})
200+
198201
describe('function declarations', () => {
199202
it('should not duplicate the same property if there are nested functions', () => {
200203
const output = removeEmptySpace(
@@ -221,6 +224,7 @@ describe('inject source', () => {
221224
`),
222225
)
223226
})
227+
224228
it('should apply data-tsd-source from parent props if an external import', () => {
225229
const output = removeEmptySpace(
226230
addSourceToJsx(
@@ -246,6 +250,7 @@ function test({...props }) {
246250
`),
247251
)
248252
})
253+
249254
it('props not destructured', () => {
250255
const output = removeEmptySpace(
251256
addSourceToJsx(
@@ -446,6 +451,7 @@ function test({...props }) {
446451
)
447452
})
448453
})
454+
449455
describe('variable declared functions', () => {
450456
it('works with function and props not destructured', () => {
451457
const output = removeEmptySpace(
@@ -647,6 +653,7 @@ function test({...props }) {
647653
)
648654
})
649655
})
656+
650657
describe('arrow functions', () => {
651658
it('works with arrow function and props not destructured', () => {
652659
const output = removeEmptySpace(

‎packages/devtools-rspack/src/index.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ describe('devtools-rspack entry', () => {
66
const plugin = devtools({ logging: false })
77
expect((plugin as any).apply).toBeTypeOf('function')
88
})
9+
910
it('defineDevtoolsConfig is identity', () => {
1011
const cfg = { logging: false }
1112
expect(defineDevtoolsConfig(cfg)).toBe(cfg)

‎packages/devtools/src/context/devtools-context.test.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ describe('getStateFromLocalStorage', () => {
1919
beforeEach(() => {
2020
localStorage.clear()
2121
})
22+
2223
it('should return undefined when no data in localStorage', () => {
2324
const state = getStateFromLocalStorage(undefined)
2425
expect(state).toBeUndefined()
2526
})
27+
2628
it('migrates a legacy activePlugins array into a single layout group', () => {
2729
const mockState = {
2830
activePlugins: ['plugin1'],
@@ -76,6 +78,7 @@ describe('getStateFromLocalStorage', () => {
7678
'plugin2',
7779
])
7880
})
81+
7982
it('should filter out inactive plugins', () => {
8083
const mockState = {
8184
activePlugins: ['plugin1', 'plugin2'],
@@ -88,6 +91,7 @@ describe('getStateFromLocalStorage', () => {
8891
const state = getStateFromLocalStorage(plugins)
8992
expect(flattenTabs(state?.layout ?? null)).toStrictEqual(['plugin1'])
9093
})
94+
9195
it('should return empty plugin state if all active plugins are invalid', () => {
9296
const mockState = {
9397
activePlugins: ['plugin1', 'plugin2'],
@@ -100,6 +104,7 @@ describe('getStateFromLocalStorage', () => {
100104
const state = getStateFromLocalStorage(plugins)
101105
expect(flattenTabs(state?.layout ?? null)).toStrictEqual([])
102106
})
107+
103108
it('should handle invalid JSON in localStorage gracefully', () => {
104109
localStorage.setItem(TANSTACK_DEVTOOLS_STATE, 'invalid json')
105110
const state = getStateFromLocalStorage(undefined)
@@ -381,6 +386,7 @@ describe('getExistingStateFromStorage - integration tests', () => {
381386

382387
describe('provider resilience', () => {
383388
beforeEach(() => localStorage.clear())
389+
384390
afterEach(() => vi.restoreAllMocks())
385391

386392
it('fails loudly for storage reads while tolerating storage quota errors', () => {

0 commit comments

Comments
 (0)