mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 06:20:12 +01:00
Minor tweaks to previous PR commit.
This commit is contained in:
parent
4bff44e33f
commit
dd2c1d08ee
4 changed files with 9 additions and 5600 deletions
|
|
@ -896,7 +896,7 @@ function parseConfiguration(name, content, parsers) {
|
|||
|
||||
/**
|
||||
* Resolve referenced "extends" path in a configuration file
|
||||
* using path.resolve() and require.resolve() as a fallback.
|
||||
* using path.resolve() with require.resolve() as a fallback.
|
||||
*
|
||||
* @param {string} configFile Configuration file name.
|
||||
* @param {string} referenceId Referenced identifier to resolve.
|
||||
|
|
@ -909,15 +909,13 @@ function resolveConfigExtends(configFile, referenceId) {
|
|||
if (fs.statSync(resolvedExtendsFile).isFile()) {
|
||||
return resolvedExtendsFile;
|
||||
}
|
||||
// eslint-disable-next-line unicorn/prefer-optional-catch-binding
|
||||
} catch (error) {
|
||||
// If fs.statSync has thrown, trying require.resolve
|
||||
} catch {
|
||||
// If not a file or fs.statSync throws, try require.resolve
|
||||
}
|
||||
try {
|
||||
return require.resolve(referenceId, { "paths": [ configFileDirname ] });
|
||||
// eslint-disable-next-line unicorn/prefer-optional-catch-binding
|
||||
} catch (error) {
|
||||
// If require.resolve throws, returning resolvedExtendsFile for BC
|
||||
} catch {
|
||||
// If require.resolve throws, return resolvedExtendsFile
|
||||
}
|
||||
return resolvedExtendsFile;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue