From 4a2e443eca28db652d76673c87132557c24c318d Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Mon, 23 May 2022 14:50:24 -0600 Subject: [PATCH] Disable the no-undefined-types rule until template tag defaults work --- examples/base/mod.js | 35 ++++++++++++++++++++++++++++++++++- index.js | 2 +- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/examples/base/mod.js b/examples/base/mod.js index 96bd0d6..cb307d2 100644 --- a/examples/base/mod.js +++ b/examples/base/mod.js @@ -9,8 +9,23 @@ export function foo() { return obj['bar']; } +/** + * @typedef {Object} FoodOptions + * @property {number} calories The number of calories. + */ + +export class Food { + constructor(options) { + /** + * @type {number} + */ + this.calories = options.calories; + } +} + /** * @typedef {Object} SoupOptions + * @property {number} calories The number of calories. * @property {string} [type='chicken'] The type of soup. * @property {boolean} [noodles=false] Include noodles. * @property {Array} [vegetables=[]] The vegetables. @@ -22,12 +37,14 @@ export function foo() { * * @api */ -export class Soup { +export class Soup extends Food { /** * Construct a soup. * @param {SoupOptions} options The soup options. */ constructor(options) { + super({calories: options.calories}); + /** * @private * @type {string} @@ -71,3 +88,19 @@ export class Soup { return this.vegetables_; } } + +/** + * @template {Food} [F=Soup] + */ +export class Restaurant { + /** + * @param {Array} menu The menu items. + */ + constructor(menu) { + /** + * @private + * @type {Array} + */ + this.menu_ = []; + } +} diff --git a/index.js b/index.js index 47f64aa..467bd7c 100644 --- a/index.js +++ b/index.js @@ -35,7 +35,7 @@ module.exports = { 'jsdoc/empty-tags': 'error', 'jsdoc/implements-on-classes': 'error', 'jsdoc/no-bad-blocks': 'error', - 'jsdoc/no-undefined-types': ['error', {'definedTypes': ['ol']}], + // 'jsdoc/no-undefined-types': ['error', {'definedTypes': ['ol']}], // blocked by https://github.com/gajus/eslint-plugin-jsdoc/issues/887 'jsdoc/require-hyphen-before-param-description': ['error', 'never'], 'jsdoc/require-param': 'error', 'jsdoc/require-param-description': 'error',