gpt4 book ai didi

javascript - ESLint JSDoc 回调错误

转载 作者:行者123 更新时间:2023-12-03 07:10:12 24 4
gpt4 key购买 nike

我在使用 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) {

最佳答案

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

关于javascript - ESLint JSDoc 回调错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36637544/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com