Minor tweaks to previous PR commit.

This commit is contained in:
David Anson 2020-10-21 20:53:30 -07:00
parent 4bff44e33f
commit dd2c1d08ee
4 changed files with 9 additions and 5600 deletions

View file

@ -43,6 +43,7 @@ Open pull requests against the `next` branch.
That's where the latest changes are staged for the next release.
Include the text "(fixes #??)" at the end of the commit message so the pull request will be associated with the relevant issue.
End commit messages with a period (`.`).
Do not include `package-lock.json` in the pull request.
Once accepted, the tag `fixed in next` will be added to the issue.
When the commit is merged to the main branch during the release process, the issue will be closed automatically.
(See [Closing issues using keywords](https://help.github.com/articles/closing-issues-using-keywords/) for details.)

View file

@ -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;
}

5590
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1083,12 +1083,12 @@ tape("configBadChildPackage", (test) => {
test.plan(4);
markdownlint.readConfig("./test/config/config-badchildpackage.json",
function callback(err, result) {
test.ok(err, "Did not get an error for bad child file.");
test.ok(err, "Did not get an error for bad child package.");
test.ok(err instanceof Error, "Error not instance of Error.");
// @ts-ignore
test.equal(err.code, "ENOENT",
"Error code for bad child file not ENOENT.");
test.ok(!result, "Got result for bad child file.");
"Error code for bad child package not ENOENT.");
test.ok(!result, "Got result for bad child package.");
test.end();
});
});