eslint-plugin-jsdoc 54.4.1 → 54.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -83,6 +83,10 @@ const OPTIONS_SCHEMA = {
|
|
|
83
83
|
default: false,
|
|
84
84
|
type: 'boolean'
|
|
85
85
|
},
|
|
86
|
+
exemptOverloadedImplementations: {
|
|
87
|
+
default: false,
|
|
88
|
+
type: 'boolean'
|
|
89
|
+
},
|
|
86
90
|
fixerMessage: {
|
|
87
91
|
default: '',
|
|
88
92
|
type: 'string'
|
|
@@ -144,6 +148,10 @@ const OPTIONS_SCHEMA = {
|
|
|
144
148
|
}
|
|
145
149
|
},
|
|
146
150
|
type: 'object'
|
|
151
|
+
},
|
|
152
|
+
skipInterveningOverloadedDeclarations: {
|
|
153
|
+
default: true,
|
|
154
|
+
type: 'boolean'
|
|
147
155
|
}
|
|
148
156
|
},
|
|
149
157
|
type: 'object'
|
|
@@ -249,6 +257,8 @@ const getOption = (context, baseObject, option, key) => {
|
|
|
249
257
|
* enableFixer: boolean,
|
|
250
258
|
* exemptEmptyConstructors: boolean,
|
|
251
259
|
* exemptEmptyFunctions: boolean,
|
|
260
|
+
* skipInterveningOverloadedDeclarations: boolean,
|
|
261
|
+
* exemptOverloadedImplementations: boolean,
|
|
252
262
|
* fixerMessage: string,
|
|
253
263
|
* minLineCount: undefined|import('../iterateJsdoc.js').Integer,
|
|
254
264
|
* publicOnly: boolean|{[key: string]: boolean|undefined}
|
|
@@ -261,15 +271,18 @@ const getOptions = (context, settings) => {
|
|
|
261
271
|
enableFixer = true,
|
|
262
272
|
exemptEmptyConstructors = true,
|
|
263
273
|
exemptEmptyFunctions = false,
|
|
274
|
+
exemptOverloadedImplementations = false,
|
|
264
275
|
fixerMessage = '',
|
|
265
276
|
minLineCount = undefined,
|
|
266
|
-
publicOnly
|
|
277
|
+
publicOnly,
|
|
278
|
+
skipInterveningOverloadedDeclarations = true
|
|
267
279
|
} = context.options[0] || {};
|
|
268
280
|
return {
|
|
269
281
|
contexts,
|
|
270
282
|
enableFixer,
|
|
271
283
|
exemptEmptyConstructors,
|
|
272
284
|
exemptEmptyFunctions,
|
|
285
|
+
exemptOverloadedImplementations,
|
|
273
286
|
fixerMessage,
|
|
274
287
|
minLineCount,
|
|
275
288
|
publicOnly: (baseObj => {
|
|
@@ -300,10 +313,45 @@ const getOptions = (context, settings) => {
|
|
|
300
313
|
}
|
|
301
314
|
return properties;
|
|
302
315
|
})(/** @type {import('json-schema').JSONSchema4Object} */
|
|
303
|
-
OPTIONS_SCHEMA.properties.require)
|
|
316
|
+
OPTIONS_SCHEMA.properties.require),
|
|
317
|
+
skipInterveningOverloadedDeclarations
|
|
304
318
|
};
|
|
305
319
|
};
|
|
306
320
|
|
|
321
|
+
/**
|
|
322
|
+
* @param {ESLintOrTSNode} node
|
|
323
|
+
*/
|
|
324
|
+
const isFunctionWithOverload = node => {
|
|
325
|
+
if (node.type !== 'FunctionDeclaration') {
|
|
326
|
+
return false;
|
|
327
|
+
}
|
|
328
|
+
let parent;
|
|
329
|
+
let child;
|
|
330
|
+
if (node.parent?.type === 'Program') {
|
|
331
|
+
parent = node.parent;
|
|
332
|
+
child = node;
|
|
333
|
+
} else if (node.parent?.type === 'ExportNamedDeclaration' && node.parent?.parent.type === 'Program') {
|
|
334
|
+
parent = node.parent?.parent;
|
|
335
|
+
child = node.parent;
|
|
336
|
+
}
|
|
337
|
+
if (!child || !parent) {
|
|
338
|
+
return false;
|
|
339
|
+
}
|
|
340
|
+
const functionName = node.id.name;
|
|
341
|
+
const idx = parent.body.indexOf(child);
|
|
342
|
+
const prevSibling = parent.body[idx - 1];
|
|
343
|
+
return (
|
|
344
|
+
// @ts-expect-error Should be ok
|
|
345
|
+
prevSibling?.type === 'TSDeclareFunction' &&
|
|
346
|
+
// @ts-expect-error Should be ok
|
|
347
|
+
functionName === prevSibling.id.name || prevSibling?.type === 'ExportNamedDeclaration' &&
|
|
348
|
+
// @ts-expect-error Should be ok
|
|
349
|
+
prevSibling.declaration?.type === 'TSDeclareFunction' &&
|
|
350
|
+
// @ts-expect-error Should be ok
|
|
351
|
+
prevSibling.declaration?.id?.name === functionName
|
|
352
|
+
);
|
|
353
|
+
};
|
|
354
|
+
|
|
307
355
|
/** @type {import('eslint').Rule.RuleModule} */
|
|
308
356
|
var _default = exports.default = {
|
|
309
357
|
create(context) {
|
|
@@ -321,9 +369,11 @@ var _default = exports.default = {
|
|
|
321
369
|
enableFixer,
|
|
322
370
|
exemptEmptyConstructors,
|
|
323
371
|
exemptEmptyFunctions,
|
|
372
|
+
exemptOverloadedImplementations,
|
|
324
373
|
fixerMessage,
|
|
325
374
|
minLineCount,
|
|
326
|
-
require: requireOption
|
|
375
|
+
require: requireOption,
|
|
376
|
+
skipInterveningOverloadedDeclarations
|
|
327
377
|
} = opts;
|
|
328
378
|
const publicOnly =
|
|
329
379
|
/**
|
|
@@ -380,7 +430,12 @@ var _default = exports.default = {
|
|
|
380
430
|
return;
|
|
381
431
|
}
|
|
382
432
|
}
|
|
383
|
-
|
|
433
|
+
if (exemptOverloadedImplementations && isFunctionWithOverload(node)) {
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
const jsDocNode = (0, _jsdoccomment.getJSDocComment)(sourceCode, node, settings, {
|
|
437
|
+
checkOverloads: skipInterveningOverloadedDeclarations
|
|
438
|
+
});
|
|
384
439
|
if (jsDocNode) {
|
|
385
440
|
return;
|
|
386
441
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requireJsdoc.cjs","names":["_exportParser","_interopRequireDefault","require","_iterateJsdoc","_jsdocUtils","_jsdoccomment","e","__esModule","default","OPTIONS_SCHEMA","additionalProperties","properties","checkConstructors","type","checkGetters","anyOf","enum","checkSetters","contexts","items","context","inlineCommentBlock","minLineCount","enableFixer","exemptEmptyConstructors","exemptEmptyFunctions","fixerMessage","publicOnly","oneOf","ancestorsOnly","cjs","esm","window","ArrowFunctionExpression","ClassDeclaration","ClassExpression","FunctionDeclaration","FunctionExpression","MethodDefinition","getMethodOnInterface","interfaceName","methodName","scope","scp","identifiers","name","variables","identifier","interfaceDeclaration","parent","bodyItem","body","methodSig","key","upper","isExemptedImplementer","node","sourceCode","settings","implments","implements","impl","expression","interfaceMethodNode","getScope","comment","getJSDocComment","getOption","baseObject","option","options","getOptions","undefined","baseObj","prop","Object","keys","opt","_default","exports","create","getSourceCode","getSettings","opts","requireOption","checkJsDoc","info","_handler","some","ctxt","count","underMinLine","getText","match","length","contextMinLineCount","find","ctx","selector","jsDocNode","exemptSpeciaMethods","description","inlineTags","problems","source","tags","isFunctionContext","isConstructor","functionParameterNames","getFunctionParameterNames","hasReturnValue","fix","fixer","lines","minLines","maxLines","baseNode","getReducedASTNode","decorator","getDecorator","indent","getIndent","text","loc","start","column","contxt","insertion","repeat","slice","insertTextBefore","report","end","line","messageId","Boolean","initModuleExports","initWindow","exported","exportParser","isUncommentedExport","hasOption","getContextObject","enforcedContexts","includes","value","meta","docs","category","recommended","url","fixable","messages","missingJsDoc","schema","module"],"sources":["../../src/rules/requireJsdoc.js"],"sourcesContent":["import exportParser from '../exportParser.js';\nimport {\n getSettings,\n} from '../iterateJsdoc.js';\nimport {\n enforcedContexts,\n exemptSpeciaMethods,\n getContextObject,\n getFunctionParameterNames,\n getIndent,\n hasReturnValue,\n isConstructor,\n} from '../jsdocUtils.js';\nimport {\n getDecorator,\n getJSDocComment,\n getReducedASTNode,\n} from '@es-joy/jsdoccomment';\n\n/**\n * @typedef {{\n * ancestorsOnly: boolean,\n * esm: boolean,\n * initModuleExports: boolean,\n * initWindow: boolean\n * }} RequireJsdocOpts\n */\n\n/**\n * @typedef {import('eslint').Rule.Node|\n * import('@typescript-eslint/types').TSESTree.Node} ESLintOrTSNode\n */\n\n/** @type {import('json-schema').JSONSchema4} */\nconst OPTIONS_SCHEMA = {\n additionalProperties: false,\n properties: {\n checkConstructors: {\n default: true,\n type: 'boolean',\n },\n checkGetters: {\n anyOf: [\n {\n type: 'boolean',\n },\n {\n enum: [\n 'no-setter',\n ],\n type: 'string',\n },\n ],\n default: true,\n },\n checkSetters: {\n anyOf: [\n {\n type: 'boolean',\n },\n {\n enum: [\n 'no-getter',\n ],\n type: 'string',\n },\n ],\n default: true,\n },\n contexts: {\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n context: {\n type: 'string',\n },\n inlineCommentBlock: {\n type: 'boolean',\n },\n minLineCount: {\n type: 'integer',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n enableFixer: {\n default: true,\n type: 'boolean',\n },\n exemptEmptyConstructors: {\n default: false,\n type: 'boolean',\n },\n exemptEmptyFunctions: {\n default: false,\n type: 'boolean',\n },\n fixerMessage: {\n default: '',\n type: 'string',\n },\n minLineCount: {\n type: 'integer',\n },\n publicOnly: {\n oneOf: [\n {\n default: false,\n type: 'boolean',\n },\n {\n additionalProperties: false,\n default: {},\n properties: {\n ancestorsOnly: {\n type: 'boolean',\n },\n cjs: {\n type: 'boolean',\n },\n esm: {\n type: 'boolean',\n },\n window: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n },\n require: {\n additionalProperties: false,\n default: {},\n properties: {\n ArrowFunctionExpression: {\n default: false,\n type: 'boolean',\n },\n ClassDeclaration: {\n default: false,\n type: 'boolean',\n },\n ClassExpression: {\n default: false,\n type: 'boolean',\n },\n FunctionDeclaration: {\n default: true,\n type: 'boolean',\n },\n FunctionExpression: {\n default: false,\n type: 'boolean',\n },\n MethodDefinition: {\n default: false,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n },\n type: 'object',\n};\n\n/**\n * @param {string} interfaceName\n * @param {string} methodName\n * @param {import(\"eslint\").Scope.Scope | null} scope\n * @returns {import('@typescript-eslint/types').TSESTree.TSMethodSignature|null}\n */\nconst getMethodOnInterface = (interfaceName, methodName, scope) => {\n let scp = scope;\n while (scp) {\n for (const {\n identifiers,\n name,\n } of scp.variables) {\n if (interfaceName !== name) {\n continue;\n }\n\n for (const identifier of identifiers) {\n const interfaceDeclaration = /** @type {import('@typescript-eslint/types').TSESTree.Identifier & {parent: import('@typescript-eslint/types').TSESTree.TSInterfaceDeclaration}} */ (\n identifier\n ).parent;\n /* c8 ignore next 3 -- TS */\n if (interfaceDeclaration.type !== 'TSInterfaceDeclaration') {\n continue;\n }\n\n for (const bodyItem of interfaceDeclaration.body.body) {\n const methodSig = /** @type {import('@typescript-eslint/types').TSESTree.TSMethodSignature} */ (\n bodyItem\n );\n if (methodName === /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (\n methodSig.key\n ).name) {\n return methodSig;\n }\n }\n }\n }\n\n scp = scp.upper;\n }\n\n return null;\n};\n\n/**\n * @param {import('eslint').Rule.Node} node\n * @param {import('eslint').SourceCode} sourceCode\n * @param {import('eslint').Rule.RuleContext} context\n * @param {import('../iterateJsdoc.js').Settings} settings\n */\nconst isExemptedImplementer = (node, sourceCode, context, settings) => {\n if (node.type === 'FunctionExpression' &&\n node.parent.type === 'MethodDefinition' &&\n node.parent.parent.type === 'ClassBody' &&\n node.parent.parent.parent.type === 'ClassDeclaration' &&\n 'implements' in node.parent.parent.parent\n ) {\n const implments = /** @type {import('@typescript-eslint/types').TSESTree.TSClassImplements[]} */ (\n node.parent.parent.parent.implements\n );\n\n const {\n name: methodName,\n } = /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (\n node.parent.key\n );\n\n for (const impl of implments) {\n const {\n name: interfaceName,\n } = /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (\n impl.expression\n );\n\n const interfaceMethodNode = getMethodOnInterface(interfaceName, methodName, node && (\n (sourceCode.getScope &&\n /* c8 ignore next 3 */\n sourceCode.getScope(node)) ||\n // @ts-expect-error ESLint 8\n context.getScope()\n ));\n if (interfaceMethodNode) {\n // @ts-expect-error Ok\n const comment = getJSDocComment(sourceCode, interfaceMethodNode, settings);\n if (comment) {\n return true;\n }\n }\n }\n }\n\n return false;\n};\n\n/**\n * @param {import('eslint').Rule.RuleContext} context\n * @param {import('json-schema').JSONSchema4Object} baseObject\n * @param {string} option\n * @param {string} key\n * @returns {boolean|undefined}\n */\nconst getOption = (context, baseObject, option, key) => {\n if (context.options[0] && option in context.options[0] &&\n // Todo: boolean shouldn't be returning property, but\n // tests currently require\n (typeof context.options[0][option] === 'boolean' ||\n key in context.options[0][option])\n ) {\n return context.options[0][option][key];\n }\n\n return /** @type {{[key: string]: {default?: boolean|undefined}}} */ (\n baseObject.properties\n )[key].default;\n};\n\n/**\n * @param {import('eslint').Rule.RuleContext} context\n * @param {import('../iterateJsdoc.js').Settings} settings\n * @returns {{\n * contexts: (string|{\n * context: string,\n * inlineCommentBlock: boolean,\n * minLineCount: import('../iterateJsdoc.js').Integer\n * })[],\n * enableFixer: boolean,\n * exemptEmptyConstructors: boolean,\n * exemptEmptyFunctions: boolean,\n * fixerMessage: string,\n * minLineCount: undefined|import('../iterateJsdoc.js').Integer,\n * publicOnly: boolean|{[key: string]: boolean|undefined}\n * require: {[key: string]: boolean|undefined}\n * }}\n */\nconst getOptions = (context, settings) => {\n const {\n contexts = settings.contexts || [],\n enableFixer = true,\n exemptEmptyConstructors = true,\n exemptEmptyFunctions = false,\n fixerMessage = '',\n minLineCount = undefined,\n publicOnly,\n } = context.options[0] || {};\n\n return {\n contexts,\n enableFixer,\n exemptEmptyConstructors,\n exemptEmptyFunctions,\n fixerMessage,\n minLineCount,\n publicOnly: ((baseObj) => {\n if (!publicOnly) {\n return false;\n }\n\n /** @type {{[key: string]: boolean|undefined}} */\n const properties = {};\n for (const prop of Object.keys(\n /** @type {import('json-schema').JSONSchema4Object} */ (\n /** @type {import('json-schema').JSONSchema4Object} */ (\n baseObj\n ).properties),\n )) {\n const opt = getOption(\n context,\n /** @type {import('json-schema').JSONSchema4Object} */ (baseObj),\n 'publicOnly',\n prop,\n );\n\n properties[prop] = opt;\n }\n\n return properties;\n })(\n /** @type {import('json-schema').JSONSchema4Object} */\n (\n /** @type {import('json-schema').JSONSchema4Object} */\n (\n /** @type {import('json-schema').JSONSchema4Object} */\n (\n OPTIONS_SCHEMA.properties\n ).publicOnly\n ).oneOf\n )[1],\n ),\n require: ((baseObj) => {\n /** @type {{[key: string]: boolean|undefined}} */\n const properties = {};\n for (const prop of Object.keys(\n /** @type {import('json-schema').JSONSchema4Object} */ (\n /** @type {import('json-schema').JSONSchema4Object} */ (\n baseObj\n ).properties),\n )) {\n const opt = getOption(\n context,\n /** @type {import('json-schema').JSONSchema4Object} */\n (baseObj),\n 'require',\n prop,\n );\n properties[prop] = opt;\n }\n\n return properties;\n })(\n /** @type {import('json-schema').JSONSchema4Object} */\n (OPTIONS_SCHEMA.properties).require,\n ),\n };\n};\n\n/** @type {import('eslint').Rule.RuleModule} */\nexport default {\n create (context) {\n /* c8 ignore next -- Fallback to deprecated method */\n const {\n sourceCode = context.getSourceCode(),\n } = context;\n const settings = getSettings(context);\n if (!settings) {\n return {};\n }\n\n const opts = getOptions(context, settings);\n\n const {\n contexts,\n enableFixer,\n exemptEmptyConstructors,\n exemptEmptyFunctions,\n fixerMessage,\n minLineCount,\n require: requireOption,\n } = opts;\n\n const publicOnly =\n\n /**\n * @type {{\n * [key: string]: boolean | undefined;\n * }}\n */ (\n opts.publicOnly\n );\n\n /**\n * @type {import('../iterateJsdoc.js').CheckJsdoc}\n */\n const checkJsDoc = (info, _handler, node) => {\n if (\n // Optimize\n minLineCount !== undefined || contexts.some((ctxt) => {\n if (typeof ctxt === 'string') {\n return false;\n }\n\n const {\n minLineCount: count,\n } = ctxt;\n return count !== undefined;\n })\n ) {\n /**\n * @param {undefined|import('../iterateJsdoc.js').Integer} count\n */\n const underMinLine = (count) => {\n return count !== undefined && count >\n (sourceCode.getText(node).match(/\\n/gv)?.length ?? 0) + 1;\n };\n\n if (underMinLine(minLineCount)) {\n return;\n }\n\n const {\n minLineCount: contextMinLineCount,\n } =\n /**\n * @type {{\n * context: string;\n * inlineCommentBlock: boolean;\n * minLineCount: number;\n * }}\n */ (contexts.find((ctxt) => {\n if (typeof ctxt === 'string') {\n return false;\n }\n\n const {\n context: ctx,\n } = ctxt;\n return ctx === (info.selector || node.type);\n })) || {};\n if (underMinLine(contextMinLineCount)) {\n return;\n }\n }\n\n const jsDocNode = getJSDocComment(sourceCode, node, settings);\n\n if (jsDocNode) {\n return;\n }\n\n // For those who have options configured against ANY constructors (or\n // setters or getters) being reported\n if (exemptSpeciaMethods(\n {\n description: '',\n inlineTags: [],\n problems: [],\n source: [],\n tags: [],\n },\n node,\n context,\n [\n OPTIONS_SCHEMA,\n ],\n )) {\n return;\n }\n\n if (\n // Avoid reporting param-less, return-less functions (when\n // `exemptEmptyFunctions` option is set)\n exemptEmptyFunctions && info.isFunctionContext ||\n\n // Avoid reporting param-less, return-less constructor methods (when\n // `exemptEmptyConstructors` option is set)\n exemptEmptyConstructors && isConstructor(node)\n ) {\n const functionParameterNames = getFunctionParameterNames(node);\n if (!functionParameterNames.length && !hasReturnValue(node)) {\n return;\n }\n }\n\n if (isExemptedImplementer(node, sourceCode, context, settings)) {\n return;\n }\n\n const fix = /** @type {import('eslint').Rule.ReportFixer} */ (fixer) => {\n // Default to one line break if the `minLines`/`maxLines` settings allow\n const lines = settings.minLines === 0 && settings.maxLines >= 1 ? 1 : settings.minLines;\n /** @type {ESLintOrTSNode|import('@typescript-eslint/types').TSESTree.Decorator} */\n let baseNode = getReducedASTNode(node, sourceCode);\n\n const decorator = getDecorator(\n /** @type {import('eslint').Rule.Node} */\n (baseNode),\n );\n if (decorator) {\n baseNode = decorator;\n }\n\n const indent = getIndent({\n text: sourceCode.getText(\n /** @type {import('eslint').Rule.Node} */ (baseNode),\n /** @type {import('eslint').AST.SourceLocation} */\n (\n /** @type {import('eslint').Rule.Node} */ (baseNode).loc\n ).start.column,\n ),\n });\n\n const {\n inlineCommentBlock,\n } =\n /**\n * @type {{\n * context: string,\n * inlineCommentBlock: boolean,\n * minLineCount: import('../iterateJsdoc.js').Integer\n * }}\n */ (contexts.find((contxt) => {\n if (typeof contxt === 'string') {\n return false;\n }\n\n const {\n context: ctxt,\n } = contxt;\n return ctxt === node.type;\n })) || {};\n const insertion = (inlineCommentBlock ?\n `/** ${fixerMessage}` :\n `/**\\n${indent}*${fixerMessage}\\n${indent}`) +\n `*/${'\\n'.repeat(lines)}${indent.slice(0, -1)}`;\n\n return fixer.insertTextBefore(\n /** @type {import('eslint').Rule.Node} */\n (baseNode),\n insertion,\n );\n };\n\n const report = () => {\n const {\n start,\n } = /** @type {import('eslint').AST.SourceLocation} */ (node.loc);\n const loc = {\n end: {\n column: 0,\n line: start.line + 1,\n },\n start,\n };\n context.report({\n fix: enableFixer ? fix : null,\n loc,\n messageId: 'missingJsDoc',\n node,\n });\n };\n\n if (publicOnly) {\n /** @type {RequireJsdocOpts} */\n const opt = {\n ancestorsOnly: Boolean(publicOnly?.ancestorsOnly ?? false),\n esm: Boolean(publicOnly?.esm ?? true),\n initModuleExports: Boolean(publicOnly?.cjs ?? true),\n initWindow: Boolean(publicOnly?.window ?? false),\n };\n const exported = exportParser.isUncommentedExport(node, sourceCode, opt, settings);\n\n if (exported) {\n report();\n }\n } else {\n report();\n }\n };\n\n /**\n * @param {string} prop\n * @returns {boolean}\n */\n const hasOption = (prop) => {\n return requireOption[prop] || contexts.some((ctxt) => {\n return typeof ctxt === 'object' ? ctxt.context === prop : ctxt === prop;\n });\n };\n\n return {\n ...getContextObject(\n enforcedContexts(context, [], settings),\n checkJsDoc,\n ),\n ArrowFunctionExpression (node) {\n if (!hasOption('ArrowFunctionExpression')) {\n return;\n }\n\n if (\n [\n 'AssignmentExpression', 'ExportDefaultDeclaration', 'VariableDeclarator',\n ].includes(node.parent.type) ||\n [\n 'ClassProperty', 'ObjectProperty', 'Property', 'PropertyDefinition',\n ].includes(node.parent.type) &&\n node ===\n /**\n * @type {import('@typescript-eslint/types').TSESTree.Property|\n * import('@typescript-eslint/types').TSESTree.PropertyDefinition\n * }\n */\n (node.parent).value\n ) {\n checkJsDoc({\n isFunctionContext: true,\n }, null, node);\n }\n },\n\n ClassDeclaration (node) {\n if (!hasOption('ClassDeclaration')) {\n return;\n }\n\n checkJsDoc({\n isFunctionContext: false,\n }, null, node);\n },\n\n ClassExpression (node) {\n if (!hasOption('ClassExpression')) {\n return;\n }\n\n checkJsDoc({\n isFunctionContext: false,\n }, null, node);\n },\n\n FunctionDeclaration (node) {\n if (!hasOption('FunctionDeclaration')) {\n return;\n }\n\n checkJsDoc({\n isFunctionContext: true,\n }, null, node);\n },\n\n FunctionExpression (node) {\n if (!hasOption('FunctionExpression')) {\n return;\n }\n\n if (\n [\n 'AssignmentExpression', 'ExportDefaultDeclaration', 'VariableDeclarator',\n ].includes(node.parent.type) ||\n [\n 'ClassProperty', 'ObjectProperty', 'Property', 'PropertyDefinition',\n ].includes(node.parent.type) &&\n node ===\n /**\n * @type {import('@typescript-eslint/types').TSESTree.Property|\n * import('@typescript-eslint/types').TSESTree.PropertyDefinition\n * }\n */\n (node.parent).value\n ) {\n checkJsDoc({\n isFunctionContext: true,\n }, null, node);\n }\n },\n\n MethodDefinition (node) {\n if (!hasOption('MethodDefinition')) {\n return;\n }\n\n checkJsDoc({\n isFunctionContext: true,\n selector: 'MethodDefinition',\n }, null, /** @type {import('eslint').Rule.Node} */ (node.value));\n },\n };\n },\n meta: {\n docs: {\n category: 'Stylistic Issues',\n description: 'Require JSDoc comments',\n recommended: true,\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-jsdoc.md#repos-sticky-header',\n },\n\n fixable: 'code',\n\n messages: {\n missingJsDoc: 'Missing JSDoc comment.',\n },\n\n schema: [\n OPTIONS_SCHEMA,\n ],\n\n type: 'suggestion',\n },\n};\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAGA,IAAAE,WAAA,GAAAF,OAAA;AASA,IAAAG,aAAA,GAAAH,OAAA;AAI8B,SAAAD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AQ,EAAE;MACRC,YAAY,EAAE;IAChB,CAAC;IAEDC,MAAM,EAAE,CACNjJ,cAAc,CACf;IAEDI,IAAI,EAAE;EACR;AACF,CAAC;AAAA8I,MAAA,CAAA5E,OAAA,GAAAA,OAAA,CAAAvE,OAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"requireJsdoc.cjs","names":["_exportParser","_interopRequireDefault","require","_iterateJsdoc","_jsdocUtils","_jsdoccomment","e","__esModule","default","OPTIONS_SCHEMA","additionalProperties","properties","checkConstructors","type","checkGetters","anyOf","enum","checkSetters","contexts","items","context","inlineCommentBlock","minLineCount","enableFixer","exemptEmptyConstructors","exemptEmptyFunctions","exemptOverloadedImplementations","fixerMessage","publicOnly","oneOf","ancestorsOnly","cjs","esm","window","ArrowFunctionExpression","ClassDeclaration","ClassExpression","FunctionDeclaration","FunctionExpression","MethodDefinition","skipInterveningOverloadedDeclarations","getMethodOnInterface","interfaceName","methodName","scope","scp","identifiers","name","variables","identifier","interfaceDeclaration","parent","bodyItem","body","methodSig","key","upper","isExemptedImplementer","node","sourceCode","settings","implments","implements","impl","expression","interfaceMethodNode","getScope","comment","getJSDocComment","getOption","baseObject","option","options","getOptions","undefined","baseObj","prop","Object","keys","opt","isFunctionWithOverload","child","functionName","id","idx","indexOf","prevSibling","declaration","_default","exports","create","getSourceCode","getSettings","opts","requireOption","checkJsDoc","info","_handler","some","ctxt","count","underMinLine","getText","match","length","contextMinLineCount","find","ctx","selector","jsDocNode","checkOverloads","exemptSpeciaMethods","description","inlineTags","problems","source","tags","isFunctionContext","isConstructor","functionParameterNames","getFunctionParameterNames","hasReturnValue","fix","fixer","lines","minLines","maxLines","baseNode","getReducedASTNode","decorator","getDecorator","indent","getIndent","text","loc","start","column","contxt","insertion","repeat","slice","insertTextBefore","report","end","line","messageId","Boolean","initModuleExports","initWindow","exported","exportParser","isUncommentedExport","hasOption","getContextObject","enforcedContexts","includes","value","meta","docs","category","recommended","url","fixable","messages","missingJsDoc","schema","module"],"sources":["../../src/rules/requireJsdoc.js"],"sourcesContent":["import exportParser from '../exportParser.js';\nimport {\n getSettings,\n} from '../iterateJsdoc.js';\nimport {\n enforcedContexts,\n exemptSpeciaMethods,\n getContextObject,\n getFunctionParameterNames,\n getIndent,\n hasReturnValue,\n isConstructor,\n} from '../jsdocUtils.js';\nimport {\n getDecorator,\n getJSDocComment,\n getReducedASTNode,\n} from '@es-joy/jsdoccomment';\n\n/**\n * @typedef {{\n * ancestorsOnly: boolean,\n * esm: boolean,\n * initModuleExports: boolean,\n * initWindow: boolean\n * }} RequireJsdocOpts\n */\n\n/**\n * @typedef {import('eslint').Rule.Node|\n * import('@typescript-eslint/types').TSESTree.Node} ESLintOrTSNode\n */\n\n/** @type {import('json-schema').JSONSchema4} */\nconst OPTIONS_SCHEMA = {\n additionalProperties: false,\n properties: {\n checkConstructors: {\n default: true,\n type: 'boolean',\n },\n checkGetters: {\n anyOf: [\n {\n type: 'boolean',\n },\n {\n enum: [\n 'no-setter',\n ],\n type: 'string',\n },\n ],\n default: true,\n },\n checkSetters: {\n anyOf: [\n {\n type: 'boolean',\n },\n {\n enum: [\n 'no-getter',\n ],\n type: 'string',\n },\n ],\n default: true,\n },\n contexts: {\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n context: {\n type: 'string',\n },\n inlineCommentBlock: {\n type: 'boolean',\n },\n minLineCount: {\n type: 'integer',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n enableFixer: {\n default: true,\n type: 'boolean',\n },\n exemptEmptyConstructors: {\n default: false,\n type: 'boolean',\n },\n exemptEmptyFunctions: {\n default: false,\n type: 'boolean',\n },\n exemptOverloadedImplementations: {\n default: false,\n type: 'boolean',\n },\n fixerMessage: {\n default: '',\n type: 'string',\n },\n minLineCount: {\n type: 'integer',\n },\n publicOnly: {\n oneOf: [\n {\n default: false,\n type: 'boolean',\n },\n {\n additionalProperties: false,\n default: {},\n properties: {\n ancestorsOnly: {\n type: 'boolean',\n },\n cjs: {\n type: 'boolean',\n },\n esm: {\n type: 'boolean',\n },\n window: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n },\n require: {\n additionalProperties: false,\n default: {},\n properties: {\n ArrowFunctionExpression: {\n default: false,\n type: 'boolean',\n },\n ClassDeclaration: {\n default: false,\n type: 'boolean',\n },\n ClassExpression: {\n default: false,\n type: 'boolean',\n },\n FunctionDeclaration: {\n default: true,\n type: 'boolean',\n },\n FunctionExpression: {\n default: false,\n type: 'boolean',\n },\n MethodDefinition: {\n default: false,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n skipInterveningOverloadedDeclarations: {\n default: true,\n type: 'boolean',\n },\n },\n type: 'object',\n};\n\n/**\n * @param {string} interfaceName\n * @param {string} methodName\n * @param {import(\"eslint\").Scope.Scope | null} scope\n * @returns {import('@typescript-eslint/types').TSESTree.TSMethodSignature|null}\n */\nconst getMethodOnInterface = (interfaceName, methodName, scope) => {\n let scp = scope;\n while (scp) {\n for (const {\n identifiers,\n name,\n } of scp.variables) {\n if (interfaceName !== name) {\n continue;\n }\n\n for (const identifier of identifiers) {\n const interfaceDeclaration = /** @type {import('@typescript-eslint/types').TSESTree.Identifier & {parent: import('@typescript-eslint/types').TSESTree.TSInterfaceDeclaration}} */ (\n identifier\n ).parent;\n /* c8 ignore next 3 -- TS */\n if (interfaceDeclaration.type !== 'TSInterfaceDeclaration') {\n continue;\n }\n\n for (const bodyItem of interfaceDeclaration.body.body) {\n const methodSig = /** @type {import('@typescript-eslint/types').TSESTree.TSMethodSignature} */ (\n bodyItem\n );\n if (methodName === /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (\n methodSig.key\n ).name) {\n return methodSig;\n }\n }\n }\n }\n\n scp = scp.upper;\n }\n\n return null;\n};\n\n/**\n * @param {import('eslint').Rule.Node} node\n * @param {import('eslint').SourceCode} sourceCode\n * @param {import('eslint').Rule.RuleContext} context\n * @param {import('../iterateJsdoc.js').Settings} settings\n */\nconst isExemptedImplementer = (node, sourceCode, context, settings) => {\n if (node.type === 'FunctionExpression' &&\n node.parent.type === 'MethodDefinition' &&\n node.parent.parent.type === 'ClassBody' &&\n node.parent.parent.parent.type === 'ClassDeclaration' &&\n 'implements' in node.parent.parent.parent\n ) {\n const implments = /** @type {import('@typescript-eslint/types').TSESTree.TSClassImplements[]} */ (\n node.parent.parent.parent.implements\n );\n\n const {\n name: methodName,\n } = /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (\n node.parent.key\n );\n\n for (const impl of implments) {\n const {\n name: interfaceName,\n } = /** @type {import('@typescript-eslint/types').TSESTree.Identifier} */ (\n impl.expression\n );\n\n const interfaceMethodNode = getMethodOnInterface(interfaceName, methodName, node && (\n (sourceCode.getScope &&\n /* c8 ignore next 3 */\n sourceCode.getScope(node)) ||\n // @ts-expect-error ESLint 8\n context.getScope()\n ));\n if (interfaceMethodNode) {\n // @ts-expect-error Ok\n const comment = getJSDocComment(sourceCode, interfaceMethodNode, settings);\n if (comment) {\n return true;\n }\n }\n }\n }\n\n return false;\n};\n\n/**\n * @param {import('eslint').Rule.RuleContext} context\n * @param {import('json-schema').JSONSchema4Object} baseObject\n * @param {string} option\n * @param {string} key\n * @returns {boolean|undefined}\n */\nconst getOption = (context, baseObject, option, key) => {\n if (context.options[0] && option in context.options[0] &&\n // Todo: boolean shouldn't be returning property, but\n // tests currently require\n (typeof context.options[0][option] === 'boolean' ||\n key in context.options[0][option])\n ) {\n return context.options[0][option][key];\n }\n\n return /** @type {{[key: string]: {default?: boolean|undefined}}} */ (\n baseObject.properties\n )[key].default;\n};\n\n/**\n * @param {import('eslint').Rule.RuleContext} context\n * @param {import('../iterateJsdoc.js').Settings} settings\n * @returns {{\n * contexts: (string|{\n * context: string,\n * inlineCommentBlock: boolean,\n * minLineCount: import('../iterateJsdoc.js').Integer\n * })[],\n * enableFixer: boolean,\n * exemptEmptyConstructors: boolean,\n * exemptEmptyFunctions: boolean,\n * skipInterveningOverloadedDeclarations: boolean,\n * exemptOverloadedImplementations: boolean,\n * fixerMessage: string,\n * minLineCount: undefined|import('../iterateJsdoc.js').Integer,\n * publicOnly: boolean|{[key: string]: boolean|undefined}\n * require: {[key: string]: boolean|undefined}\n * }}\n */\nconst getOptions = (context, settings) => {\n const {\n contexts = settings.contexts || [],\n enableFixer = true,\n exemptEmptyConstructors = true,\n exemptEmptyFunctions = false,\n exemptOverloadedImplementations = false,\n fixerMessage = '',\n minLineCount = undefined,\n publicOnly,\n skipInterveningOverloadedDeclarations = true,\n } = context.options[0] || {};\n\n return {\n contexts,\n enableFixer,\n exemptEmptyConstructors,\n exemptEmptyFunctions,\n exemptOverloadedImplementations,\n fixerMessage,\n minLineCount,\n publicOnly: ((baseObj) => {\n if (!publicOnly) {\n return false;\n }\n\n /** @type {{[key: string]: boolean|undefined}} */\n const properties = {};\n for (const prop of Object.keys(\n /** @type {import('json-schema').JSONSchema4Object} */ (\n /** @type {import('json-schema').JSONSchema4Object} */ (\n baseObj\n ).properties),\n )) {\n const opt = getOption(\n context,\n /** @type {import('json-schema').JSONSchema4Object} */ (baseObj),\n 'publicOnly',\n prop,\n );\n\n properties[prop] = opt;\n }\n\n return properties;\n })(\n /** @type {import('json-schema').JSONSchema4Object} */\n (\n /** @type {import('json-schema').JSONSchema4Object} */\n (\n /** @type {import('json-schema').JSONSchema4Object} */\n (\n OPTIONS_SCHEMA.properties\n ).publicOnly\n ).oneOf\n )[1],\n ),\n require: ((baseObj) => {\n /** @type {{[key: string]: boolean|undefined}} */\n const properties = {};\n for (const prop of Object.keys(\n /** @type {import('json-schema').JSONSchema4Object} */ (\n /** @type {import('json-schema').JSONSchema4Object} */ (\n baseObj\n ).properties),\n )) {\n const opt = getOption(\n context,\n /** @type {import('json-schema').JSONSchema4Object} */\n (baseObj),\n 'require',\n prop,\n );\n properties[prop] = opt;\n }\n\n return properties;\n })(\n /** @type {import('json-schema').JSONSchema4Object} */\n (OPTIONS_SCHEMA.properties).require,\n ),\n skipInterveningOverloadedDeclarations,\n };\n};\n\n/**\n * @param {ESLintOrTSNode} node\n */\nconst isFunctionWithOverload = (node) => {\n if (node.type !== 'FunctionDeclaration') {\n return false;\n }\n\n let parent;\n let child;\n\n if (node.parent?.type === 'Program') {\n parent = node.parent;\n child = node;\n } else if (node.parent?.type === 'ExportNamedDeclaration' &&\n node.parent?.parent.type === 'Program') {\n parent = node.parent?.parent;\n child = node.parent;\n }\n\n if (!child || !parent) {\n return false;\n }\n\n const functionName = node.id.name;\n\n const idx = parent.body.indexOf(child);\n const prevSibling = parent.body[idx - 1];\n\n return (\n // @ts-expect-error Should be ok\n (prevSibling?.type === 'TSDeclareFunction' &&\n // @ts-expect-error Should be ok\n functionName === prevSibling.id.name) ||\n (prevSibling?.type === 'ExportNamedDeclaration' &&\n // @ts-expect-error Should be ok\n prevSibling.declaration?.type === 'TSDeclareFunction' &&\n // @ts-expect-error Should be ok\n prevSibling.declaration?.id?.name === functionName)\n );\n};\n\n/** @type {import('eslint').Rule.RuleModule} */\nexport default {\n create (context) {\n /* c8 ignore next -- Fallback to deprecated method */\n const {\n sourceCode = context.getSourceCode(),\n } = context;\n const settings = getSettings(context);\n if (!settings) {\n return {};\n }\n\n const opts = getOptions(context, settings);\n\n const {\n contexts,\n enableFixer,\n exemptEmptyConstructors,\n exemptEmptyFunctions,\n exemptOverloadedImplementations,\n fixerMessage,\n minLineCount,\n require: requireOption,\n skipInterveningOverloadedDeclarations,\n } = opts;\n\n const publicOnly =\n\n /**\n * @type {{\n * [key: string]: boolean | undefined;\n * }}\n */ (\n opts.publicOnly\n );\n\n /**\n * @type {import('../iterateJsdoc.js').CheckJsdoc}\n */\n const checkJsDoc = (info, _handler, node) => {\n if (\n // Optimize\n minLineCount !== undefined || contexts.some((ctxt) => {\n if (typeof ctxt === 'string') {\n return false;\n }\n\n const {\n minLineCount: count,\n } = ctxt;\n return count !== undefined;\n })\n ) {\n /**\n * @param {undefined|import('../iterateJsdoc.js').Integer} count\n */\n const underMinLine = (count) => {\n return count !== undefined && count >\n (sourceCode.getText(node).match(/\\n/gv)?.length ?? 0) + 1;\n };\n\n if (underMinLine(minLineCount)) {\n return;\n }\n\n const {\n minLineCount: contextMinLineCount,\n } =\n /**\n * @type {{\n * context: string;\n * inlineCommentBlock: boolean;\n * minLineCount: number;\n * }}\n */ (contexts.find((ctxt) => {\n if (typeof ctxt === 'string') {\n return false;\n }\n\n const {\n context: ctx,\n } = ctxt;\n return ctx === (info.selector || node.type);\n })) || {};\n if (underMinLine(contextMinLineCount)) {\n return;\n }\n }\n\n if (exemptOverloadedImplementations && isFunctionWithOverload(node)) {\n return;\n }\n\n const jsDocNode = getJSDocComment(\n sourceCode, node, settings, {\n checkOverloads: skipInterveningOverloadedDeclarations,\n },\n );\n\n if (jsDocNode) {\n return;\n }\n\n // For those who have options configured against ANY constructors (or\n // setters or getters) being reported\n if (exemptSpeciaMethods(\n {\n description: '',\n inlineTags: [],\n problems: [],\n source: [],\n tags: [],\n },\n node,\n context,\n [\n OPTIONS_SCHEMA,\n ],\n )) {\n return;\n }\n\n if (\n // Avoid reporting param-less, return-less functions (when\n // `exemptEmptyFunctions` option is set)\n exemptEmptyFunctions && info.isFunctionContext ||\n\n // Avoid reporting param-less, return-less constructor methods (when\n // `exemptEmptyConstructors` option is set)\n exemptEmptyConstructors && isConstructor(node)\n ) {\n const functionParameterNames = getFunctionParameterNames(node);\n if (!functionParameterNames.length && !hasReturnValue(node)) {\n return;\n }\n }\n\n if (isExemptedImplementer(node, sourceCode, context, settings)) {\n return;\n }\n\n const fix = /** @type {import('eslint').Rule.ReportFixer} */ (fixer) => {\n // Default to one line break if the `minLines`/`maxLines` settings allow\n const lines = settings.minLines === 0 && settings.maxLines >= 1 ? 1 : settings.minLines;\n /** @type {ESLintOrTSNode|import('@typescript-eslint/types').TSESTree.Decorator} */\n let baseNode = getReducedASTNode(node, sourceCode);\n\n const decorator = getDecorator(\n /** @type {import('eslint').Rule.Node} */\n (baseNode),\n );\n if (decorator) {\n baseNode = decorator;\n }\n\n const indent = getIndent({\n text: sourceCode.getText(\n /** @type {import('eslint').Rule.Node} */ (baseNode),\n /** @type {import('eslint').AST.SourceLocation} */\n (\n /** @type {import('eslint').Rule.Node} */ (baseNode).loc\n ).start.column,\n ),\n });\n\n const {\n inlineCommentBlock,\n } =\n /**\n * @type {{\n * context: string,\n * inlineCommentBlock: boolean,\n * minLineCount: import('../iterateJsdoc.js').Integer\n * }}\n */ (contexts.find((contxt) => {\n if (typeof contxt === 'string') {\n return false;\n }\n\n const {\n context: ctxt,\n } = contxt;\n return ctxt === node.type;\n })) || {};\n const insertion = (inlineCommentBlock ?\n `/** ${fixerMessage}` :\n `/**\\n${indent}*${fixerMessage}\\n${indent}`) +\n `*/${'\\n'.repeat(lines)}${indent.slice(0, -1)}`;\n\n return fixer.insertTextBefore(\n /** @type {import('eslint').Rule.Node} */\n (baseNode),\n insertion,\n );\n };\n\n const report = () => {\n const {\n start,\n } = /** @type {import('eslint').AST.SourceLocation} */ (node.loc);\n const loc = {\n end: {\n column: 0,\n line: start.line + 1,\n },\n start,\n };\n context.report({\n fix: enableFixer ? fix : null,\n loc,\n messageId: 'missingJsDoc',\n node,\n });\n };\n\n if (publicOnly) {\n /** @type {RequireJsdocOpts} */\n const opt = {\n ancestorsOnly: Boolean(publicOnly?.ancestorsOnly ?? false),\n esm: Boolean(publicOnly?.esm ?? true),\n initModuleExports: Boolean(publicOnly?.cjs ?? true),\n initWindow: Boolean(publicOnly?.window ?? false),\n };\n const exported = exportParser.isUncommentedExport(node, sourceCode, opt, settings);\n\n if (exported) {\n report();\n }\n } else {\n report();\n }\n };\n\n /**\n * @param {string} prop\n * @returns {boolean}\n */\n const hasOption = (prop) => {\n return requireOption[prop] || contexts.some((ctxt) => {\n return typeof ctxt === 'object' ? ctxt.context === prop : ctxt === prop;\n });\n };\n\n return {\n ...getContextObject(\n enforcedContexts(context, [], settings),\n checkJsDoc,\n ),\n ArrowFunctionExpression (node) {\n if (!hasOption('ArrowFunctionExpression')) {\n return;\n }\n\n if (\n [\n 'AssignmentExpression', 'ExportDefaultDeclaration', 'VariableDeclarator',\n ].includes(node.parent.type) ||\n [\n 'ClassProperty', 'ObjectProperty', 'Property', 'PropertyDefinition',\n ].includes(node.parent.type) &&\n node ===\n /**\n * @type {import('@typescript-eslint/types').TSESTree.Property|\n * import('@typescript-eslint/types').TSESTree.PropertyDefinition\n * }\n */\n (node.parent).value\n ) {\n checkJsDoc({\n isFunctionContext: true,\n }, null, node);\n }\n },\n\n ClassDeclaration (node) {\n if (!hasOption('ClassDeclaration')) {\n return;\n }\n\n checkJsDoc({\n isFunctionContext: false,\n }, null, node);\n },\n\n ClassExpression (node) {\n if (!hasOption('ClassExpression')) {\n return;\n }\n\n checkJsDoc({\n isFunctionContext: false,\n }, null, node);\n },\n\n FunctionDeclaration (node) {\n if (!hasOption('FunctionDeclaration')) {\n return;\n }\n\n checkJsDoc({\n isFunctionContext: true,\n }, null, node);\n },\n\n FunctionExpression (node) {\n if (!hasOption('FunctionExpression')) {\n return;\n }\n\n if (\n [\n 'AssignmentExpression', 'ExportDefaultDeclaration', 'VariableDeclarator',\n ].includes(node.parent.type) ||\n [\n 'ClassProperty', 'ObjectProperty', 'Property', 'PropertyDefinition',\n ].includes(node.parent.type) &&\n node ===\n /**\n * @type {import('@typescript-eslint/types').TSESTree.Property|\n * import('@typescript-eslint/types').TSESTree.PropertyDefinition\n * }\n */\n (node.parent).value\n ) {\n checkJsDoc({\n isFunctionContext: true,\n }, null, node);\n }\n },\n\n MethodDefinition (node) {\n if (!hasOption('MethodDefinition')) {\n return;\n }\n\n checkJsDoc({\n isFunctionContext: true,\n selector: 'MethodDefinition',\n }, null, /** @type {import('eslint').Rule.Node} */ (node.value));\n },\n };\n },\n meta: {\n docs: {\n category: 'Stylistic Issues',\n description: 'Require JSDoc comments',\n recommended: true,\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-jsdoc.md#repos-sticky-header',\n },\n\n fixable: 'code',\n\n messages: {\n missingJsDoc: 'Missing JSDoc comment.',\n },\n\n schema: [\n OPTIONS_SCHEMA,\n ],\n\n type: 'suggestion',\n },\n};\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAGA,IAAAE,WAAA,GAAAF,OAAA;AASA,IAAAG,aAAA,GAAAH,OAAA;AAI8B,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,MAAMG,cAAc,GAAG;EACrBC,oBAAoB,EAAE,KAAK;EAC3BC,UAAU,EAAE;IACVC,iBAAiB,EAAE;MACjBJ,OAAO,EAAE,IAAI;MACbK,IAAI,EAAE;IACR,CAAC;IACDC,YAAY,EAAE;MACZC,KAAK,EAAE,CACL;QACEF,IAAI,EAAE;MACR,CAAC,EACD;QACEG,IAAI,EAAE,CACJ,WAAW,CACZ;QACDH,IAAI,EAAE;MACR,CAAC,CACF;MACDL,OAAO,EAAE;IACX,CAAC;IACDS,YAAY,EAAE;MACZF,KAAK,EAAE,CACL;QACEF,IAAI,EAAE;MACR,CAAC,EACD;QACEG,IAAI,EAAE,CACJ,WAAW,CACZ;QACDH,IAAI,EAAE;MACR,CAAC,CACF;MACDL,OAAO,EAAE;IACX,CAAC;IACDU,QAAQ,EAAE;MACRC,KAAK,EAAE;QACLJ,KAAK,EAAE,CACL;UACEF,IAAI,EAAE;QACR,CAAC,EACD;UACEH,oBAAoB,EAAE,KAAK;UAC3BC,UAAU,EAAE;YACVS,OAAO,EAAE;cACPP,IAAI,EAAE;YACR,CAAC;YACDQ,kBAAkB,EAAE;cAClBR,IAAI,EAAE;YACR,CAAC;YACDS,YAAY,EAAE;cACZT,IAAI,EAAE;YACR;UACF,CAAC;UACDA,IAAI,EA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AACA;QACeA,IAAI,CAACP,MAAM,CAAEyG,KAAK,EACvB;UACA7D,UAAU,CAAC;YACTsB,iBAAiB,EAAE;UACrB,CAAC,EAAE,IAAI,EAAE3D,IAAI,CAAC;QAChB;MACF,CAAC;MAEDnB,gBAAgBA,CAAEmB,IAAI,EAAE;QACtB,IAAI,CAAC8F,SAAS,CAAC,kBAAkB,CAAC,EAAE;UAClC;QACF;QAEAzD,UAAU,CAAC;UACTsB,iBAAiB,EAAE,IAAI;UACvBT,QAAQ,EAAE;QACZ,CAAC,EAAE,IAAI,EAAE,yCAA2ClD,IAAI,CAACkG,KAAM,CAAC;MAClE;IACF,CAAC;EACH,CAAC;EACDC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJC,QAAQ,EAAE,kBAAkB;MAC5B/C,WAAW,EAAE,wBAAwB;MACrCgD,WAAW,EAAE,IAAI;MACjBC,GAAG,EAAE;IACP,CAAC;IAEDC,OAAO,EAAE,MAAM;IAEfC,QAAQ,EAAE;MACRC,YAAY,EAAE;IAChB,CAAC;IAEDC,MAAM,EAAE,CACN5J,cAAc,CACf;IAEDI,IAAI,EAAE;EACR;AACF,CAAC;AAAAyJ,MAAA,CAAA7E,OAAA,GAAAA,OAAA,CAAAjF,OAAA","ignoreList":[]}
|
|
@@ -40,6 +40,7 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
40
40
|
/**
|
|
41
41
|
* @param {import('@typescript-eslint/types').TSESTree.FunctionDeclaration|
|
|
42
42
|
* import('@typescript-eslint/types').TSESTree.ClassDeclaration|
|
|
43
|
+
* import('@typescript-eslint/types').TSESTree.TSDeclareFunction|
|
|
43
44
|
* import('@typescript-eslint/types').TSESTree.TSInterfaceDeclaration|
|
|
44
45
|
* import('@typescript-eslint/types').TSESTree.TSTypeAliasDeclaration} aliasDeclaration
|
|
45
46
|
*/
|
|
@@ -73,6 +74,7 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
73
74
|
switch (nde.type) {
|
|
74
75
|
case 'ClassDeclaration':
|
|
75
76
|
case 'FunctionDeclaration':
|
|
77
|
+
case 'TSDeclareFunction':
|
|
76
78
|
case 'TSInterfaceDeclaration':
|
|
77
79
|
case 'TSTypeAliasDeclaration':
|
|
78
80
|
checkTypeParams(nde);
|
|
@@ -90,6 +92,7 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
90
92
|
switch (nde.declaration?.type) {
|
|
91
93
|
case 'ClassDeclaration':
|
|
92
94
|
case 'FunctionDeclaration':
|
|
95
|
+
case 'TSDeclareFunction':
|
|
93
96
|
case 'TSInterfaceDeclaration':
|
|
94
97
|
case 'TSTypeAliasDeclaration':
|
|
95
98
|
checkTypeParams(nde.declaration);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requireTemplate.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","_jsdoccomment","e","__esModule","default","_default","exports","iterateJsdoc","context","node","report","settings","utils","avoidDocs","requireSeparateTemplates","options","mode","usedNames","Set","templateTags","getTags","templateNames","flatMap","tag","parseClosureTemplateTag","names","length","checkTypeParams","aliasDeclaration","params","typeParameters","name","add","usedName","includes","handleTypes","nde","type","declaration","usedNameToTag","Map","checkForUsedTypes","potentialTag","parsedType","tryParseType","parseType","traverse","value","test","has","set","checkTagsAndTemplates","tagNames","tagName","preferredTagName","getPreferredTagName","matchingTags","matchingTag","get","callbackTags","functionTags","typedefTags","potentialTypedef","iterateAllJsdocs","meta","docs","description","url","schema","additionalProperties","properties","exemptedBy","items","module"],"sources":["../../src/rules/requireTemplate.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\nimport {\n parse as parseType,\n traverse,\n tryParse as tryParseType,\n} from '@es-joy/jsdoccomment';\n\nexport default iterateJsdoc(({\n context,\n node,\n report,\n settings,\n utils,\n}) => {\n if (utils.avoidDocs()) {\n return;\n }\n\n const {\n requireSeparateTemplates = false,\n } = context.options[0] || {};\n\n const {\n mode,\n } = settings;\n\n const usedNames = new Set();\n const templateTags = utils.getTags('template');\n const templateNames = templateTags.flatMap((tag) => {\n return utils.parseClosureTemplateTag(tag);\n });\n\n if (requireSeparateTemplates) {\n for (const tag of templateTags) {\n const names = utils.parseClosureTemplateTag(tag);\n if (names.length > 1) {\n report(`Missing separate @template for ${names[1]}`, null, tag);\n }\n }\n }\n\n /**\n * @param {import('@typescript-eslint/types').TSESTree.FunctionDeclaration|\n * import('@typescript-eslint/types').TSESTree.ClassDeclaration|\n * import('@typescript-eslint/types').TSESTree.TSInterfaceDeclaration|\n * import('@typescript-eslint/types').TSESTree.TSTypeAliasDeclaration} aliasDeclaration\n */\n const checkTypeParams = (aliasDeclaration) => {\n const {\n params,\n /* c8 ignore next -- Guard */\n } = aliasDeclaration.typeParameters ?? {\n /* c8 ignore next -- Guard */\n params: [],\n };\n for (const {\n name: {\n name,\n },\n } of params) {\n usedNames.add(name);\n }\n\n for (const usedName of usedNames) {\n if (!templateNames.includes(usedName)) {\n report(`Missing @template ${usedName}`);\n }\n }\n };\n\n const handleTypes = () => {\n const nde = /** @type {import('@typescript-eslint/types').TSESTree.Node} */ (\n node\n );\n if (!nde) {\n return;\n }\n\n switch (nde.type) {\n case 'ClassDeclaration':\n case 'FunctionDeclaration':\n case 'TSInterfaceDeclaration':\n case 'TSTypeAliasDeclaration':\n checkTypeParams(nde);\n break;\n case 'ExportDefaultDeclaration':\n switch (nde.declaration?.type) {\n case 'ClassDeclaration':\n case 'FunctionDeclaration':\n case 'TSInterfaceDeclaration':\n checkTypeParams(nde.declaration);\n break;\n }\n\n break;\n case 'ExportNamedDeclaration':\n switch (nde.declaration?.type) {\n case 'ClassDeclaration':\n case 'FunctionDeclaration':\n case 'TSInterfaceDeclaration':\n case 'TSTypeAliasDeclaration':\n checkTypeParams(nde.declaration);\n break;\n }\n\n break;\n }\n };\n\n const usedNameToTag = new Map();\n\n /**\n * @param {import('comment-parser').Spec} potentialTag\n */\n const checkForUsedTypes = (potentialTag) => {\n let parsedType;\n try {\n parsedType = mode === 'permissive' ?\n tryParseType(/** @type {string} */ (potentialTag.type)) :\n parseType(/** @type {string} */ (potentialTag.type), mode);\n } catch {\n return;\n }\n\n traverse(parsedType, (nde) => {\n const {\n type,\n value,\n } = /** @type {import('jsdoc-type-pratt-parser').NameResult} */ (nde);\n if (type === 'JsdocTypeName' && (/^[A-Z]$/v).test(value)) {\n usedNames.add(value);\n if (!usedNameToTag.has(value)) {\n usedNameToTag.set(value, potentialTag);\n }\n }\n });\n };\n\n /**\n * @param {string[]} tagNames\n */\n const checkTagsAndTemplates = (tagNames) => {\n for (const tagName of tagNames) {\n const preferredTagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName,\n }));\n const matchingTags = utils.getTags(preferredTagName);\n for (const matchingTag of matchingTags) {\n checkForUsedTypes(matchingTag);\n }\n }\n\n // Could check against whitelist/blacklist\n for (const usedName of usedNames) {\n if (!templateNames.includes(usedName)) {\n report(`Missing @template ${usedName}`, null, usedNameToTag.get(usedName));\n }\n }\n };\n\n const callbackTags = utils.getTags('callback');\n const functionTags = utils.getTags('function');\n if (callbackTags.length || functionTags.length) {\n checkTagsAndTemplates([\n 'param', 'returns',\n ]);\n return;\n }\n\n const typedefTags = utils.getTags('typedef');\n if (!typedefTags.length || typedefTags.length >= 2) {\n handleTypes();\n return;\n }\n\n const potentialTypedef = typedefTags[0];\n checkForUsedTypes(potentialTypedef);\n\n checkTagsAndTemplates([\n 'property',\n ]);\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Requires template tags for each generic type parameter',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-template.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n exemptedBy: {\n items: {\n type: 'string',\n },\n type: 'array',\n },\n requireSeparateTemplates: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;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AAC;EAC9C,IAAIuC,YAAY,CAACjC,MAAM,IAAIkC,YAAY,CAAClC,MAAM,EAAE;IAC9CyB,qBAAqB,CAAC,CACpB,OAAO,EAAE,SAAS,CACnB,CAAC;IACF;EACF;EAEA,MAAMU,WAAW,GAAGjD,KAAK,CAACQ,OAAO,CAAC,SAAS,CAAC;EAC5C,IAAI,CAACyC,WAAW,CAACnC,MAAM,IAAImC,WAAW,CAACnC,MAAM,IAAI,CAAC,EAAE;IAClDS,WAAW,CAAC,CAAC;IACb;EACF;EAEA,MAAM2B,gBAAgB,GAAGD,WAAW,CAAC,CAAC,CAAC;EACvCpB,iBAAiB,CAACqB,gBAAgB,CAAC;EAEnCX,qBAAqB,CAAC,CACpB,UAAU,CACX,CAAC;AACJ,CAAC,EAAE;EACDY,gBAAgB,EAAE,IAAI;EACtBC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJC,WAAW,EAAE,wDAAwD;MACrEC,GAAG,EAAE;IACP,CAAC;IACDC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVC,UAAU,EAAE;UACVC,KAAK,EAAE;YACLnC,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDvB,wBAAwB,EAAE;UACxBuB,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAoC,MAAA,CAAAnE,OAAA,GAAAA,OAAA,CAAAF,OAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"requireTemplate.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","_jsdoccomment","e","__esModule","default","_default","exports","iterateJsdoc","context","node","report","settings","utils","avoidDocs","requireSeparateTemplates","options","mode","usedNames","Set","templateTags","getTags","templateNames","flatMap","tag","parseClosureTemplateTag","names","length","checkTypeParams","aliasDeclaration","params","typeParameters","name","add","usedName","includes","handleTypes","nde","type","declaration","usedNameToTag","Map","checkForUsedTypes","potentialTag","parsedType","tryParseType","parseType","traverse","value","test","has","set","checkTagsAndTemplates","tagNames","tagName","preferredTagName","getPreferredTagName","matchingTags","matchingTag","get","callbackTags","functionTags","typedefTags","potentialTypedef","iterateAllJsdocs","meta","docs","description","url","schema","additionalProperties","properties","exemptedBy","items","module"],"sources":["../../src/rules/requireTemplate.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\nimport {\n parse as parseType,\n traverse,\n tryParse as tryParseType,\n} from '@es-joy/jsdoccomment';\n\nexport default iterateJsdoc(({\n context,\n node,\n report,\n settings,\n utils,\n}) => {\n if (utils.avoidDocs()) {\n return;\n }\n\n const {\n requireSeparateTemplates = false,\n } = context.options[0] || {};\n\n const {\n mode,\n } = settings;\n\n const usedNames = new Set();\n const templateTags = utils.getTags('template');\n const templateNames = templateTags.flatMap((tag) => {\n return utils.parseClosureTemplateTag(tag);\n });\n\n if (requireSeparateTemplates) {\n for (const tag of templateTags) {\n const names = utils.parseClosureTemplateTag(tag);\n if (names.length > 1) {\n report(`Missing separate @template for ${names[1]}`, null, tag);\n }\n }\n }\n\n /**\n * @param {import('@typescript-eslint/types').TSESTree.FunctionDeclaration|\n * import('@typescript-eslint/types').TSESTree.ClassDeclaration|\n * import('@typescript-eslint/types').TSESTree.TSDeclareFunction|\n * import('@typescript-eslint/types').TSESTree.TSInterfaceDeclaration|\n * import('@typescript-eslint/types').TSESTree.TSTypeAliasDeclaration} aliasDeclaration\n */\n const checkTypeParams = (aliasDeclaration) => {\n const {\n params,\n /* c8 ignore next -- Guard */\n } = aliasDeclaration.typeParameters ?? {\n /* c8 ignore next -- Guard */\n params: [],\n };\n for (const {\n name: {\n name,\n },\n } of params) {\n usedNames.add(name);\n }\n\n for (const usedName of usedNames) {\n if (!templateNames.includes(usedName)) {\n report(`Missing @template ${usedName}`);\n }\n }\n };\n\n const handleTypes = () => {\n const nde = /** @type {import('@typescript-eslint/types').TSESTree.Node} */ (\n node\n );\n if (!nde) {\n return;\n }\n\n switch (nde.type) {\n case 'ClassDeclaration':\n case 'FunctionDeclaration':\n case 'TSDeclareFunction':\n case 'TSInterfaceDeclaration':\n case 'TSTypeAliasDeclaration':\n checkTypeParams(nde);\n break;\n case 'ExportDefaultDeclaration':\n switch (nde.declaration?.type) {\n case 'ClassDeclaration':\n case 'FunctionDeclaration':\n case 'TSInterfaceDeclaration':\n checkTypeParams(nde.declaration);\n break;\n }\n\n break;\n case 'ExportNamedDeclaration':\n switch (nde.declaration?.type) {\n case 'ClassDeclaration':\n case 'FunctionDeclaration':\n case 'TSDeclareFunction':\n case 'TSInterfaceDeclaration':\n case 'TSTypeAliasDeclaration':\n checkTypeParams(nde.declaration);\n break;\n }\n\n break;\n }\n };\n\n const usedNameToTag = new Map();\n\n /**\n * @param {import('comment-parser').Spec} potentialTag\n */\n const checkForUsedTypes = (potentialTag) => {\n let parsedType;\n try {\n parsedType = mode === 'permissive' ?\n tryParseType(/** @type {string} */ (potentialTag.type)) :\n parseType(/** @type {string} */ (potentialTag.type), mode);\n } catch {\n return;\n }\n\n traverse(parsedType, (nde) => {\n const {\n type,\n value,\n } = /** @type {import('jsdoc-type-pratt-parser').NameResult} */ (nde);\n if (type === 'JsdocTypeName' && (/^[A-Z]$/v).test(value)) {\n usedNames.add(value);\n if (!usedNameToTag.has(value)) {\n usedNameToTag.set(value, potentialTag);\n }\n }\n });\n };\n\n /**\n * @param {string[]} tagNames\n */\n const checkTagsAndTemplates = (tagNames) => {\n for (const tagName of tagNames) {\n const preferredTagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName,\n }));\n const matchingTags = utils.getTags(preferredTagName);\n for (const matchingTag of matchingTags) {\n checkForUsedTypes(matchingTag);\n }\n }\n\n // Could check against whitelist/blacklist\n for (const usedName of usedNames) {\n if (!templateNames.includes(usedName)) {\n report(`Missing @template ${usedName}`, null, usedNameToTag.get(usedName));\n }\n }\n };\n\n const callbackTags = utils.getTags('callback');\n const functionTags = utils.getTags('function');\n if (callbackTags.length || functionTags.length) {\n checkTagsAndTemplates([\n 'param', 'returns',\n ]);\n return;\n }\n\n const typedefTags = utils.getTags('typedef');\n if (!typedefTags.length || typedefTags.length >= 2) {\n handleTypes();\n return;\n }\n\n const potentialTypedef = typedefTags[0];\n checkForUsedTypes(potentialTypedef);\n\n checkTagsAndTemplates([\n 'property',\n ]);\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Requires template tags for each generic type parameter',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-template.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n exemptedBy: {\n items: {\n type: 'string',\n },\n type: 'array',\n },\n requireSeparateTemplates: {\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAI8B,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAEf,IAAAG,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC,IAAI;EACJC,MAAM;EACNC,QAAQ;EACRC;AACF,CAAC,KAAK;EACJ,IAAIA,KAAK,CAACC,SAAS,CAAC,CAAC,EAAE;IACrB;EACF;EAEA,MAAM;IACJC,wBAAwB,GAAG;EAC7B,CAAC,GAAGN,OAAO,CAACO,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;EAE5B,MAAM;IACJC;EACF,CAAC,GAAGL,QAAQ;EAEZ,MAAMM,SAAS,GAAG,IAAIC,GAAG,CAAC,CAAC;EAC3B,MAAMC,YAAY,GAAGP,KAAK,CAACQ,OAAO,CAAC,UAAU,CAAC;EAC9C,MAAMC,aAAa,GAAGF,YAAY,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,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVC,UAAU,EAAE;UACVC,KAAK,EAAE;YACLnC,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDvB,wBAAwB,EAAE;UACxBuB,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAoC,MAAA,CAAAnE,OAAA,GAAAA,OAAA,CAAAF,OAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"url": "http://gajus.com"
|
|
6
6
|
},
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@es-joy/jsdoccomment": "~0.
|
|
8
|
+
"@es-joy/jsdoccomment": "~0.56.0",
|
|
9
9
|
"are-docs-informative": "^0.0.2",
|
|
10
10
|
"comment-parser": "1.4.1",
|
|
11
11
|
"debug": "^4.4.1",
|
|
@@ -19,17 +19,17 @@
|
|
|
19
19
|
"description": "JSDoc linting rules for ESLint.",
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@babel/cli": "^7.28.3",
|
|
22
|
-
"@babel/core": "^7.28.
|
|
23
|
-
"@babel/eslint-parser": "^7.28.
|
|
22
|
+
"@babel/core": "^7.28.4",
|
|
23
|
+
"@babel/eslint-parser": "^7.28.4",
|
|
24
24
|
"@babel/node": "^7.28.0",
|
|
25
25
|
"@babel/plugin-syntax-class-properties": "^7.12.13",
|
|
26
26
|
"@babel/plugin-transform-flow-strip-types": "^7.27.1",
|
|
27
27
|
"@babel/preset-env": "^7.28.3",
|
|
28
28
|
"@es-joy/escodegen": "^3.5.1",
|
|
29
|
-
"@es-joy/jsdoc-eslint-parser": "^0.
|
|
29
|
+
"@es-joy/jsdoc-eslint-parser": "^0.23.0",
|
|
30
30
|
"@hkdobrev/run-if-changed": "^0.6.3",
|
|
31
31
|
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
32
|
-
"@semantic-release/github": "^11.0.
|
|
32
|
+
"@semantic-release/github": "^11.0.5",
|
|
33
33
|
"@semantic-release/npm": "^12.0.2",
|
|
34
34
|
"@types/chai": "^5.2.2",
|
|
35
35
|
"@types/debug": "^4.1.12",
|
|
@@ -39,34 +39,34 @@
|
|
|
39
39
|
"@types/json-schema": "^7.0.15",
|
|
40
40
|
"@types/lodash.defaultsdeep": "^4.6.9",
|
|
41
41
|
"@types/mocha": "^10.0.10",
|
|
42
|
-
"@types/node": "^24.3.
|
|
43
|
-
"@types/semver": "^7.7.
|
|
42
|
+
"@types/node": "^24.3.1",
|
|
43
|
+
"@types/semver": "^7.7.1",
|
|
44
44
|
"@types/spdx-expression-parse": "^3.0.5",
|
|
45
|
-
"@typescript-eslint/types": "^8.
|
|
45
|
+
"@typescript-eslint/types": "^8.42.0",
|
|
46
46
|
"babel-plugin-add-module-exports": "^1.0.4",
|
|
47
|
-
"babel-plugin-istanbul": "^7.0.
|
|
47
|
+
"babel-plugin-istanbul": "^7.0.1",
|
|
48
48
|
"babel-plugin-transform-import-meta": "^2.3.3",
|
|
49
49
|
"c8": "^10.1.3",
|
|
50
50
|
"camelcase": "^8.0.0",
|
|
51
51
|
"chai": "^6.0.1",
|
|
52
52
|
"decamelize": "^6.0.1",
|
|
53
|
-
"eslint": "9.
|
|
53
|
+
"eslint": "9.35.0",
|
|
54
54
|
"eslint-config-canonical": "~45.0.0",
|
|
55
55
|
"gitdown": "^4.1.1",
|
|
56
56
|
"glob": "^11.0.3",
|
|
57
57
|
"globals": "^16.3.0",
|
|
58
58
|
"husky": "^9.1.7",
|
|
59
|
-
"jsdoc-type-pratt-parser": "^
|
|
59
|
+
"jsdoc-type-pratt-parser": "^5.1.1",
|
|
60
60
|
"json-schema": "^0.4.0",
|
|
61
|
-
"lint-staged": "^16.1.
|
|
61
|
+
"lint-staged": "^16.1.6",
|
|
62
62
|
"lodash.defaultsdeep": "^4.6.1",
|
|
63
|
-
"mocha": "^11.7.
|
|
63
|
+
"mocha": "^11.7.2",
|
|
64
64
|
"open-editor": "^5.1.0",
|
|
65
65
|
"replace": "^1.2.2",
|
|
66
66
|
"rimraf": "^6.0.1",
|
|
67
67
|
"semantic-release": "^24.2.7",
|
|
68
68
|
"typescript": "5.9.2",
|
|
69
|
-
"typescript-eslint": "^8.
|
|
69
|
+
"typescript-eslint": "^8.42.0"
|
|
70
70
|
},
|
|
71
71
|
"engines": {
|
|
72
72
|
"node": ">=20.11.0"
|
|
@@ -153,5 +153,5 @@
|
|
|
153
153
|
"test-cov": "TIMING=1 c8 --reporter text pnpm run test-no-cov",
|
|
154
154
|
"test-index": "pnpm run test-no-cov test/rules/index.js"
|
|
155
155
|
},
|
|
156
|
-
"version": "54.
|
|
156
|
+
"version": "54.5.0"
|
|
157
157
|
}
|
|
@@ -104,6 +104,10 @@ const OPTIONS_SCHEMA = {
|
|
|
104
104
|
default: false,
|
|
105
105
|
type: 'boolean',
|
|
106
106
|
},
|
|
107
|
+
exemptOverloadedImplementations: {
|
|
108
|
+
default: false,
|
|
109
|
+
type: 'boolean',
|
|
110
|
+
},
|
|
107
111
|
fixerMessage: {
|
|
108
112
|
default: '',
|
|
109
113
|
type: 'string',
|
|
@@ -169,6 +173,10 @@ const OPTIONS_SCHEMA = {
|
|
|
169
173
|
},
|
|
170
174
|
type: 'object',
|
|
171
175
|
},
|
|
176
|
+
skipInterveningOverloadedDeclarations: {
|
|
177
|
+
default: true,
|
|
178
|
+
type: 'boolean',
|
|
179
|
+
},
|
|
172
180
|
},
|
|
173
181
|
type: 'object',
|
|
174
182
|
};
|
|
@@ -302,6 +310,8 @@ const getOption = (context, baseObject, option, key) => {
|
|
|
302
310
|
* enableFixer: boolean,
|
|
303
311
|
* exemptEmptyConstructors: boolean,
|
|
304
312
|
* exemptEmptyFunctions: boolean,
|
|
313
|
+
* skipInterveningOverloadedDeclarations: boolean,
|
|
314
|
+
* exemptOverloadedImplementations: boolean,
|
|
305
315
|
* fixerMessage: string,
|
|
306
316
|
* minLineCount: undefined|import('../iterateJsdoc.js').Integer,
|
|
307
317
|
* publicOnly: boolean|{[key: string]: boolean|undefined}
|
|
@@ -314,9 +324,11 @@ const getOptions = (context, settings) => {
|
|
|
314
324
|
enableFixer = true,
|
|
315
325
|
exemptEmptyConstructors = true,
|
|
316
326
|
exemptEmptyFunctions = false,
|
|
327
|
+
exemptOverloadedImplementations = false,
|
|
317
328
|
fixerMessage = '',
|
|
318
329
|
minLineCount = undefined,
|
|
319
330
|
publicOnly,
|
|
331
|
+
skipInterveningOverloadedDeclarations = true,
|
|
320
332
|
} = context.options[0] || {};
|
|
321
333
|
|
|
322
334
|
return {
|
|
@@ -324,6 +336,7 @@ const getOptions = (context, settings) => {
|
|
|
324
336
|
enableFixer,
|
|
325
337
|
exemptEmptyConstructors,
|
|
326
338
|
exemptEmptyFunctions,
|
|
339
|
+
exemptOverloadedImplementations,
|
|
327
340
|
fixerMessage,
|
|
328
341
|
minLineCount,
|
|
329
342
|
publicOnly: ((baseObj) => {
|
|
@@ -386,9 +399,52 @@ const getOptions = (context, settings) => {
|
|
|
386
399
|
/** @type {import('json-schema').JSONSchema4Object} */
|
|
387
400
|
(OPTIONS_SCHEMA.properties).require,
|
|
388
401
|
),
|
|
402
|
+
skipInterveningOverloadedDeclarations,
|
|
389
403
|
};
|
|
390
404
|
};
|
|
391
405
|
|
|
406
|
+
/**
|
|
407
|
+
* @param {ESLintOrTSNode} node
|
|
408
|
+
*/
|
|
409
|
+
const isFunctionWithOverload = (node) => {
|
|
410
|
+
if (node.type !== 'FunctionDeclaration') {
|
|
411
|
+
return false;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
let parent;
|
|
415
|
+
let child;
|
|
416
|
+
|
|
417
|
+
if (node.parent?.type === 'Program') {
|
|
418
|
+
parent = node.parent;
|
|
419
|
+
child = node;
|
|
420
|
+
} else if (node.parent?.type === 'ExportNamedDeclaration' &&
|
|
421
|
+
node.parent?.parent.type === 'Program') {
|
|
422
|
+
parent = node.parent?.parent;
|
|
423
|
+
child = node.parent;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
if (!child || !parent) {
|
|
427
|
+
return false;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
const functionName = node.id.name;
|
|
431
|
+
|
|
432
|
+
const idx = parent.body.indexOf(child);
|
|
433
|
+
const prevSibling = parent.body[idx - 1];
|
|
434
|
+
|
|
435
|
+
return (
|
|
436
|
+
// @ts-expect-error Should be ok
|
|
437
|
+
(prevSibling?.type === 'TSDeclareFunction' &&
|
|
438
|
+
// @ts-expect-error Should be ok
|
|
439
|
+
functionName === prevSibling.id.name) ||
|
|
440
|
+
(prevSibling?.type === 'ExportNamedDeclaration' &&
|
|
441
|
+
// @ts-expect-error Should be ok
|
|
442
|
+
prevSibling.declaration?.type === 'TSDeclareFunction' &&
|
|
443
|
+
// @ts-expect-error Should be ok
|
|
444
|
+
prevSibling.declaration?.id?.name === functionName)
|
|
445
|
+
);
|
|
446
|
+
};
|
|
447
|
+
|
|
392
448
|
/** @type {import('eslint').Rule.RuleModule} */
|
|
393
449
|
export default {
|
|
394
450
|
create (context) {
|
|
@@ -408,9 +464,11 @@ export default {
|
|
|
408
464
|
enableFixer,
|
|
409
465
|
exemptEmptyConstructors,
|
|
410
466
|
exemptEmptyFunctions,
|
|
467
|
+
exemptOverloadedImplementations,
|
|
411
468
|
fixerMessage,
|
|
412
469
|
minLineCount,
|
|
413
470
|
require: requireOption,
|
|
471
|
+
skipInterveningOverloadedDeclarations,
|
|
414
472
|
} = opts;
|
|
415
473
|
|
|
416
474
|
const publicOnly =
|
|
@@ -476,7 +534,15 @@ export default {
|
|
|
476
534
|
}
|
|
477
535
|
}
|
|
478
536
|
|
|
479
|
-
|
|
537
|
+
if (exemptOverloadedImplementations && isFunctionWithOverload(node)) {
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
const jsDocNode = getJSDocComment(
|
|
542
|
+
sourceCode, node, settings, {
|
|
543
|
+
checkOverloads: skipInterveningOverloadedDeclarations,
|
|
544
|
+
},
|
|
545
|
+
);
|
|
480
546
|
|
|
481
547
|
if (jsDocNode) {
|
|
482
548
|
return;
|
|
@@ -42,6 +42,7 @@ export default iterateJsdoc(({
|
|
|
42
42
|
/**
|
|
43
43
|
* @param {import('@typescript-eslint/types').TSESTree.FunctionDeclaration|
|
|
44
44
|
* import('@typescript-eslint/types').TSESTree.ClassDeclaration|
|
|
45
|
+
* import('@typescript-eslint/types').TSESTree.TSDeclareFunction|
|
|
45
46
|
* import('@typescript-eslint/types').TSESTree.TSInterfaceDeclaration|
|
|
46
47
|
* import('@typescript-eslint/types').TSESTree.TSTypeAliasDeclaration} aliasDeclaration
|
|
47
48
|
*/
|
|
@@ -79,6 +80,7 @@ export default iterateJsdoc(({
|
|
|
79
80
|
switch (nde.type) {
|
|
80
81
|
case 'ClassDeclaration':
|
|
81
82
|
case 'FunctionDeclaration':
|
|
83
|
+
case 'TSDeclareFunction':
|
|
82
84
|
case 'TSInterfaceDeclaration':
|
|
83
85
|
case 'TSTypeAliasDeclaration':
|
|
84
86
|
checkTypeParams(nde);
|
|
@@ -97,6 +99,7 @@ export default iterateJsdoc(({
|
|
|
97
99
|
switch (nde.declaration?.type) {
|
|
98
100
|
case 'ClassDeclaration':
|
|
99
101
|
case 'FunctionDeclaration':
|
|
102
|
+
case 'TSDeclareFunction':
|
|
100
103
|
case 'TSInterfaceDeclaration':
|
|
101
104
|
case 'TSTypeAliasDeclaration':
|
|
102
105
|
checkTypeParams(nde.declaration);
|