Address new TypeScript warnings in core files, improve type definitions.
Some checks are pending
Checkers / linkcheck (push) Waiting to run
Checkers / spellcheck (push) Waiting to run
CI / build (20, macos-latest) (push) Waiting to run
CI / build (20, ubuntu-latest) (push) Waiting to run
CI / build (20, windows-latest) (push) Waiting to run
CI / build (22, macos-latest) (push) Waiting to run
CI / build (22, ubuntu-latest) (push) Waiting to run
CI / build (22, windows-latest) (push) Waiting to run
CI / build (24, macos-latest) (push) Waiting to run
CI / build (24, ubuntu-latest) (push) Waiting to run
CI / build (24, windows-latest) (push) Waiting to run
CI / pnpm (push) Waiting to run
CodeQL / Analyze (push) Waiting to run
TestRepos / build (latest, ubuntu-latest) (push) Waiting to run
UpdateTestRepos / update (push) Waiting to run

This commit is contained in:
David Anson 2025-10-11 16:36:47 -07:00
parent bd02390014
commit 7beb9fc9d0
32 changed files with 354 additions and 170 deletions

View file

@ -4,7 +4,7 @@
* Result of a call to parseConfiguration.
*
* @typedef {Object} ParseConfigurationResult
* @property {Object | null} config Configuration object if successful.
* @property {import("markdownlint").Configuration | null} config Configuration object if successful.
* @property {string | null} message Error message if an error occurred.
*/
@ -13,7 +13,7 @@
*
* @param {string} name Name of the configuration file.
* @param {string} content Configuration content.
* @param {import("./markdownlint.mjs").ConfigurationParser[]} [parsers] Parsing function(s).
* @param {import("markdownlint").ConfigurationParser[]} [parsers] Parsing function(s).
* @returns {ParseConfigurationResult} Parse configuration result.
*/
export default function parseConfiguration(name, content, parsers) {
@ -28,8 +28,9 @@ export default function parseConfiguration(name, content, parsers) {
config = (result && (typeof result === "object") && !Array.isArray(result)) ? result : {};
// Succeeded
return false;
} catch(error) {
errors.push(`Parser ${index++}: ${error.message}`);
// eslint-disable-next-line jsdoc/reject-any-type
} catch(/** @type {any} */ error) {
errors.push(`Parser ${index++}: ${error?.message}`);
}
// Failed, try the next parser
return true;