Skip to content

Commit 7c6880b

Browse files
committed
Fix code style
1 parent da69e94 commit 7c6880b

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

src/req.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@ const { pathToFileURL } = require('node:url')
44

55
const TS_EXT_RE = /\.[mc]?ts$/
66

7-
/** @type {import('tsx/cjs/api') | void} */
8-
let tsx;
7+
let tsx
98

10-
/** @type {import('jiti').default | void} */
119
let jiti
1210

13-
/** @type {Error} */
14-
let importError;
11+
let importError
1512

1613
/**
1714
* @param {string} name
@@ -31,27 +28,32 @@ async function req(name, rootFile = __filename) {
3128
}
3229

3330
if (tsx === undefined) {
34-
tsx = await import('tsx/cjs/api').catch((error) => {
35-
importError = error;
36-
})
31+
tsx = await import('tsx/cjs/api').catch(error => {
32+
importError = error
33+
})
3734
}
3835

3936
if (tsx) {
4037
let loaded = tsx.require(name, rootFile)
41-
return (loaded && '__esModule' in loaded) ? loaded.default : loaded;
38+
return loaded && '__esModule' in loaded ? loaded.default : loaded
4239
}
4340

4441
if (jiti === undefined) {
45-
jiti = await import('jiti').then(m => m.default, (error) => {
46-
importError = importError ?? error;
47-
})
42+
jiti = await import('jiti').then(
43+
m => m.default,
44+
error => {
45+
importError = importError ?? error
46+
}
47+
)
4848
}
4949

5050
if (jiti) {
5151
return jiti(rootFile, { interopDefault: true })(name)
5252
}
5353

54-
throw new Error(`'tsx' or 'jiti' is required for the TypeScript configuration files. Make sure it is installed\nError: ${importError.message}`);
54+
throw new Error(
55+
`'tsx' or 'jiti' is required for the TypeScript configuration files. Make sure it is installed\nError: ${importError.message}`
56+
)
5557
}
5658

5759
module.exports = req

0 commit comments

Comments
 (0)