带有回调的 ESLint JSDoc 错误

ESLint JSDoc error with callback

我在使用 ESLint valid-jsdoc 时遇到问题,检查给我以下错误。我错过了什么吗?我以为我捕获了 PageAdminPublication 函数所需的 valid-jsdoc 检查的所有内容(选择器回调很好 [我更新了@Jeremy Rajan 指出的丢失的东西]

import { Mongo } from 'meteor/mongo' // eslint-disable-line no-unused-vars

/**
 * @callback selectorToSearchCb
 * @param {object} selector extra stuff
 */

/**
 * Administrative list publication.  This provides access to all the whole collection with pagination.
 * Only allowed if the user is in the admin role.
 *
 * @param {string} publicationName publication name
 * @param {Mongo.Collection} collection mongo collection
 * @param (selectorToSearchCb) selectorToSearch selector to search function. This is used to convert input selectors to the search object for the find().
 * @param {string} fields an array of field names that would be sent for edit and listing.
 * @return {void}
 */
function PagedAdminPublication(publicationName, collection, selectorToSearch, ...fields) {

ESlint 将无法解析注释,因为 selectorToSearchCb 周围的大括号无效。您需要使用 {selectorToSearchCb} 而不是 (selectorToSearchCb)

以下对我有效:

 /**
   * Administrative list publication.  This provides access to all the whole collection with pagination.
   * Only allowed if the user is in the admin role.
   *
   * @param {string} publicationName publication name
   * @param {Mongo.Collection} collection mongo collection
   * @param {selectorToSearchCb} selectorToSearch selector to search function. This is used to convert input selectors to the search object for the find().
   * @param {string} fields an array of field names that would be sent for edit and listing.
   * @return {void}
   */