From a865be3fe17ee11c52c188539152ea053d1368b9 Mon Sep 17 00:00:00 2001 From: Andrew Bradley Date: Tue, 17 May 2022 11:52:43 -0400 Subject: [PATCH] lint-fix --- src/index.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/index.ts b/src/index.ts index 3a26d0113..b86fc6282 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1574,11 +1574,11 @@ function registerExtensions( ) { const exts = new Set(extensions); // Can't add these extensions cuz would allow omitting file extension; node requires ext for .cjs and .mjs - // Unless they're already registered by something else; then we *must* hook them or else our transformer - // will not be called. - for(const cannotAdd of ['.mts', '.cts', '.mjs', '.cjs']) { - // Other file exts can still be transformed via the .js extension. - if(exts.has(cannotAdd) && !hasOwnProperty(require.extensions, cannotAdd)) { + // Unless they're already registered by something else (nyc does this): + // then we *must* hook them or else our transformer will not be called. + for (const cannotAdd of ['.mts', '.cts', '.mjs', '.cjs']) { + if (exts.has(cannotAdd) && !hasOwnProperty(require.extensions, cannotAdd)) { + // Unrecognized file exts can be transformed via the `.js` handler. exts.add('.js'); exts.delete(cannotAdd); }