From 31e20c889e467aa4ba64b0b5baf602adc1359371 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Fri, 20 May 2022 10:28:38 -0400 Subject: ESlint JSdoc (#2148) * Install eslint-plugin-jsdoc * Initial rules setup * Update lists * Use @returns rather than @return * Remove error throwing code which is never executed * Fix issues relating to @throws * General error fixes * Update Display type documentation * Various doc fixes * Fix invalid tuple syntax * Doc updates * Remove unused * Doc updates * Enable jsdoc/require-returns * Update rules * Update remaining rules --- ext/js/background/profile-conditions-util.js | 35 +++++++++++++++------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'ext/js/background') diff --git a/ext/js/background/profile-conditions-util.js b/ext/js/background/profile-conditions-util.js index fd2991f8..e9bd7a19 100644 --- a/ext/js/background/profile-conditions-util.js +++ b/ext/js/background/profile-conditions-util.js @@ -23,6 +23,20 @@ * Utility class to help processing profile conditions. */ class ProfileConditionsUtil { + /** + * A group of conditions. + * @typedef {object} ProfileConditionGroup + * @property {ProfileCondition[]} conditions The list of conditions for this group. + */ + + /** + * A single condition. + * @typedef {object} ProfileCondition + * @property {string} type The type of the condition. + * @property {string} operator The condition operator. + * @property {string} value The value to compare against. + */ + /** * Creates a new instance. */ @@ -78,20 +92,9 @@ class ProfileConditionsUtil { /** * Creates a new JSON schema descriptor for the given set of condition groups. - * @param conditionGroups An array of condition groups in the following format: - * conditionGroups = [ - * { - * conditions: [ - * { - * type: (condition type: string), - * operator: (condition sub-type: string), - * value: (value to compare against: string) - * }, - * ... - * ] - * }, - * ... - * ] + * @param {ProfileConditionGroup[]} conditionGroups An array of condition groups. + * For a profile match, all of the items must return successfully in at least one of the groups. + * @returns {JsonSchema} A new `JsonSchema` object. */ createSchema(conditionGroups) { const anyOf = []; @@ -125,8 +128,8 @@ class ProfileConditionsUtil { /** * Creates a normalized version of the context object to test, * assigning dependent fields as needed. - * @param context A context object which is used during schema validation. - * @returns A normalized context object. + * @param {object} context A context object which is used during schema validation. + * @returns {object} A normalized context object. */ normalizeContext(context) { const normalizedContext = Object.assign({}, context); -- cgit v1.2.3