From 071255b8caaad6fd2cde05e67226dc4c589b51ce Mon Sep 17 00:00:00 2001 From: chris48s Date: Mon, 19 Aug 2024 12:44:24 +0100 Subject: [PATCH] various docs improvements - improve description for parser param - fix typos - improveme fileLocation description --- docs/docs/plugins/writing-plugins.md | 2 +- src/plugins.js | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/docs/docs/plugins/writing-plugins.md b/docs/docs/plugins/writing-plugins.md index 63e1551..ea33899 100644 --- a/docs/docs/plugins/writing-plugins.md +++ b/docs/docs/plugins/writing-plugins.md @@ -14,7 +14,7 @@ Plugins are invoked in the following sequence: Plugins that the user has specified in the config file are run first. These are executed in the order they are specified in the config file. -v8r's core plugins run second. The order of execution or core plugins is non-configurable. +v8r's core plugins run second. The order of execution for core plugins is non-configurable. ## Hook Types diff --git a/src/plugins.js b/src/plugins.js index c4a7842..a0e52fd 100644 --- a/src/plugins.js +++ b/src/plugins.js @@ -39,9 +39,9 @@ class BasePlugin { * `dotRelative` option. This means relative paths in the current directory * will be prefixed with `./` (or `.\` on Windows) even if this was not * present in the input filename or pattern. - * @param {string | undefined} parser - If this filename matched a file parser - * the user has specified in a custom schema, this will be passed to - * `parseFile` in the `parser` param. + * @param {string | undefined} parser - If the user has specified a parser to + * use for this file in a custom schema, this will be passed to `parseFile` + * in the `parser` param. * @returns {Document | undefined} Parsed file contents */ // eslint-disable-next-line no-unused-vars @@ -70,7 +70,7 @@ class BasePlugin { * `getSingleResultLogMessage` returns undefined, v8r will move on to the next * plugin in the stack. * - * Any mesage returned from this function will be written to stdout. + * Any message returned from this function will be written to stdout. * * @param {ValidationResult} result - Result of attempting to validate this * document. @@ -97,7 +97,7 @@ class BasePlugin { * `getAllResultsLogMessage` returns undefined, v8r will move on to the next * plugin in the stack. * - * Any mesage returned from this function will be written to stdout. + * Any message returned from this function will be written to stdout. * * @param {ValidationResult[]} results - Results of attempting to validate * these documents. @@ -198,8 +198,12 @@ async function loadAllPlugins(userPlugins) { /** * @typedef {object} ValidationResult - * @property {string} fileLocation - Filename of the document that was - * validated. + * @property {string} fileLocation - Path of the document that was validated. + * Filenames are resolved and normalised by + * [glob](https://www.npmjs.com/package/glob) using the `dotRelative` option. + * This means relative paths in the current directory will be prefixed with + * `./` (or `.\` on Windows) even if this was not present in the input + * filename or pattern. * @property {string | null} schemaLocation - Location of the schema used to * validate this file if one could be found. `null` if no schema was found. * @property {boolean | null} valid - Result of the validation (true/false) if a