diff --git a/markdownlint-cli2.mjs b/markdownlint-cli2.mjs index 46c3cb7..7b9b0e3 100755 --- a/markdownlint-cli2.mjs +++ b/markdownlint-cli2.mjs @@ -87,13 +87,9 @@ const importOrRequireResolve = async (dirOrDirs, id, noRequire) => { } // Try to load via import(...) try { - // eslint-disable-next-line n/no-unsupported-features/node-builtins - const isURL = !pathDefault.isAbsolute(expandId) && URL.canParse(expandId); - const urlString = ( - isURL ? new URL(expandId) : pathToFileURL(pathDefault.resolve(dirs[0], expandId)) - ).toString(); + const url = URL.parse(expandId) || pathToFileURL(pathDefault.resolve(dirs[0], expandId)); // eslint-disable-next-line no-inline-comments - const module = await import(/* webpackIgnore: true */ urlString); + const module = await import(/* webpackIgnore: true */ url); return module.default; } catch (error) { errors.push(error);