带回调的ESLint JSDoc错误

时间:2016-04-15 03:02:10

标签: javascript jsdoc eslint

我在使用ESLint valid-jsdoc时遇到问题,请检查以下错误。我错过了什么吗?我以为我捕获了有效-jsdoc检查需要PageAdminPublication函数的所有内容(选择器回调很好[我更新了@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) {

1 个答案:

答案 0 :(得分:1)

由于selectorToSearchCb周围有无效的大括号,ESlint无法解析评论。您需要使用{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}
   */