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. 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. 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 (`.`). 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. 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. 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.) (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 * 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} configFile Configuration file name.
* @param {string} referenceId Referenced identifier to resolve. * @param {string} referenceId Referenced identifier to resolve.
@ -909,15 +909,13 @@ function resolveConfigExtends(configFile, referenceId) {
if (fs.statSync(resolvedExtendsFile).isFile()) { if (fs.statSync(resolvedExtendsFile).isFile()) {
return resolvedExtendsFile; return resolvedExtendsFile;
} }
// eslint-disable-next-line unicorn/prefer-optional-catch-binding } catch {
} catch (error) { // If not a file or fs.statSync throws, try require.resolve
// If fs.statSync has thrown, trying require.resolve
} }
try { try {
return require.resolve(referenceId, { "paths": [ configFileDirname ] }); return require.resolve(referenceId, { "paths": [ configFileDirname ] });
// eslint-disable-next-line unicorn/prefer-optional-catch-binding } catch {
} catch (error) { // If require.resolve throws, return resolvedExtendsFile
// If require.resolve throws, returning resolvedExtendsFile for BC
} }
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); test.plan(4);
markdownlint.readConfig("./test/config/config-badchildpackage.json", markdownlint.readConfig("./test/config/config-badchildpackage.json",
function callback(err, result) { 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."); test.ok(err instanceof Error, "Error not instance of Error.");
// @ts-ignore // @ts-ignore
test.equal(err.code, "ENOENT", test.equal(err.code, "ENOENT",
"Error code for bad child file not ENOENT."); "Error code for bad child package not ENOENT.");
test.ok(!result, "Got result for bad child file."); test.ok(!result, "Got result for bad child package.");
test.end(); test.end();
}); });
}); });