【问题标题】:ESLint JSDoc error with callback带有回调的 ESLint JSDoc 错误
【发布时间】:2016-08-06 20:38:02
【问题描述】:

我在使用 ESLint valid-jsdoc 时遇到问题,请检查给我以下错误。我错过了什么吗?我以为我捕获了valid-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) {

【问题讨论】:

    标签: javascript jsdoc eslint


    【解决方案1】:

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

    【讨论】:

    • Doh derped。谢谢。我不认为这需要堆栈溢出问题:P
    猜你喜欢
    • 1970-01-01
    • 2017-08-30
    • 2020-10-01
    • 2016-11-08
    • 1970-01-01
    • 2021-03-11
    • 2021-09-13
    • 1970-01-01
    • 2021-02-06
    相关资源
    最近更新 更多