Skip to content

Commit 5041c05

Browse files
committed
Fix linting issues
1 parent ab29675 commit 5041c05

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Rest of document
3434
The following script:
3535

3636
```js
37-
import { readFile } from 'fs/promises';
37+
import { readFile } from 'node:fs/promises';
3838

3939
import { compile } from '@mdx-js/mdx';
4040
import remarkFrontmatter from 'remark-frontmatter';

test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { promises as fs, readdirSync } from 'fs';
2-
import { join } from 'path';
1+
import { readdir, readFile, writeFile } from 'node:fs/promises';
32

43
import { compile, compileSync } from '@mdx-js/mdx';
54
import remarkFrontmatter from 'remark-frontmatter';
@@ -8,14 +7,15 @@ import { equal, throws } from 'uvu/assert';
87

98
import remarkMdxFrontmatter from './index.js';
109

11-
const tests = readdirSync('__fixtures__');
10+
const fixturesDir = new URL('__fixtures__/', import.meta.url);
11+
const tests = await readdir(fixturesDir);
1212

1313
for (const name of tests) {
1414
test(name, async () => {
15-
const path = join('__fixtures__', name);
16-
const input = await fs.readFile(join(path, 'input.md'));
17-
const expected = join(path, 'expected.jsx');
18-
const options = JSON.parse(await fs.readFile(join(path, 'options.json'), 'utf8'));
15+
const url = new URL(`${name}/`, fixturesDir);
16+
const input = await readFile(new URL('input.md', url));
17+
const expected = new URL('expected.jsx', url);
18+
const options = JSON.parse(await readFile(new URL('options.json', url), 'utf8'));
1919
const { value } = await compile(input, {
2020
remarkPlugins: [
2121
[remarkFrontmatter, ['yaml', 'toml']],
@@ -24,9 +24,9 @@ for (const name of tests) {
2424
jsx: true,
2525
});
2626
if (process.argv.includes('--write')) {
27-
await fs.writeFile(expected, value);
27+
await writeFile(expected, value);
2828
}
29-
equal(value, await fs.readFile(expected, 'utf8'));
29+
equal(value, await readFile(expected, 'utf8'));
3030
});
3131
}
3232

0 commit comments

Comments
 (0)