Skip to content

Commit 3d486ce

Browse files
authored
fix: enhance TypedFlatConfigItem type and improve timeout handling in tests (#738)
1 parent 11f1261 commit 3d486ce

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/types.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,19 @@ export interface Rules extends RuleOptions {}
1212

1313
export type { ConfigNames }
1414

15-
export type TypedFlatConfigItem = Omit<Linter.Config<Linter.RulesRecord & Rules>, 'plugins'> & {
15+
export type TypedFlatConfigItem = Omit<Linter.Config<Linter.RulesRecord & Rules>, 'plugins' | 'rules'> & {
1616
// Relax plugins type limitation, as most of the plugins did not have correct type info yet.
1717
/**
1818
* An object containing a name-value mapping of plugin names to plugin objects. When `files` is specified, these plugins are only available to the matching files.
1919
*
2020
* @see [Using plugins in your configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-plugins-in-your-configuration)
2121
*/
2222
plugins?: Record<string, any>
23+
24+
/**
25+
* Rules configuration. More flexible to allow plugin rules that may not be perfectly typed.
26+
*/
27+
rules?: Record<string, Linter.RuleEntry<any> | undefined>
2328
}
2429

2530
export interface OptionsFiles {

test/fixtures.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import { glob } from 'tinyglobby'
77

88
import { afterAll, beforeAll, it } from 'vitest'
99

10+
const isWindows = process.platform === 'win32'
11+
const timeout = isWindows ? 300_000 : 30_000
12+
1013
beforeAll(async () => {
1114
await fs.rm('_fixtures', { recursive: true, force: true })
1215
})
@@ -157,5 +160,5 @@ export default antfu(
157160
}
158161
await expect.soft(content).toMatchFileSnapshot(join(output, file))
159162
}))
160-
}, 30_000)
163+
}, timeout)
161164
}

0 commit comments

Comments
 (0)