简体   繁体   English

ESLint JSDoc错误与回调

[英]ESLint JSDoc error with callback

I'm having trouble with ESLint valid-jsdoc check giving me an error with the following. 我在使用ESLint valid-jsdoc检查时遇到了麻烦,出现以下错误。 Am I missing something? 我想念什么吗? I thought I captured everything that the valid-jsdoc check would need for PageAdminPublication function (the selector callback was fine [I updated to have the missing stuff as noted by @Jeremy Rajan] 我以为我捕获了有效的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) {

ESlint is not going to be able to parse the comment as you have invalid braces around selectorToSearchCb . ESlint将无法解析注释,因为您在selectorToSearchCb周围花括号无效。 You need to use {selectorToSearchCb} and not (selectorToSearchCb) 您需要使用{selectorToSearchCb}而不是(selectorToSearchCb)

The following works for me: 以下对我有用:

 /**
   * 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}
   */

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM