Skip to content

Commit

Permalink
fix: properly disable top-level-await rule for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Sep 26, 2024
1 parent 582ade4 commit e914ae4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
8 changes: 0 additions & 8 deletions src/configs/disables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,6 @@ export async function disables(): Promise<TypedFlatConfigItem[]> {
'unused-imports/no-unused-vars': 'off',
},
},
{
files: ['**/*.{test,spec}.([tj])s?(x)'],
name: 'antfu/disables/test',
rules: {
'antfu/no-top-level-await': 'off',
'no-unused-expressions': 'off',
},
},
{
files: ['**/*.js', '**/*.cjs'],
name: 'antfu/disables/cjs',
Expand Down
11 changes: 8 additions & 3 deletions src/configs/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,21 @@ export async function test(
files,
name: 'antfu/test/rules',
rules: {
'node/prefer-global/process': 'off',

'test/consistent-test-it': ['error', { fn: 'it', withinDescribe: 'it' }],
'test/no-identical-title': 'error',
'test/no-import-node-test': 'error',
'test/no-only-tests': isInEditor ? 'off' : 'error',

'test/prefer-hooks-in-order': 'error',
'test/prefer-lowercase-title': 'error',

'ts/explicit-function-return-type': 'off',
// Disables
...{
'antfu/no-top-level-await': 'off',
'no-unused-expressions': 'off',
'node/prefer-global/process': 'off',
'ts/explicit-function-return-type': 'off',
},

...overrides,
},
Expand Down

0 comments on commit e914ae4

Please sign in to comment.