-
-
Notifications
You must be signed in to change notification settings - Fork 32
/
flat-config.test.ts
39 lines (35 loc) · 1003 Bytes
/
flat-config.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import fs from 'node:fs/promises'
import path from 'node:path'
import { Linter } from 'eslint'
import * as mdx from 'eslint-plugin-mdx'
const linter = new Linter({ configType: 'flat' })
describe('flat-config', () => {
it('should work as expected', async () => {
const dirname = path.resolve(__dirname, 'fixtures/flat-config')
const files = await fs.readdir(dirname)
for (const file of files) {
expect(
linter.verify(
await fs.readFile(path.resolve(dirname, file), 'utf8'),
[
{
...mdx.flat,
processor: mdx.createRemarkProcessor({
lintCodeBlocks: true,
}),
},
{
...mdx.flatCodeBlocks,
rules: {
...mdx.flatCodeBlocks.rules,
'no-var': 'error',
'prefer-const': 'error',
},
},
],
file,
),
).toMatchSnapshot(file)
}
})
})