Skip to content

Disable the no-undefined-types rule until template tag defaults work #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion examples/base/mod.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>} [vegetables=[]] The vegetables.
Expand All @@ -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}
Expand Down Expand Up @@ -71,3 +88,19 @@ export class Soup {
return this.vegetables_;
}
}

/**
* @template {Food} [F=Soup]
*/
export class Restaurant {
/**
* @param {Array<F>} menu The menu items.
*/
constructor(menu) {
/**
* @private
* @type {Array<F>}
*/
this.menu_ = [];
}
}
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down