Skip to content

Commit 20d90cd

Browse files
committed
style: code review feedback
1 parent 37f3e52 commit 20d90cd

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/isSupportedExtension.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable unicorn/filename-case */
22

3-
import { promises as fsp } from 'fs'
3+
import fs from 'fs/promises'
44

55
import {
66
type FileInfoOptions,
@@ -9,14 +9,16 @@ import {
99
} from 'prettier'
1010

1111
export default (resolveConfig?: boolean) => async (file: string) => {
12-
const stat = await fsp.stat(file).catch(_error => null)
12+
const stat = await fs.stat(file).catch(_error => null)
1313
/* If file exists but is actually a directory, getFileInfo might end up trying
1414
* to open it and read it as a file, so let's not let that happen. On the
1515
* other hand, the tests depend on our not failing out with files that don't
1616
* exist, so permit nonexistent files to go through (they appear to be
1717
* detected by suffix, so never get read).
1818
*/
19-
if (stat?.isDirectory()) return false
19+
if (stat?.isDirectory()) {
20+
return false
21+
}
2022
const config = (await prettierResolveConfig(file, {
2123
editorconfig: true,
2224
})) as FileInfoOptions

0 commit comments

Comments
 (0)