我在使用ESLint valid-jsdoc检查时遇到了麻烦,并给了我以下错误。我想念什么吗?我以为我捕获了PageAdminPublication函数所需的有效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}
   */

09-25 17:38