eslint-plugin-jsdoc 58.1.1 → 59.0.1
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.
- package/README.md +87 -69
- package/dist/buildForbidRuleDefinition.cjs +0 -1
- package/dist/buildForbidRuleDefinition.cjs.map +1 -1
- package/dist/buildRejectOrPreferRuleDefinition.cjs +7 -2
- package/dist/buildRejectOrPreferRuleDefinition.cjs.map +1 -1
- package/dist/cjs/rules/convertToJsdocComments.d.ts +7 -0
- package/dist/generateDocs.cjs +129 -3
- package/dist/generateDocs.cjs.map +1 -1
- package/dist/generateRule.cjs +3 -1
- package/dist/generateRule.cjs.map +1 -1
- package/dist/generateRuleTypes.cjs +5 -5
- package/dist/generateRuleTypes.cjs.map +1 -1
- package/dist/index-cjs.cjs +30 -0
- package/dist/index-cjs.cjs.map +1 -1
- package/dist/index.cjs +30 -0
- package/dist/index.cjs.map +1 -1
- package/dist/rules/checkAccess.cjs +1 -1
- package/dist/rules/checkAccess.cjs.map +1 -1
- package/dist/rules/checkAlignment.cjs +4 -1
- package/dist/rules/checkAlignment.cjs.map +1 -1
- package/dist/rules/checkExamples.cjs +1 -1
- package/dist/rules/checkExamples.cjs.map +1 -1
- package/dist/rules/checkIndentation.cjs +19 -0
- package/dist/rules/checkIndentation.cjs.map +1 -1
- package/dist/rules/checkLineAlignment.cjs +25 -1
- package/dist/rules/checkLineAlignment.cjs.map +1 -1
- package/dist/rules/checkParamNames.cjs +62 -1
- package/dist/rules/checkParamNames.cjs.map +1 -1
- package/dist/rules/checkPropertyNames.cjs +6 -0
- package/dist/rules/checkPropertyNames.cjs.map +1 -1
- package/dist/rules/checkTagNames.cjs +71 -0
- package/dist/rules/checkTagNames.cjs.map +1 -1
- package/dist/rules/checkTypes.cjs +16 -1
- package/dist/rules/checkTypes.cjs.map +1 -1
- package/dist/rules/checkValues.cjs +17 -1
- package/dist/rules/checkValues.cjs.map +1 -1
- package/dist/rules/convertToJsdocComments.cjs +48 -0
- package/dist/rules/convertToJsdocComments.cjs.map +1 -1
- package/dist/rules/convertToJsdocComments.d.ts +7 -0
- package/dist/rules/emptyTags.cjs +10 -1
- package/dist/rules/emptyTags.cjs.map +1 -1
- package/dist/rules/implementsOnClasses.cjs +15 -1
- package/dist/rules/implementsOnClasses.cjs.map +1 -1
- package/dist/rules/informativeDocs.cjs +45 -0
- package/dist/rules/informativeDocs.cjs.map +1 -1
- package/dist/rules/linesBeforeBlock.cjs +14 -0
- package/dist/rules/linesBeforeBlock.cjs.map +1 -1
- package/dist/rules/matchDescription.cjs +129 -0
- package/dist/rules/matchDescription.cjs.map +1 -1
- package/dist/rules/matchName.cjs +30 -0
- package/dist/rules/matchName.cjs.map +1 -1
- package/dist/rules/multilineBlocks.cjs +78 -6
- package/dist/rules/multilineBlocks.cjs.map +1 -1
- package/dist/rules/noBadBlocks.cjs +11 -2
- package/dist/rules/noBadBlocks.cjs.map +1 -1
- package/dist/rules/noBlankBlockDescriptions.cjs +1 -1
- package/dist/rules/noBlankBlockDescriptions.cjs.map +1 -1
- package/dist/rules/noBlankBlocks.cjs +3 -1
- package/dist/rules/noBlankBlocks.cjs.map +1 -1
- package/dist/rules/noDefaults.cjs +19 -0
- package/dist/rules/noDefaults.cjs.map +1 -1
- package/dist/rules/noMissingSyntax.cjs +22 -2
- package/dist/rules/noMissingSyntax.cjs.map +1 -1
- package/dist/rules/noMultiAsterisks.cjs +29 -0
- package/dist/rules/noMultiAsterisks.cjs.map +1 -1
- package/dist/rules/noRestrictedSyntax.cjs +17 -1
- package/dist/rules/noRestrictedSyntax.cjs.map +1 -1
- package/dist/rules/noTypes.cjs +17 -1
- package/dist/rules/noTypes.cjs.map +1 -1
- package/dist/rules/noUndefinedTypes.cjs +11 -1
- package/dist/rules/noUndefinedTypes.cjs.map +1 -1
- package/dist/rules/requireAsteriskPrefix.cjs +28 -0
- package/dist/rules/requireAsteriskPrefix.cjs.map +1 -1
- package/dist/rules/requireDescription.cjs +30 -1
- package/dist/rules/requireDescription.cjs.map +1 -1
- package/dist/rules/requireDescriptionCompleteSentence.cjs +27 -0
- package/dist/rules/requireDescriptionCompleteSentence.cjs.map +1 -1
- package/dist/rules/requireExample.cjs +26 -1
- package/dist/rules/requireExample.cjs.map +1 -1
- package/dist/rules/requireFileOverview.cjs +61 -0
- package/dist/rules/requireFileOverview.cjs.map +1 -1
- package/dist/rules/requireHyphenBeforeParamDescription.cjs +20 -2
- package/dist/rules/requireHyphenBeforeParamDescription.cjs.map +1 -1
- package/dist/rules/requireJsdoc.cjs +82 -3
- package/dist/rules/requireJsdoc.cjs.map +1 -1
- package/dist/rules/requireParam.cjs +213 -1
- package/dist/rules/requireParam.cjs.map +1 -1
- package/dist/rules/requireParamDescription.cjs +21 -0
- package/dist/rules/requireParamDescription.cjs.map +1 -1
- package/dist/rules/requireParamName.cjs +16 -1
- package/dist/rules/requireParamName.cjs.map +1 -1
- package/dist/rules/requireParamType.cjs +21 -1
- package/dist/rules/requireParamType.cjs.map +1 -1
- package/dist/rules/requirePropertyName.cjs +1 -1
- package/dist/rules/requirePropertyName.cjs.map +1 -1
- package/dist/rules/requirePropertyType.cjs +1 -1
- package/dist/rules/requirePropertyType.cjs.map +1 -1
- package/dist/rules/requireReturns.cjs +54 -1
- package/dist/rules/requireReturns.cjs.map +1 -1
- package/dist/rules/requireReturnsCheck.cjs +22 -1
- package/dist/rules/requireReturnsCheck.cjs.map +1 -1
- package/dist/rules/requireReturnsDescription.cjs +15 -1
- package/dist/rules/requireReturnsDescription.cjs.map +1 -1
- package/dist/rules/requireReturnsType.cjs +15 -1
- package/dist/rules/requireReturnsType.cjs.map +1 -1
- package/dist/rules/requireTemplate.cjs +17 -1
- package/dist/rules/requireTemplate.cjs.map +1 -1
- package/dist/rules/requireThrows.cjs +18 -1
- package/dist/rules/requireThrows.cjs.map +1 -1
- package/dist/rules/requireYields.cjs +50 -1
- package/dist/rules/requireYields.cjs.map +1 -1
- package/dist/rules/requireYieldsCheck.cjs +25 -7
- package/dist/rules/requireYieldsCheck.cjs.map +1 -1
- package/dist/rules/sortTags.cjs +200 -1
- package/dist/rules/sortTags.cjs.map +1 -1
- package/dist/rules/tagLines.cjs +32 -2
- package/dist/rules/tagLines.cjs.map +1 -1
- package/dist/rules/textEscaping.cjs +5 -1
- package/dist/rules/textEscaping.cjs.map +1 -1
- package/dist/rules/typeFormatting.cjs +47 -10
- package/dist/rules/typeFormatting.cjs.map +1 -1
- package/dist/rules/validTypes.cjs +8 -1
- package/dist/rules/validTypes.cjs.map +1 -1
- package/dist/rules.d.ts +2130 -32
- package/package.json +2 -2
- package/src/buildForbidRuleDefinition.js +0 -1
- package/src/buildRejectOrPreferRuleDefinition.js +12 -2
- package/src/index-cjs.js +36 -0
- package/src/index.js +36 -0
- package/src/rules/checkAccess.js +1 -1
- package/src/rules/checkAlignment.js +3 -0
- package/src/rules/checkExamples.js +1 -1
- package/src/rules/checkIndentation.js +19 -0
- package/src/rules/checkLineAlignment.js +24 -0
- package/src/rules/checkParamNames.js +62 -1
- package/src/rules/checkPropertyNames.js +6 -0
- package/src/rules/checkTagNames.js +71 -0
- package/src/rules/checkTypes.js +16 -1
- package/src/rules/checkValues.js +16 -0
- package/src/rules/convertToJsdocComments.js +48 -0
- package/src/rules/emptyTags.js +10 -1
- package/src/rules/implementsOnClasses.js +15 -1
- package/src/rules/informativeDocs.js +45 -0
- package/src/rules/linesBeforeBlock.js +14 -0
- package/src/rules/matchDescription.js +129 -0
- package/src/rules/matchName.js +30 -0
- package/src/rules/multilineBlocks.js +77 -5
- package/src/rules/noBadBlocks.js +11 -2
- package/src/rules/noBlankBlockDescriptions.js +1 -1
- package/src/rules/noBlankBlocks.js +2 -0
- package/src/rules/noDefaults.js +19 -0
- package/src/rules/noMissingSyntax.js +22 -2
- package/src/rules/noMultiAsterisks.js +29 -0
- package/src/rules/noRestrictedSyntax.js +17 -1
- package/src/rules/noTypes.js +17 -1
- package/src/rules/noUndefinedTypes.js +11 -1
- package/src/rules/requireAsteriskPrefix.js +28 -0
- package/src/rules/requireDescription.js +30 -1
- package/src/rules/requireDescriptionCompleteSentence.js +27 -0
- package/src/rules/requireExample.js +26 -1
- package/src/rules/requireFileOverview.js +61 -0
- package/src/rules/requireHyphenBeforeParamDescription.js +19 -1
- package/src/rules/requireJsdoc.js +80 -1
- package/src/rules/requireParam.js +213 -1
- package/src/rules/requireParamDescription.js +21 -0
- package/src/rules/requireParamName.js +16 -1
- package/src/rules/requireParamType.js +21 -1
- package/src/rules/requirePropertyName.js +1 -1
- package/src/rules/requirePropertyType.js +1 -1
- package/src/rules/requireReturns.js +54 -1
- package/src/rules/requireReturnsCheck.js +22 -1
- package/src/rules/requireReturnsDescription.js +15 -1
- package/src/rules/requireReturnsType.js +15 -1
- package/src/rules/requireTemplate.js +17 -1
- package/src/rules/requireThrows.js +18 -1
- package/src/rules/requireYields.js +50 -1
- package/src/rules/requireYieldsCheck.js +25 -7
- package/src/rules/sortTags.js +200 -1
- package/src/rules/tagLines.js +30 -0
- package/src/rules/textEscaping.js +5 -1
- package/src/rules/typeFormatting.js +44 -7
- package/src/rules/validTypes.js +8 -1
- package/src/rules.d.ts +2130 -32
- package/typings/gitdown.d.ts +4 -0
|
@@ -227,12 +227,24 @@ var _default = exports.default = {
|
|
|
227
227
|
additionalProperties: false,
|
|
228
228
|
properties: {
|
|
229
229
|
allowedPrefixes: {
|
|
230
|
+
description: `An array of prefixes to allow at the beginning of a comment.
|
|
231
|
+
|
|
232
|
+
Defaults to \`['@ts-', 'istanbul ', 'c8 ', 'v8 ', 'eslint', 'prettier-']\`.
|
|
233
|
+
|
|
234
|
+
Supplying your own value overrides the defaults.`,
|
|
230
235
|
items: {
|
|
231
236
|
type: 'string'
|
|
232
237
|
},
|
|
233
238
|
type: 'array'
|
|
234
239
|
},
|
|
235
240
|
contexts: {
|
|
241
|
+
description: `The contexts array which will be checked for preceding content.
|
|
242
|
+
|
|
243
|
+
Can either be strings or an object with a \`context\` string and an optional, default \`false\` \`inlineCommentBlock\` boolean.
|
|
244
|
+
|
|
245
|
+
Defaults to \`ArrowFunctionExpression\`, \`FunctionDeclaration\`,
|
|
246
|
+
\`FunctionExpression\`, \`TSDeclareFunction\`.
|
|
247
|
+
`,
|
|
236
248
|
items: {
|
|
237
249
|
anyOf: [{
|
|
238
250
|
type: 'string'
|
|
@@ -252,6 +264,11 @@ var _default = exports.default = {
|
|
|
252
264
|
type: 'array'
|
|
253
265
|
},
|
|
254
266
|
contextsAfter: {
|
|
267
|
+
description: `The contexts array which will be checked for content on the same line after.
|
|
268
|
+
|
|
269
|
+
Can either be strings or an object with a \`context\` string and an optional, default \`false\` \`inlineCommentBlock\` boolean.
|
|
270
|
+
|
|
271
|
+
Defaults to an empty array.`,
|
|
255
272
|
items: {
|
|
256
273
|
anyOf: [{
|
|
257
274
|
type: 'string'
|
|
@@ -271,6 +288,12 @@ var _default = exports.default = {
|
|
|
271
288
|
type: 'array'
|
|
272
289
|
},
|
|
273
290
|
contextsBeforeAndAfter: {
|
|
291
|
+
description: `The contexts array which will be checked for content before and on the same
|
|
292
|
+
line after.
|
|
293
|
+
|
|
294
|
+
Can either be strings or an object with a \`context\` string and an optional, default \`false\` \`inlineCommentBlock\` boolean.
|
|
295
|
+
|
|
296
|
+
Defaults to \`VariableDeclarator\`, \`TSPropertySignature\`, \`PropertyDefinition\`.`,
|
|
274
297
|
items: {
|
|
275
298
|
anyOf: [{
|
|
276
299
|
type: 'string'
|
|
@@ -290,13 +313,38 @@ var _default = exports.default = {
|
|
|
290
313
|
type: 'array'
|
|
291
314
|
},
|
|
292
315
|
enableFixer: {
|
|
316
|
+
description: 'Set to `false` to disable fixing.',
|
|
293
317
|
type: 'boolean'
|
|
294
318
|
},
|
|
295
319
|
enforceJsdocLineStyle: {
|
|
320
|
+
description: `What policy to enforce on the conversion of non-JSDoc comments without
|
|
321
|
+
line breaks. (Non-JSDoc (mulitline) comments with line breaks will always
|
|
322
|
+
be converted to \`multi\` style JSDoc comments.)
|
|
323
|
+
|
|
324
|
+
- \`multi\` - Convert to multi-line style
|
|
325
|
+
\`\`\`js
|
|
326
|
+
/**
|
|
327
|
+
* Some text
|
|
328
|
+
*/
|
|
329
|
+
\`\`\`
|
|
330
|
+
- \`single\` - Convert to single-line style
|
|
331
|
+
\`\`\`js
|
|
332
|
+
/** Some text */
|
|
333
|
+
\`\`\`
|
|
334
|
+
|
|
335
|
+
Defaults to \`multi\`.
|
|
336
|
+
`,
|
|
296
337
|
enum: ['multi', 'single'],
|
|
297
338
|
type: 'string'
|
|
298
339
|
},
|
|
299
340
|
lineOrBlockStyle: {
|
|
341
|
+
description: `What style of comments to which to apply JSDoc conversion.
|
|
342
|
+
|
|
343
|
+
- \`block\` - Applies to block-style comments (\`/* ... */\`)
|
|
344
|
+
- \`line\` - Applies to line-style comments (\`// ...\`)
|
|
345
|
+
- \`both\` - Applies to both block and line-style comments
|
|
346
|
+
|
|
347
|
+
Defaults to \`both\`.`,
|
|
300
348
|
enum: ['block', 'line', 'both'],
|
|
301
349
|
type: 'string'
|
|
302
350
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convertToJsdocComments.cjs","names":["_iterateJsdoc","require","_jsdocUtils","_jsdoccomment","_default","exports","default","create","context","sourceCode","getSourceCode","settings","getSettings","allowedPrefixes","contexts","contextsAfter","contextsBeforeAndAfter","enableFixer","enforceJsdocLineStyle","lineOrBlockStyle","options","reportingNonJsdoc","report","messageId","comment","node","fixer","loc","end","column","line","start","fix","getFixer","addComment","ctxts","lines","minLines","maxLines","baseNode","getReducedASTNode","decorator","getDecorator","indent","getIndent","text","getText","inlineCommentBlock","find","contxt","ctxt","type","reportings","checkNonJsdoc","_info","_handler","getNonJsdocComment","some","prefix","value","trimStart","startsWith","commentToAdd","insertion","trim","trimEnd","repeat","replaceText","checkNonJsdocAfter","getFollowingComment","slice","remove","insertTextBefore","parent","getContextObject","enforcedContexts","meta","docs","description","url","fixable","messages","blockCommentsJsdocStyle","lineCommentsJsdocStyle","schema","additionalProperties","properties","items","anyOf","enum","module"],"sources":["../../src/rules/convertToJsdocComments.js"],"sourcesContent":["import {\n getSettings,\n} from '../iterateJsdoc.js';\nimport {\n enforcedContexts,\n getContextObject,\n getIndent,\n} from '../jsdocUtils.js';\nimport {\n getDecorator,\n getFollowingComment,\n getNonJsdocComment,\n getReducedASTNode,\n} from '@es-joy/jsdoccomment';\n\n/** @type {import('eslint').Rule.RuleModule} */\nexport default {\n create (context) {\n /**\n * @typedef {import('eslint').AST.Token | import('estree').Comment | {\n * type: import('eslint').AST.TokenType|\"Line\"|\"Block\"|\"Shebang\",\n * range: [number, number],\n * value: string\n * }} Token\n */\n\n /**\n * @callback AddComment\n * @param {boolean|undefined} inlineCommentBlock\n * @param {Token} comment\n * @param {string} indent\n * @param {number} lines\n * @param {import('eslint').Rule.RuleFixer} fixer\n */\n\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 {\n allowedPrefixes = [\n '@ts-', 'istanbul ', 'c8 ', 'v8 ', 'eslint', 'prettier-',\n ],\n contexts = settings.contexts || [],\n contextsAfter = /** @type {string[]} */ ([]),\n contextsBeforeAndAfter = [\n 'VariableDeclarator', 'TSPropertySignature', 'PropertyDefinition',\n ],\n enableFixer = true,\n enforceJsdocLineStyle = 'multi',\n lineOrBlockStyle = 'both',\n } = context.options[0] ?? {};\n\n let reportingNonJsdoc = false;\n\n /**\n * @param {string} messageId\n * @param {import('estree').Comment|Token} comment\n * @param {import('eslint').Rule.Node} node\n * @param {import('eslint').Rule.ReportFixer} fixer\n */\n const report = (messageId, comment, node, fixer) => {\n const loc = {\n end: {\n column: 0,\n /* c8 ignore next 2 -- Guard */\n // @ts-expect-error Ok\n line: (comment.loc?.start?.line ?? 1),\n },\n start: {\n column: 0,\n /* c8 ignore next 2 -- Guard */\n // @ts-expect-error Ok\n line: (comment.loc?.start?.line ?? 1),\n },\n };\n\n context.report({\n fix: enableFixer ? fixer : null,\n loc,\n messageId,\n node,\n });\n };\n\n /**\n * @param {import('eslint').Rule.Node} node\n * @param {import('eslint').AST.Token | import('estree').Comment | {\n * type: import('eslint').AST.TokenType|\"Line\"|\"Block\"|\"Shebang\",\n * range: [number, number],\n * value: string\n * }} comment\n * @param {AddComment} addComment\n * @param {import('../iterateJsdoc.js').Context[]} ctxts\n */\n const getFixer = (node, comment, addComment, ctxts) => {\n return /** @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 let baseNode =\n /**\n * @type {import('@typescript-eslint/types').TSESTree.Node|import('eslint').Rule.Node}\n */ (\n getReducedASTNode(node, sourceCode)\n );\n\n const decorator = getDecorator(\n /** @type {import('eslint').Rule.Node} */\n (baseNode),\n );\n if (decorator) {\n baseNode = /** @type {import('@typescript-eslint/types').TSESTree.Decorator} */ (\n decorator\n );\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 */ (ctxts).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\n return addComment(inlineCommentBlock, comment, indent, lines, fixer);\n };\n };\n\n /**\n * @param {import('eslint').AST.Token | import('estree').Comment | {\n * type: import('eslint').AST.TokenType|\"Line\"|\"Block\"|\"Shebang\",\n * range: [number, number],\n * value: string\n * }} comment\n * @param {import('eslint').Rule.Node} node\n * @param {AddComment} addComment\n * @param {import('../iterateJsdoc.js').Context[]} ctxts\n */\n const reportings = (comment, node, addComment, ctxts) => {\n const fixer = getFixer(node, comment, addComment, ctxts);\n\n if (comment.type === 'Block') {\n if (lineOrBlockStyle === 'line') {\n return;\n }\n\n report('blockCommentsJsdocStyle', comment, node, fixer);\n return;\n }\n\n if (comment.type === 'Line') {\n if (lineOrBlockStyle === 'block') {\n return;\n }\n\n report('lineCommentsJsdocStyle', comment, node, fixer);\n }\n };\n\n /**\n * @type {import('../iterateJsdoc.js').CheckJsdoc}\n */\n const checkNonJsdoc = (_info, _handler, node) => {\n const comment = getNonJsdocComment(sourceCode, node, settings);\n\n if (\n !comment ||\n /** @type {string[]} */\n (allowedPrefixes).some((prefix) => {\n return comment.value.trimStart().startsWith(prefix);\n })\n ) {\n return;\n }\n\n reportingNonJsdoc = true;\n\n /** @type {AddComment} */\n // eslint-disable-next-line unicorn/consistent-function-scoping -- Avoid conflicts\n const addComment = (inlineCommentBlock, commentToAdd, indent, lines, fixer) => {\n const insertion = (\n inlineCommentBlock || enforceJsdocLineStyle === 'single' ?\n `/** ${commentToAdd.value.trim()} ` :\n `/**\\n${indent}*${commentToAdd.value.trimEnd()}\\n${indent}`\n ) +\n `*/${'\\n'.repeat((lines || 1) - 1)}`;\n\n return fixer.replaceText(\n /** @type {import('eslint').AST.Token} */\n (commentToAdd),\n insertion,\n );\n };\n\n reportings(comment, node, addComment, contexts);\n };\n\n /**\n * @param {import('eslint').Rule.Node} node\n * @param {import('../iterateJsdoc.js').Context[]} ctxts\n */\n const checkNonJsdocAfter = (node, ctxts) => {\n const comment = getFollowingComment(sourceCode, node);\n\n if (\n !comment ||\n comment.value.startsWith('*') ||\n /** @type {string[]} */\n (allowedPrefixes).some((prefix) => {\n return comment.value.trimStart().startsWith(prefix);\n })\n ) {\n return;\n }\n\n /** @type {AddComment} */\n const addComment = (inlineCommentBlock, commentToAdd, indent, lines, fixer) => {\n const insertion = (\n inlineCommentBlock || enforceJsdocLineStyle === 'single' ?\n `/** ${commentToAdd.value.trim()} ` :\n `/**\\n${indent}*${commentToAdd.value.trimEnd()}\\n${indent}`\n ) +\n `*/${'\\n'.repeat((lines || 1) - 1)}${lines ? `\\n${indent.slice(1)}` : ' '}`;\n\n return [\n fixer.remove(\n /** @type {import('eslint').AST.Token} */\n (commentToAdd),\n ), fixer.insertTextBefore(\n node.type === 'VariableDeclarator' ? node.parent : node,\n insertion,\n ),\n ];\n };\n\n reportings(comment, node, addComment, ctxts);\n };\n\n // Todo: add contexts to check after (and handle if want both before and after)\n return {\n ...getContextObject(\n enforcedContexts(context, true, settings),\n checkNonJsdoc,\n ),\n ...getContextObject(\n contextsAfter,\n (_info, _handler, node) => {\n checkNonJsdocAfter(node, contextsAfter);\n },\n ),\n ...getContextObject(\n contextsBeforeAndAfter,\n (_info, _handler, node) => {\n checkNonJsdoc({}, null, node);\n if (!reportingNonJsdoc) {\n checkNonJsdocAfter(node, contextsBeforeAndAfter);\n }\n },\n ),\n };\n },\n meta: {\n docs: {\n description: 'Converts non-JSDoc comments preceding or following nodes into JSDoc ones',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/convert-to-jsdoc-comments.md#repos-sticky-header',\n },\n\n fixable: 'code',\n\n messages: {\n blockCommentsJsdocStyle: 'Block comments should be JSDoc-style.',\n lineCommentsJsdocStyle: 'Line comments should be JSDoc-style.',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowedPrefixes: {\n items: {\n type: 'string',\n },\n type: 'array',\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 },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n contextsAfter: {\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 },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n contextsBeforeAndAfter: {\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 },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n enableFixer: {\n type: 'boolean',\n },\n enforceJsdocLineStyle: {\n enum: [\n 'multi', 'single',\n ],\n type: 'string',\n },\n lineOrBlockStyle: {\n enum: [\n 'block', 'line', 'both',\n ],\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n};\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAGA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,aAAA,GAAAF,OAAA;AAOA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GACe;EACbC,MAAMA,CAAEC,OAAO,EAAE;IACf;AACJ;AACA;AACA;AACA;AACA;AACA;;IAEI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;IAEI;IACA,MAAM;MACJC,UAAU,GAAGD,OAAO,CAACE,aAAa,CAAC;IACrC,CAAC,GAAGF,OAAO;IACX,MAAMG,QAAQ,GAAG,IAAAC,yBAAW,EAACJ,OAAO,CAAC;IACrC,IAAI,CAACG,QAAQ,EAAE;MACb,OAAO,CAAC,CAAC;IACX;IAEA,MAAM;MACJE,eAAe,GAAG,CAChB,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,CACzD;MACDC,QAAQ,GAAGH,QAAQ,CAACG,QAAQ,IAAI,EAAE;MAClCC,aAAa,IAAG,uBAAyB,EAAE,CAAC;MAC5CC,sBAAsB,GAAG,CACvB,oBAAoB,EAAE,qBAAqB,EAAE,oBAAoB,CAClE;MACDC,WAAW,GAAG,IAAI;MAClBC,qBAAqB,GAAG,OAAO;MAC/BC,gBAAgB,GAAG;IACrB,CAAC,GAAGX,OAAO,CAACY,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IA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EL,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDnC,sBAAsB,EAAE;UACtBuE,KAAK,EAAE;YACLC,KAAK,EAAE,CACL;cACErC,IAAI,EAAE;YACR,CAAC,EACD;cACEkC,oBAAoB,EAAE,KAAK;cAC3BC,UAAU,EAAE;gBACV9E,OAAO,EAAE;kBACP2C,IAAI,EAAE;gBACR,CAAC;gBACDJ,kBAAkB,EAAE;kBAClBI,IAAI,EAAE;gBACR;cACF,CAAC;cACDA,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDlC,WAAW,EAAE;UACXkC,IAAI,EAAE;QACR,CAAC;QACDjC,qBAAqB,EAAE;UACrBuE,IAAI,EAAE,CACJ,OAAO,EAAE,QAAQ,CAClB;UACDtC,IAAI,EAAE;QACR,CAAC;QACDhC,gBAAgB,EAAE;UAChBsE,IAAI,EAAE,CACJ,OAAO,EAAE,MAAM,EAAE,MAAM,CACxB;UACDtC,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC;AAAAuC,MAAA,CAAArF,OAAA,GAAAA,OAAA,CAAAC,OAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"convertToJsdocComments.cjs","names":["_iterateJsdoc","require","_jsdocUtils","_jsdoccomment","_default","exports","default","create","context","sourceCode","getSourceCode","settings","getSettings","allowedPrefixes","contexts","contextsAfter","contextsBeforeAndAfter","enableFixer","enforceJsdocLineStyle","lineOrBlockStyle","options","reportingNonJsdoc","report","messageId","comment","node","fixer","loc","end","column","line","start","fix","getFixer","addComment","ctxts","lines","minLines","maxLines","baseNode","getReducedASTNode","decorator","getDecorator","indent","getIndent","text","getText","inlineCommentBlock","find","contxt","ctxt","type","reportings","checkNonJsdoc","_info","_handler","getNonJsdocComment","some","prefix","value","trimStart","startsWith","commentToAdd","insertion","trim","trimEnd","repeat","replaceText","checkNonJsdocAfter","getFollowingComment","slice","remove","insertTextBefore","parent","getContextObject","enforcedContexts","meta","docs","description","url","fixable","messages","blockCommentsJsdocStyle","lineCommentsJsdocStyle","schema","additionalProperties","properties","items","anyOf","enum","module"],"sources":["../../src/rules/convertToJsdocComments.js"],"sourcesContent":["import {\n getSettings,\n} from '../iterateJsdoc.js';\nimport {\n enforcedContexts,\n getContextObject,\n getIndent,\n} from '../jsdocUtils.js';\nimport {\n getDecorator,\n getFollowingComment,\n getNonJsdocComment,\n getReducedASTNode,\n} from '@es-joy/jsdoccomment';\n\n/** @type {import('eslint').Rule.RuleModule} */\nexport default {\n create (context) {\n /**\n * @typedef {import('eslint').AST.Token | import('estree').Comment | {\n * type: import('eslint').AST.TokenType|\"Line\"|\"Block\"|\"Shebang\",\n * range: [number, number],\n * value: string\n * }} Token\n */\n\n /**\n * @callback AddComment\n * @param {boolean|undefined} inlineCommentBlock\n * @param {Token} comment\n * @param {string} indent\n * @param {number} lines\n * @param {import('eslint').Rule.RuleFixer} fixer\n */\n\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 {\n allowedPrefixes = [\n '@ts-', 'istanbul ', 'c8 ', 'v8 ', 'eslint', 'prettier-',\n ],\n contexts = settings.contexts || [],\n contextsAfter = /** @type {string[]} */ ([]),\n contextsBeforeAndAfter = [\n 'VariableDeclarator', 'TSPropertySignature', 'PropertyDefinition',\n ],\n enableFixer = true,\n enforceJsdocLineStyle = 'multi',\n lineOrBlockStyle = 'both',\n } = context.options[0] ?? {};\n\n let reportingNonJsdoc = false;\n\n /**\n * @param {string} messageId\n * @param {import('estree').Comment|Token} comment\n * @param {import('eslint').Rule.Node} node\n * @param {import('eslint').Rule.ReportFixer} fixer\n */\n const report = (messageId, comment, node, fixer) => {\n const loc = {\n end: {\n column: 0,\n /* c8 ignore next 2 -- Guard */\n // @ts-expect-error Ok\n line: (comment.loc?.start?.line ?? 1),\n },\n start: {\n column: 0,\n /* c8 ignore next 2 -- Guard */\n // @ts-expect-error Ok\n line: (comment.loc?.start?.line ?? 1),\n },\n };\n\n context.report({\n fix: enableFixer ? fixer : null,\n loc,\n messageId,\n node,\n });\n };\n\n /**\n * @param {import('eslint').Rule.Node} node\n * @param {import('eslint').AST.Token | import('estree').Comment | {\n * type: import('eslint').AST.TokenType|\"Line\"|\"Block\"|\"Shebang\",\n * range: [number, number],\n * value: string\n * }} comment\n * @param {AddComment} addComment\n * @param {import('../iterateJsdoc.js').Context[]} ctxts\n */\n const getFixer = (node, comment, addComment, ctxts) => {\n return /** @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 let baseNode =\n /**\n * @type {import('@typescript-eslint/types').TSESTree.Node|import('eslint').Rule.Node}\n */ (\n getReducedASTNode(node, sourceCode)\n );\n\n const decorator = getDecorator(\n /** @type {import('eslint').Rule.Node} */\n (baseNode),\n );\n if (decorator) {\n baseNode = /** @type {import('@typescript-eslint/types').TSESTree.Decorator} */ (\n decorator\n );\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 */ (ctxts).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\n return addComment(inlineCommentBlock, comment, indent, lines, fixer);\n };\n };\n\n /**\n * @param {import('eslint').AST.Token | import('estree').Comment | {\n * type: import('eslint').AST.TokenType|\"Line\"|\"Block\"|\"Shebang\",\n * range: [number, number],\n * value: string\n * }} comment\n * @param {import('eslint').Rule.Node} node\n * @param {AddComment} addComment\n * @param {import('../iterateJsdoc.js').Context[]} ctxts\n */\n const reportings = (comment, node, addComment, ctxts) => {\n const fixer = getFixer(node, comment, addComment, ctxts);\n\n if (comment.type === 'Block') {\n if (lineOrBlockStyle === 'line') {\n return;\n }\n\n report('blockCommentsJsdocStyle', comment, node, fixer);\n return;\n }\n\n if (comment.type === 'Line') {\n if (lineOrBlockStyle === 'block') {\n return;\n }\n\n report('lineCommentsJsdocStyle', comment, node, fixer);\n }\n };\n\n /**\n * @type {import('../iterateJsdoc.js').CheckJsdoc}\n */\n const checkNonJsdoc = (_info, _handler, node) => {\n const comment = getNonJsdocComment(sourceCode, node, settings);\n\n if (\n !comment ||\n /** @type {string[]} */\n (allowedPrefixes).some((prefix) => {\n return comment.value.trimStart().startsWith(prefix);\n })\n ) {\n return;\n }\n\n reportingNonJsdoc = true;\n\n /** @type {AddComment} */\n // eslint-disable-next-line unicorn/consistent-function-scoping -- Avoid conflicts\n const addComment = (inlineCommentBlock, commentToAdd, indent, lines, fixer) => {\n const insertion = (\n inlineCommentBlock || enforceJsdocLineStyle === 'single' ?\n `/** ${commentToAdd.value.trim()} ` :\n `/**\\n${indent}*${commentToAdd.value.trimEnd()}\\n${indent}`\n ) +\n `*/${'\\n'.repeat((lines || 1) - 1)}`;\n\n return fixer.replaceText(\n /** @type {import('eslint').AST.Token} */\n (commentToAdd),\n insertion,\n );\n };\n\n reportings(comment, node, addComment, contexts);\n };\n\n /**\n * @param {import('eslint').Rule.Node} node\n * @param {import('../iterateJsdoc.js').Context[]} ctxts\n */\n const checkNonJsdocAfter = (node, ctxts) => {\n const comment = getFollowingComment(sourceCode, node);\n\n if (\n !comment ||\n comment.value.startsWith('*') ||\n /** @type {string[]} */\n (allowedPrefixes).some((prefix) => {\n return comment.value.trimStart().startsWith(prefix);\n })\n ) {\n return;\n }\n\n /** @type {AddComment} */\n const addComment = (inlineCommentBlock, commentToAdd, indent, lines, fixer) => {\n const insertion = (\n inlineCommentBlock || enforceJsdocLineStyle === 'single' ?\n `/** ${commentToAdd.value.trim()} ` :\n `/**\\n${indent}*${commentToAdd.value.trimEnd()}\\n${indent}`\n ) +\n `*/${'\\n'.repeat((lines || 1) - 1)}${lines ? `\\n${indent.slice(1)}` : ' '}`;\n\n return [\n fixer.remove(\n /** @type {import('eslint').AST.Token} */\n (commentToAdd),\n ), fixer.insertTextBefore(\n node.type === 'VariableDeclarator' ? node.parent : node,\n insertion,\n ),\n ];\n };\n\n reportings(comment, node, addComment, ctxts);\n };\n\n // Todo: add contexts to check after (and handle if want both before and after)\n return {\n ...getContextObject(\n enforcedContexts(context, true, settings),\n checkNonJsdoc,\n ),\n ...getContextObject(\n contextsAfter,\n (_info, _handler, node) => {\n checkNonJsdocAfter(node, contextsAfter);\n },\n ),\n ...getContextObject(\n contextsBeforeAndAfter,\n (_info, _handler, node) => {\n checkNonJsdoc({}, null, node);\n if (!reportingNonJsdoc) {\n checkNonJsdocAfter(node, contextsBeforeAndAfter);\n }\n },\n ),\n };\n },\n meta: {\n docs: {\n description: 'Converts non-JSDoc comments preceding or following nodes into JSDoc ones',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/convert-to-jsdoc-comments.md#repos-sticky-header',\n },\n\n fixable: 'code',\n\n messages: {\n blockCommentsJsdocStyle: 'Block comments should be JSDoc-style.',\n lineCommentsJsdocStyle: 'Line comments should be JSDoc-style.',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowedPrefixes: {\n description: `An array of prefixes to allow at the beginning of a comment.\n\nDefaults to \\`['@ts-', 'istanbul ', 'c8 ', 'v8 ', 'eslint', 'prettier-']\\`.\n\nSupplying your own value overrides the defaults.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n contexts: {\n description: `The contexts array which will be checked for preceding content.\n\nCan either be strings or an object with a \\`context\\` string and an optional, default \\`false\\` \\`inlineCommentBlock\\` boolean.\n\nDefaults to \\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`, \\`TSDeclareFunction\\`.\n`,\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 },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n contextsAfter: {\n description: `The contexts array which will be checked for content on the same line after.\n\nCan either be strings or an object with a \\`context\\` string and an optional, default \\`false\\` \\`inlineCommentBlock\\` boolean.\n\nDefaults to an empty array.`,\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 },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n contextsBeforeAndAfter: {\n description: `The contexts array which will be checked for content before and on the same\nline after.\n\nCan either be strings or an object with a \\`context\\` string and an optional, default \\`false\\` \\`inlineCommentBlock\\` boolean.\n\nDefaults to \\`VariableDeclarator\\`, \\`TSPropertySignature\\`, \\`PropertyDefinition\\`.`,\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 },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n enableFixer: {\n description: 'Set to `false` to disable fixing.',\n type: 'boolean',\n },\n enforceJsdocLineStyle: {\n description: `What policy to enforce on the conversion of non-JSDoc comments without\nline breaks. (Non-JSDoc (mulitline) comments with line breaks will always\nbe converted to \\`multi\\` style JSDoc comments.)\n\n- \\`multi\\` - Convert to multi-line style\n\\`\\`\\`js\n/**\n * Some text\n */\n\\`\\`\\`\n- \\`single\\` - Convert to single-line style\n\\`\\`\\`js\n/** Some text */\n\\`\\`\\`\n\nDefaults to \\`multi\\`.\n`,\n enum: [\n 'multi', 'single',\n ],\n type: 'string',\n },\n lineOrBlockStyle: {\n description: `What style of comments to which to apply JSDoc conversion.\n\n- \\`block\\` - Applies to block-style comments (\\`/* ... */\\`)\n- \\`line\\` - Applies to line-style comments (\\`// ...\\`)\n- \\`both\\` - Applies to both block and line-style comments\n\nDefaults to \\`both\\`.`,\n enum: [\n 'block', 'line', 'both',\n ],\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n};\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAGA,IAAAC,WAAA,GAAAD,OAAA;AAKA,IAAAE,aAAA,GAAAF,OAAA;AAOA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GACe;EACbC,MAAMA,CAAEC,OAAO,EAAE;IACf;AACJ;AACA;AACA;AACA;AACA;AACA;;IAEI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;IAEI;IACA,MAAM;MACJC,UAAU,GAAGD,OAAO,CAACE,aAAa,CAAC;IACrC,CAAC,GAAGF,OAAO;IACX,MAAMG,QAAQ,GAAG,IAAAC,yBAAW,EAACJ,OAAO,CAAC;IACrC,IAAI,CAACG,QAAQ,EAAE;MACb,OAAO,CAAC,CAAC;IACX;IAEA,MAAM;MACJE,eAAe,GAAG,CAChB,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,CACzD;MACDC,QAAQ,GAAGH,QAAQ,CAACG,QAAQ,IAAI,EAAE;MAClCC,aAAa,IAAG,uBAAyB,EAAE,CAAC;MAC5CC,sBAAsB,GAAG,CACvB,oBAAoB,EAAE,qBAAqB,EAAE,oBAAoB,CAClE;MACDC,WAAW,GAAG,IAAI;MAClBC,qBAAqB,GAAG,OAAO;MAC/BC,gBAAgB,GAAG;IACrB,CAAC,GAAGX,OAAO,CAACY,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAE5B,IAAIC,iBAAiB,GAAG,KAAK;;IAE7B;AACJ;AACA;AACA;AACA;AACA;IACI,MAAMC,MAAM,GAAGA,CAACC,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AAE;gBACR;cACF,CAAC;cACDA,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDnC,sBAAsB,EAAE;UACtB8D,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA,qFAAqF;UACzES,KAAK,EAAE;YACLC,KAAK,EAAE,CACL;cACErC,IAAI,EAAE;YACR,CAAC,EACD;cACEkC,oBAAoB,EAAE,KAAK;cAC3BC,UAAU,EAAE;gBACV9E,OAAO,EAAE;kBACP2C,IAAI,EAAE;gBACR,CAAC;gBACDJ,kBAAkB,EAAE;kBAClBI,IAAI,EAAE;gBACR;cACF,CAAC;cACDA,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDlC,WAAW,EAAE;UACX6D,WAAW,EAAE,mCAAmC;UAChD3B,IAAI,EAAE;QACR,CAAC;QACDjC,qBAAqB,EAAE;UACrB4D,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;UACWW,IAAI,EAAE,CACJ,OAAO,EAAE,QAAQ,CAClB;UACDtC,IAAI,EAAE;QACR,CAAC;QACDhC,gBAAgB,EAAE;UAChB2D,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA,sBAAsB;UACVW,IAAI,EAAE,CACJ,OAAO,EAAE,MAAM,EAAE,MAAM,CACxB;UACDtC,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC;AAAAuC,MAAA,CAAArF,OAAA,GAAAA,OAAA,CAAAC,OAAA","ignoreList":[]}
|
|
@@ -163,12 +163,14 @@ declare const _default: {
|
|
|
163
163
|
additionalProperties: false;
|
|
164
164
|
properties: {
|
|
165
165
|
allowedPrefixes: {
|
|
166
|
+
description: string;
|
|
166
167
|
items: {
|
|
167
168
|
type: "string";
|
|
168
169
|
};
|
|
169
170
|
type: "array";
|
|
170
171
|
};
|
|
171
172
|
contexts: {
|
|
173
|
+
description: string;
|
|
172
174
|
items: {
|
|
173
175
|
anyOf: ({
|
|
174
176
|
type: "string";
|
|
@@ -190,6 +192,7 @@ declare const _default: {
|
|
|
190
192
|
type: "array";
|
|
191
193
|
};
|
|
192
194
|
contextsAfter: {
|
|
195
|
+
description: string;
|
|
193
196
|
items: {
|
|
194
197
|
anyOf: ({
|
|
195
198
|
type: "string";
|
|
@@ -211,6 +214,7 @@ declare const _default: {
|
|
|
211
214
|
type: "array";
|
|
212
215
|
};
|
|
213
216
|
contextsBeforeAndAfter: {
|
|
217
|
+
description: string;
|
|
214
218
|
items: {
|
|
215
219
|
anyOf: ({
|
|
216
220
|
type: "string";
|
|
@@ -232,13 +236,16 @@ declare const _default: {
|
|
|
232
236
|
type: "array";
|
|
233
237
|
};
|
|
234
238
|
enableFixer: {
|
|
239
|
+
description: string;
|
|
235
240
|
type: "boolean";
|
|
236
241
|
};
|
|
237
242
|
enforceJsdocLineStyle: {
|
|
243
|
+
description: string;
|
|
238
244
|
enum: string[];
|
|
239
245
|
type: "string";
|
|
240
246
|
};
|
|
241
247
|
lineOrBlockStyle: {
|
|
248
|
+
description: string;
|
|
242
249
|
enum: string[];
|
|
243
250
|
type: "string";
|
|
244
251
|
};
|
package/dist/rules/emptyTags.cjs
CHANGED
|
@@ -54,7 +54,7 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
54
54
|
iterateAllJsdocs: true,
|
|
55
55
|
meta: {
|
|
56
56
|
docs: {
|
|
57
|
-
description: '
|
|
57
|
+
description: 'Checks tags that are expected to be empty (e.g., `@abstract` or `@async`), reporting if they have content',
|
|
58
58
|
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/empty-tags.md#repos-sticky-header'
|
|
59
59
|
},
|
|
60
60
|
fixable: 'code',
|
|
@@ -62,6 +62,15 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
62
62
|
additionalProperties: false,
|
|
63
63
|
properties: {
|
|
64
64
|
tags: {
|
|
65
|
+
description: `If you want additional tags to be checked for their descriptions, you may
|
|
66
|
+
add them within this option.
|
|
67
|
+
|
|
68
|
+
\`\`\`js
|
|
69
|
+
{
|
|
70
|
+
'jsdoc/empty-tags': ['error', {tags: ['event']}]
|
|
71
|
+
}
|
|
72
|
+
\`\`\`
|
|
73
|
+
`,
|
|
65
74
|
items: {
|
|
66
75
|
type: 'string'
|
|
67
76
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emptyTags.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","defaultEmptyTags","Set","emptyIfNotClosure","emptyIfClosure","_default","exports","iterateJsdoc","jsdoc","settings","utils","emptyTags","filterTags","tag","tagName","has","hasOptionTag","tags","some","mode","key","entries","content","name","description","type","trim","length","test","fix","setTag","reportJSDoc","checkInternal","checkPrivate","iterateAllJsdocs","meta","docs","url","fixable","schema","additionalProperties","properties","items","module"],"sources":["../../src/rules/emptyTags.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nconst defaultEmptyTags = new Set([\n 'abstract', 'async', 'generator', 'global', 'hideconstructor',\n\n // jsdoc doesn't use this form in its docs, but allow for compatibility with\n // TypeScript which allows and Closure which requires\n 'ignore',\n\n // jsdoc doesn't use but allow for TypeScript\n 'inheritDoc', 'inner', 'instance',\n 'internal',\n\n 'overload',\n\n 'override',\n 'readonly',\n]);\n\nconst emptyIfNotClosure = new Set([\n // Closure doesn't allow with this casing\n 'inheritdoc', 'package', 'private', 'protected', 'public',\n\n 'static',\n]);\n\nconst emptyIfClosure = new Set([\n 'interface',\n]);\n\nexport default iterateJsdoc(({\n jsdoc,\n settings,\n utils,\n}) => {\n const emptyTags = utils.filterTags(({\n tag: tagName,\n }) => {\n return defaultEmptyTags.has(tagName) ||\n utils.hasOptionTag(tagName) && jsdoc.tags.some(({\n tag,\n }) => {\n return tag === tagName;\n }) ||\n settings.mode === 'closure' && emptyIfClosure.has(tagName) ||\n settings.mode !== 'closure' && emptyIfNotClosure.has(tagName);\n });\n\n for (const [\n key,\n tag,\n ] of emptyTags.entries()) {\n const content = tag.name || tag.description || tag.type;\n if (content.trim() && (\n // Allow for JSDoc-block final asterisks\n key !== emptyTags.length - 1 || !(/^\\s*\\*+$/v).test(content)\n )) {\n const fix = () => {\n // By time of call in fixer, `tag` will have `line` added\n utils.setTag(\n /**\n * @type {import('comment-parser').Spec & {\n * line: import('../iterateJsdoc.js').Integer\n * }}\n */ (tag),\n );\n };\n\n utils.reportJSDoc(`@${tag.tag} should be empty.`, tag, fix, true);\n }\n }\n}, {\n checkInternal: true,\n checkPrivate: true,\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: '
|
|
1
|
+
{"version":3,"file":"emptyTags.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","defaultEmptyTags","Set","emptyIfNotClosure","emptyIfClosure","_default","exports","iterateJsdoc","jsdoc","settings","utils","emptyTags","filterTags","tag","tagName","has","hasOptionTag","tags","some","mode","key","entries","content","name","description","type","trim","length","test","fix","setTag","reportJSDoc","checkInternal","checkPrivate","iterateAllJsdocs","meta","docs","url","fixable","schema","additionalProperties","properties","items","module"],"sources":["../../src/rules/emptyTags.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nconst defaultEmptyTags = new Set([\n 'abstract', 'async', 'generator', 'global', 'hideconstructor',\n\n // jsdoc doesn't use this form in its docs, but allow for compatibility with\n // TypeScript which allows and Closure which requires\n 'ignore',\n\n // jsdoc doesn't use but allow for TypeScript\n 'inheritDoc', 'inner', 'instance',\n 'internal',\n\n 'overload',\n\n 'override',\n 'readonly',\n]);\n\nconst emptyIfNotClosure = new Set([\n // Closure doesn't allow with this casing\n 'inheritdoc', 'package', 'private', 'protected', 'public',\n\n 'static',\n]);\n\nconst emptyIfClosure = new Set([\n 'interface',\n]);\n\nexport default iterateJsdoc(({\n jsdoc,\n settings,\n utils,\n}) => {\n const emptyTags = utils.filterTags(({\n tag: tagName,\n }) => {\n return defaultEmptyTags.has(tagName) ||\n utils.hasOptionTag(tagName) && jsdoc.tags.some(({\n tag,\n }) => {\n return tag === tagName;\n }) ||\n settings.mode === 'closure' && emptyIfClosure.has(tagName) ||\n settings.mode !== 'closure' && emptyIfNotClosure.has(tagName);\n });\n\n for (const [\n key,\n tag,\n ] of emptyTags.entries()) {\n const content = tag.name || tag.description || tag.type;\n if (content.trim() && (\n // Allow for JSDoc-block final asterisks\n key !== emptyTags.length - 1 || !(/^\\s*\\*+$/v).test(content)\n )) {\n const fix = () => {\n // By time of call in fixer, `tag` will have `line` added\n utils.setTag(\n /**\n * @type {import('comment-parser').Spec & {\n * line: import('../iterateJsdoc.js').Integer\n * }}\n */ (tag),\n );\n };\n\n utils.reportJSDoc(`@${tag.tag} should be empty.`, tag, fix, true);\n }\n }\n}, {\n checkInternal: true,\n checkPrivate: true,\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Checks tags that are expected to be empty (e.g., `@abstract` or `@async`), reporting if they have content',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/empty-tags.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n tags: {\n description: `If you want additional tags to be checked for their descriptions, you may\nadd them within this option.\n\n\\`\\`\\`js\n{\n 'jsdoc/empty-tags': ['error', {tags: ['event']}]\n}\n\\`\\`\\`\n`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9C,MAAMG,gBAAgB,GAAG,IAAIC,GAAG,CAAC,CAC/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I,CAAC,CAAC;IAChB;IACAN,GAAG,KAAKT,SAAS,CAACgB,MAAM,GAAG,CAAC,IAAI,CAAE,WAAW,CAAEC,IAAI,CAACN,OAAO,CAAC,CAC7D,EAAE;MACD,MAAMO,GAAG,GAAGA,CAAA,KAAM;QAChB;QACAnB,KAAK,CAACoB,MAAM;QACV;AACV;AACA;AACA;AACA;QAAejB,GACP,CAAC;MACH,CAAC;MAEDH,KAAK,CAACqB,WAAW,CAAC,IAAIlB,GAAG,CAACA,GAAG,mBAAmB,EAAEA,GAAG,EAAEgB,GAAG,EAAE,IAAI,CAAC;IACnE;EACF;AACF,CAAC,EAAE;EACDG,aAAa,EAAE,IAAI;EACnBC,YAAY,EAAE,IAAI;EAClBC,gBAAgB,EAAE,IAAI;EACtBC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJZ,WAAW,EAAE,2GAA2G;MACxHa,GAAG,EAAE;IACP,CAAC;IACDC,OAAO,EAAE,MAAM;IACfC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVxB,IAAI,EAAE;UACJO,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;UACWkB,KAAK,EAAE;YACLjB,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAkB,MAAA,CAAArC,OAAA,GAAAA,OAAA,CAAAN,OAAA","ignoreList":[]}
|
|
@@ -25,13 +25,27 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
25
25
|
contextDefaults: true,
|
|
26
26
|
meta: {
|
|
27
27
|
docs: {
|
|
28
|
-
description: '
|
|
28
|
+
description: 'Prohibits use of `@implements` on non-constructor functions (to enforce the tag only being used on classes/constructors).',
|
|
29
29
|
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/implements-on-classes.md#repos-sticky-header'
|
|
30
30
|
},
|
|
31
31
|
schema: [{
|
|
32
32
|
additionalProperties: false,
|
|
33
33
|
properties: {
|
|
34
34
|
contexts: {
|
|
35
|
+
description: `Set this to an array of strings representing the AST context (or an object with
|
|
36
|
+
\`context\` and \`comment\` properties) where you wish the rule to be applied.
|
|
37
|
+
|
|
38
|
+
\`context\` defaults to \`any\` and \`comment\` defaults to no specific comment context.
|
|
39
|
+
|
|
40
|
+
Overrides the default contexts (\`ArrowFunctionExpression\`, \`FunctionDeclaration\`,
|
|
41
|
+
\`FunctionExpression\`). Set to \`"any"\` if you want
|
|
42
|
+
the rule to apply to any JSDoc block throughout your files (as is necessary
|
|
43
|
+
for finding function blocks not attached to a function declaration or
|
|
44
|
+
expression, i.e., \`@callback\` or \`@function\` (or its aliases \`@func\` or
|
|
45
|
+
\`@method\`) (including those associated with an \`@interface\`).
|
|
46
|
+
|
|
47
|
+
See the ["AST and Selectors"](../#advanced-ast-and-selectors)
|
|
48
|
+
section of our Advanced docs for more on the expected format.`,
|
|
35
49
|
items: {
|
|
36
50
|
anyOf: [{
|
|
37
51
|
type: 'string'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implementsOnClasses.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","_default","exports","iterateJsdoc","report","utils","iteratingFunction","isIteratingFunctionOrVariable","hasATag","isConstructor","isVirtualFunction","forEachPreferredTag","tag","contextDefaults","meta","docs","description","url","schema","additionalProperties","properties","contexts","items","anyOf","type","comment","context","module"],"sources":["../../src/rules/implementsOnClasses.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n report,\n utils,\n}) => {\n const iteratingFunction = utils.isIteratingFunctionOrVariable();\n\n if (iteratingFunction) {\n if (utils.hasATag([\n 'class',\n 'constructor',\n ]) ||\n utils.isConstructor()\n ) {\n return;\n }\n } else if (!utils.isVirtualFunction()) {\n return;\n }\n\n utils.forEachPreferredTag('implements', (tag) => {\n report('@implements used on a non-constructor function', null, tag);\n });\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: '
|
|
1
|
+
{"version":3,"file":"implementsOnClasses.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","_default","exports","iterateJsdoc","report","utils","iteratingFunction","isIteratingFunctionOrVariable","hasATag","isConstructor","isVirtualFunction","forEachPreferredTag","tag","contextDefaults","meta","docs","description","url","schema","additionalProperties","properties","contexts","items","anyOf","type","comment","context","module"],"sources":["../../src/rules/implementsOnClasses.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\nexport default iterateJsdoc(({\n report,\n utils,\n}) => {\n const iteratingFunction = utils.isIteratingFunctionOrVariable();\n\n if (iteratingFunction) {\n if (utils.hasATag([\n 'class',\n 'constructor',\n ]) ||\n utils.isConstructor()\n ) {\n return;\n }\n } else if (!utils.isVirtualFunction()) {\n return;\n }\n\n utils.forEachPreferredTag('implements', (tag) => {\n report('@implements used on a non-constructor function', null, tag);\n });\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Prohibits use of `@implements` on non-constructor functions (to enforce the tag only being used on classes/constructors).',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/implements-on-classes.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n contexts: {\n description: `Set this to an array of strings representing the AST context (or an object with\n\\`context\\` and \\`comment\\` properties) where you wish the rule to be applied.\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nOverrides the default contexts (\\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`). Set to \\`\"any\"\\` if you want\nthe rule to apply to any JSDoc block throughout your files (as is necessary\nfor finding function blocks not attached to a function declaration or\nexpression, i.e., \\`@callback\\` or \\`@function\\` (or its aliases \\`@func\\` or\n\\`@method\\`) (including those associated with an \\`@interface\\`).\n\nSee the [\"AST and Selectors\"](../#advanced-ast-and-selectors)\nsection of our Advanced docs for more on the expected format.`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAE/B,IAAAG,qBAAY,EAAC,CAAC;EAC3BC,MAAM;EACNC;AACF,CAAC,KAAK;EACJ,MAAMC,iBAAiB,GAAGD,KAAK,CAACE,6BAA6B,CAAC,CAAC;EAE/D,IAAID,iBAAiB,EAAE;IACrB,IAAID,KAAK,CAACG,OAAO,CAAC,CAChB,OAAO,EACP,aAAa,CACd,CAAC,IACAH,KAAK,CAACI,aAAa,CAAC,CAAC,EACrB;MACA;IACF;EACF,CAAC,MAAM,IAAI,CAACJ,KAAK,CAACK,iBAAiB,CAAC,CAAC,EAAE;IACrC;EACF;EAEAL,KAAK,CAACM,mBAAmB,CAAC,YAAY,EAAGC,GAAG,IAAK;IAC/CR,MAAM,CAAC,gDAAgD,EAAE,IAAI,EAAEQ,GAAG,CAAC;EACrE,CAAC,CAAC;AACJ,CAAC,EAAE;EACDC,eAAe,EAAE,IAAI;EACrBC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJC,WAAW,EAAE,2HAA2H;MACxIC,GAAG,EAAE;IACP,CAAC;IACDC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVC,QAAQ,EAAE;UACRL,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D;UAClDM,KAAK,EAAE;YACLC,KAAK,EAAE,CACL;cACEC,IAAI,EAAE;YACR,CAAC,EACD;cACEL,oBAAoB,EAAE,KAAK;cAC3BC,UAAU,EAAE;gBACVK,OAAO,EAAE;kBACPD,IAAI,EAAE;gBACR,CAAC;gBACDE,OAAO,EAAE;kBACPF,IAAI,EAAE;gBACR;cACF,CAAC;cACDA,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAG,MAAA,CAAAzB,OAAA,GAAAA,OAAA,CAAAF,OAAA","ignoreList":[]}
|
|
@@ -114,6 +114,23 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
114
114
|
additionalProperties: false,
|
|
115
115
|
properties: {
|
|
116
116
|
aliases: {
|
|
117
|
+
description: `The \`aliases\` option allows indicating words as synonyms (aliases) of each other.
|
|
118
|
+
|
|
119
|
+
For example, with \`{ aliases: { emoji: ["smiley", "winkey"] } }\`, the following comment would be considered uninformative:
|
|
120
|
+
|
|
121
|
+
\`\`\`js
|
|
122
|
+
/** A smiley/winkey. */
|
|
123
|
+
let emoji;
|
|
124
|
+
\`\`\`
|
|
125
|
+
|
|
126
|
+
The default \`aliases\` option is:
|
|
127
|
+
|
|
128
|
+
\`\`\`json
|
|
129
|
+
{
|
|
130
|
+
"a": ["an", "our"]
|
|
131
|
+
}
|
|
132
|
+
\`\`\`
|
|
133
|
+
`,
|
|
117
134
|
patternProperties: {
|
|
118
135
|
'.*': {
|
|
119
136
|
items: {
|
|
@@ -124,12 +141,40 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
124
141
|
}
|
|
125
142
|
},
|
|
126
143
|
excludedTags: {
|
|
144
|
+
description: `Tags that should not be checked for valid contents.
|
|
145
|
+
|
|
146
|
+
For example, with \`{ excludedTags: ["category"] }\`, the following comment would not be considered uninformative:
|
|
147
|
+
|
|
148
|
+
\`\`\`js
|
|
149
|
+
/** @category Types */
|
|
150
|
+
function computeTypes(node) {
|
|
151
|
+
// ...
|
|
152
|
+
}
|
|
153
|
+
\`\`\`
|
|
154
|
+
|
|
155
|
+
No tags are excluded by default.
|
|
156
|
+
`,
|
|
127
157
|
items: {
|
|
128
158
|
type: 'string'
|
|
129
159
|
},
|
|
130
160
|
type: 'array'
|
|
131
161
|
},
|
|
132
162
|
uselessWords: {
|
|
163
|
+
description: `Words that are ignored when searching for one that adds meaning.
|
|
164
|
+
|
|
165
|
+
For example, with \`{ uselessWords: ["our"] }\`, the following comment would be considered uninformative:
|
|
166
|
+
|
|
167
|
+
\`\`\`js
|
|
168
|
+
/** Our text. */
|
|
169
|
+
let text;
|
|
170
|
+
\`\`\`
|
|
171
|
+
|
|
172
|
+
The default \`uselessWords\` option is:
|
|
173
|
+
|
|
174
|
+
\`\`\`json
|
|
175
|
+
["a", "an", "i", "in", "of", "s", "the"]
|
|
176
|
+
\`\`\`
|
|
177
|
+
`,
|
|
133
178
|
items: {
|
|
134
179
|
type: 'string'
|
|
135
180
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"informativeDocs.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","_areDocsInformative","e","__esModule","default","defaultAliases","a","defaultUselessWords","getNamesFromNode","node","type","parent","key","id","declaration","name","declarations","init","filter","Boolean","_default","exports","iterateJsdoc","context","jsdoc","report","utils","aliases","excludedTags","uselessWords","options","nodeNames","descriptionIsRedundant","text","extraName","textTrimmed","trim","areDocsInformative","join","description","lastDescriptionLine","getDescription","descriptionReported","tag","tags","includes","reportJSDoc","line","iterateAllJsdocs","meta","docs","url","schema","additionalProperties","properties","patternProperties","items","module"],"sources":["../../src/rules/informativeDocs.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\nimport {\n areDocsInformative,\n} from 'are-docs-informative';\n\nconst defaultAliases = {\n a: [\n 'an', 'our',\n ],\n};\n\nconst defaultUselessWords = [\n 'a', 'an', 'i', 'in', 'of', 's', 'the',\n];\n\n/**\n * @param {import('eslint').Rule.Node|import('@typescript-eslint/types').TSESTree.Node|null|undefined} node\n * @returns {string[]}\n */\nconst getNamesFromNode = (node) => {\n switch (node?.type) {\n case 'AccessorProperty':\n case 'MethodDefinition':\n case 'PropertyDefinition':\n case 'TSAbstractAccessorProperty':\n case 'TSAbstractMethodDefinition':\n case 'TSAbstractPropertyDefinition':\n return [\n ...getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.Node} */ (\n node.parent\n ).parent,\n ),\n ...getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.Node} */\n (node.key),\n ),\n ];\n\n case 'ClassDeclaration':\n case 'ClassExpression':\n case 'FunctionDeclaration':\n case 'FunctionExpression':\n case 'TSDeclareFunction':\n case 'TSEnumDeclaration':\n case 'TSEnumMember':\n case 'TSInterfaceDeclaration':\n case 'TSMethodSignature':\n case 'TSModuleDeclaration':\n case 'TSTypeAliasDeclaration':\n return getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.ClassDeclaration} */\n (node).id,\n );\n case 'ExportDefaultDeclaration':\n case 'ExportNamedDeclaration':\n return getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.ExportNamedDeclaration} */\n (node).declaration,\n );\n case 'Identifier':\n return [\n node.name,\n ];\n case 'Property':\n return getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.Node} */\n (node.key),\n );\n case 'VariableDeclaration':\n return getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.Node} */\n (node.declarations[0]),\n );\n case 'VariableDeclarator':\n return [\n ...getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.Node} */\n (node.id),\n ),\n ...getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.Node} */\n (node.init),\n ),\n ].filter(Boolean);\n default:\n return [];\n }\n};\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n node,\n report,\n utils,\n}) => {\n const /** @type {{aliases: {[key: string]: string[]}, excludedTags: string[], uselessWords: string[]}} */ {\n aliases = defaultAliases,\n excludedTags = [],\n uselessWords = defaultUselessWords,\n } = context.options[0] || {};\n const nodeNames = getNamesFromNode(node);\n\n /**\n * @param {string} text\n * @param {string} extraName\n * @returns {boolean}\n */\n const descriptionIsRedundant = (text, extraName = '') => {\n const textTrimmed = text.trim();\n return Boolean(textTrimmed) && !areDocsInformative(textTrimmed, [\n extraName, nodeNames,\n ].filter(Boolean).join(' '), {\n aliases,\n uselessWords,\n });\n };\n\n const {\n description,\n lastDescriptionLine,\n } = utils.getDescription();\n let descriptionReported = false;\n\n for (const tag of jsdoc.tags) {\n if (excludedTags.includes(tag.tag)) {\n continue;\n }\n\n if (descriptionIsRedundant(tag.description, tag.name)) {\n utils.reportJSDoc(\n 'This tag description only repeats the name it describes.',\n tag,\n );\n }\n\n descriptionReported ||= tag.description === description &&\n /** @type {import('comment-parser').Spec & {line: import('../iterateJsdoc.js').Integer}} */\n (tag).line === lastDescriptionLine;\n }\n\n if (!descriptionReported && descriptionIsRedundant(description)) {\n report('This description only repeats the name it describes.');\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description:\n 'This rule reports doc comments that only restate their attached name.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/informative-docs.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n aliases: {\n patternProperties: {\n '.*': {\n items: {\n type: 'string',\n },\n type: 'array',\n },\n },\n },\n excludedTags: {\n items: {\n type: 'string',\n },\n type: 'array',\n },\n uselessWords: {\n items: {\n type: 'string',\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AA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AAQ,CAACF,GAAG,CAACA,GAAG,CAAC,EAAE;MAClC;IACF;IAEA,IAAIX,sBAAsB,CAACW,GAAG,CAACJ,WAAW,EAAEI,GAAG,CAAC5B,IAAI,CAAC,EAAE;MACrDW,KAAK,CAACoB,WAAW,CACf,0DAA0D,EAC1DH,GACF,CAAC;IACH;IAEAD,mBAAmB,KAAKC,GAAG,CAACJ,WAAW,KAAKA,WAAW,IACrD;IACCI,GAAG,CAAEI,IAAI,KAAKP,mBAAmB;EACtC;EAEA,IAAI,CAACE,mBAAmB,IAAIV,sBAAsB,CAACO,WAAW,CAAC,EAAE;IAC/Dd,MAAM,CAAC,sDAAsD,CAAC;EAChE;AACF,CAAC,EAAE;EACDuB,gBAAgB,EAAE,IAAI;EACtBC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJX,WAAW,EACT,uEAAuE;MACzEY,GAAG,EAAE;IACP,CAAC;IACDC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACV3B,OAAO,EAAE;UACP4B,iBAAiB,EAAE;YACjB,IAAI,EAAE;cACJC,KAAK,EAAE;gBACL9C,IAAI,EAAE;cACR,CAAC;cACDA,IAAI,EAAE;YACR;UACF;QACF,CAAC;QACDkB,YAAY,EAAE;UACZ4B,KAAK,EAAE;YACL9C,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDmB,YAAY,EAAE;UACZ2B,KAAK,EAAE;YACL9C,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA+C,MAAA,CAAApC,OAAA,GAAAA,OAAA,CAAAjB,OAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"informativeDocs.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","_areDocsInformative","e","__esModule","default","defaultAliases","a","defaultUselessWords","getNamesFromNode","node","type","parent","key","id","declaration","name","declarations","init","filter","Boolean","_default","exports","iterateJsdoc","context","jsdoc","report","utils","aliases","excludedTags","uselessWords","options","nodeNames","descriptionIsRedundant","text","extraName","textTrimmed","trim","areDocsInformative","join","description","lastDescriptionLine","getDescription","descriptionReported","tag","tags","includes","reportJSDoc","line","iterateAllJsdocs","meta","docs","url","schema","additionalProperties","properties","patternProperties","items","module"],"sources":["../../src/rules/informativeDocs.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\nimport {\n areDocsInformative,\n} from 'are-docs-informative';\n\nconst defaultAliases = {\n a: [\n 'an', 'our',\n ],\n};\n\nconst defaultUselessWords = [\n 'a', 'an', 'i', 'in', 'of', 's', 'the',\n];\n\n/**\n * @param {import('eslint').Rule.Node|import('@typescript-eslint/types').TSESTree.Node|null|undefined} node\n * @returns {string[]}\n */\nconst getNamesFromNode = (node) => {\n switch (node?.type) {\n case 'AccessorProperty':\n case 'MethodDefinition':\n case 'PropertyDefinition':\n case 'TSAbstractAccessorProperty':\n case 'TSAbstractMethodDefinition':\n case 'TSAbstractPropertyDefinition':\n return [\n ...getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.Node} */ (\n node.parent\n ).parent,\n ),\n ...getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.Node} */\n (node.key),\n ),\n ];\n\n case 'ClassDeclaration':\n case 'ClassExpression':\n case 'FunctionDeclaration':\n case 'FunctionExpression':\n case 'TSDeclareFunction':\n case 'TSEnumDeclaration':\n case 'TSEnumMember':\n case 'TSInterfaceDeclaration':\n case 'TSMethodSignature':\n case 'TSModuleDeclaration':\n case 'TSTypeAliasDeclaration':\n return getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.ClassDeclaration} */\n (node).id,\n );\n case 'ExportDefaultDeclaration':\n case 'ExportNamedDeclaration':\n return getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.ExportNamedDeclaration} */\n (node).declaration,\n );\n case 'Identifier':\n return [\n node.name,\n ];\n case 'Property':\n return getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.Node} */\n (node.key),\n );\n case 'VariableDeclaration':\n return getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.Node} */\n (node.declarations[0]),\n );\n case 'VariableDeclarator':\n return [\n ...getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.Node} */\n (node.id),\n ),\n ...getNamesFromNode(\n /** @type {import('@typescript-eslint/types').TSESTree.Node} */\n (node.init),\n ),\n ].filter(Boolean);\n default:\n return [];\n }\n};\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n node,\n report,\n utils,\n}) => {\n const /** @type {{aliases: {[key: string]: string[]}, excludedTags: string[], uselessWords: string[]}} */ {\n aliases = defaultAliases,\n excludedTags = [],\n uselessWords = defaultUselessWords,\n } = context.options[0] || {};\n const nodeNames = getNamesFromNode(node);\n\n /**\n * @param {string} text\n * @param {string} extraName\n * @returns {boolean}\n */\n const descriptionIsRedundant = (text, extraName = '') => {\n const textTrimmed = text.trim();\n return Boolean(textTrimmed) && !areDocsInformative(textTrimmed, [\n extraName, nodeNames,\n ].filter(Boolean).join(' '), {\n aliases,\n uselessWords,\n });\n };\n\n const {\n description,\n lastDescriptionLine,\n } = utils.getDescription();\n let descriptionReported = false;\n\n for (const tag of jsdoc.tags) {\n if (excludedTags.includes(tag.tag)) {\n continue;\n }\n\n if (descriptionIsRedundant(tag.description, tag.name)) {\n utils.reportJSDoc(\n 'This tag description only repeats the name it describes.',\n tag,\n );\n }\n\n descriptionReported ||= tag.description === description &&\n /** @type {import('comment-parser').Spec & {line: import('../iterateJsdoc.js').Integer}} */\n (tag).line === lastDescriptionLine;\n }\n\n if (!descriptionReported && descriptionIsRedundant(description)) {\n report('This description only repeats the name it describes.');\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description:\n 'This rule reports doc comments that only restate their attached name.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/informative-docs.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n aliases: {\n description: `The \\`aliases\\` option allows indicating words as synonyms (aliases) of each other.\n\nFor example, with \\`{ aliases: { emoji: [\"smiley\", \"winkey\"] } }\\`, the following comment would be considered uninformative:\n\n\\`\\`\\`js\n/** A smiley/winkey. */\nlet emoji;\n\\`\\`\\`\n\nThe default \\`aliases\\` option is:\n\n\\`\\`\\`json\n{\n \"a\": [\"an\", \"our\"]\n}\n\\`\\`\\`\n`,\n patternProperties: {\n '.*': {\n items: {\n type: 'string',\n },\n type: 'array',\n },\n },\n },\n excludedTags: {\n description: `Tags that should not be checked for valid contents.\n\nFor example, with \\`{ excludedTags: [\"category\"] }\\`, the following comment would not be considered uninformative:\n\n\\`\\`\\`js\n/** @category Types */\nfunction computeTypes(node) {\n // ...\n}\n\\`\\`\\`\n\nNo tags are excluded by default.\n`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n uselessWords: {\n description: `Words that are ignored when searching for one that adds meaning.\n\nFor example, with \\`{ uselessWords: [\"our\"] }\\`, the following comment would be considered uninformative:\n\n\\`\\`\\`js\n/** Our text. */\nlet text;\n\\`\\`\\`\n\nThe default \\`uselessWords\\` option is:\n\n\\`\\`\\`json\n[\"a\", \"an\", \"i\", \"in\", \"of\", \"s\", \"the\"]\n\\`\\`\\`\n`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AAE8B,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9B,MAAMG,cAAc,GAAG;EACrBC,CAAC,EAAE,CACD,IAAI,EAAE,KAAK;AAEf,CAAC;AAED,MAAMC,mB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H;IAEAD,mBAAmB,KAAKC,GAAG,CAACJ,WAAW,KAAKA,WAAW,IACrD;IACCI,GAAG,CAAEI,IAAI,KAAKP,mBAAmB;EACtC;EAEA,IAAI,CAACE,mBAAmB,IAAIV,sBAAsB,CAACO,WAAW,CAAC,EAAE;IAC/Dd,MAAM,CAAC,sDAAsD,CAAC;EAChE;AACF,CAAC,EAAE;EACDuB,gBAAgB,EAAE,IAAI;EACtBC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJX,WAAW,EACT,uEAAuE;MACzEY,GAAG,EAAE;IACP,CAAC;IACDC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACV3B,OAAO,EAAE;UACPY,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;UACWgB,iBAAiB,EAAE;YACjB,IAAI,EAAE;cACJC,KAAK,EAAE;gBACL9C,IAAI,EAAE;cACR,CAAC;cACDA,IAAI,EAAE;YACR;UACF;QACF,CAAC;QACDkB,YAAY,EAAE;UACZW,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;UACWiB,KAAK,EAAE;YACL9C,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDmB,YAAY,EAAE;UACZU,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;UACWiB,KAAK,EAAE;YACL9C,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAA+C,MAAA,CAAApC,OAAA,GAAAA,OAAA,CAAAjB,OAAA","ignoreList":[]}
|
|
@@ -83,21 +83,35 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
83
83
|
additionalProperties: false,
|
|
84
84
|
properties: {
|
|
85
85
|
checkBlockStarts: {
|
|
86
|
+
description: `Whether to additionally check the start of blocks, such as classes or functions.
|
|
87
|
+
Defaults to \`false\`.
|
|
88
|
+
`,
|
|
86
89
|
type: 'boolean'
|
|
87
90
|
},
|
|
88
91
|
excludedTags: {
|
|
92
|
+
description: `An array of tags whose presence in the JSDoc block will prevent the
|
|
93
|
+
application of the rule. Defaults to \`['type']\` (i.e., if \`@type\` is present,
|
|
94
|
+
lines before the block will not be added).
|
|
95
|
+
`,
|
|
89
96
|
items: {
|
|
90
97
|
type: 'string'
|
|
91
98
|
},
|
|
92
99
|
type: 'array'
|
|
93
100
|
},
|
|
94
101
|
ignoreSameLine: {
|
|
102
|
+
description: `This option excludes cases where the JSDoc block occurs on the same line as a
|
|
103
|
+
preceding code or comment. Defaults to \`true\`.
|
|
104
|
+
`,
|
|
95
105
|
type: 'boolean'
|
|
96
106
|
},
|
|
97
107
|
ignoreSingleLines: {
|
|
108
|
+
description: `This option excludes cases where the JSDoc block is only one line long.
|
|
109
|
+
Defaults to \`true\`.
|
|
110
|
+
`,
|
|
98
111
|
type: 'boolean'
|
|
99
112
|
},
|
|
100
113
|
lines: {
|
|
114
|
+
description: 'The minimum number of lines to require. Defaults to 1.',
|
|
101
115
|
type: 'integer'
|
|
102
116
|
}
|
|
103
117
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linesBeforeBlock.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","startPunctuators","Set","_default","exports","iterateJsdoc","context","jsdocNode","report","sourceCode","utils","checkBlockStarts","excludedTags","ignoreSameLine","ignoreSingleLines","lines","options","hasATag","tokensBefore","getTokensBefore","includeComments","tokenBefore","at","type","has","value","loc","end","line","start","startLine","sameLine","fix","fixer","indent","spaceDiff","column","match","slice","tokenPrior","startColumn","pop","repeat","insertTextAfter","iterateAllJsdocs","meta","docs","description","url","fixable","schema","additionalProperties","properties","items","module"],"sources":["../../src/rules/linesBeforeBlock.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * Punctuators that begin a logical group should not require a line before it skipped. Specifically\n * `[` starts an array, `{` starts an object or block, `(` starts a grouping, and `=` starts a\n * declaration (like a variable or a type alias).\n */\nconst startPunctuators = new Set([\n '(', '=', '[', '{',\n]);\n\nexport default iterateJsdoc(({\n context,\n jsdocNode,\n report,\n sourceCode,\n utils,\n}) => {\n const {\n checkBlockStarts,\n excludedTags = [\n 'type',\n ],\n ignoreSameLine = true,\n ignoreSingleLines = true,\n lines = 1,\n } = context.options[0] || {};\n\n if (utils.hasATag(excludedTags)) {\n return;\n }\n\n const tokensBefore = sourceCode.getTokensBefore(jsdocNode, {\n includeComments: true,\n });\n const tokenBefore = tokensBefore.at(-1);\n if (\n !tokenBefore || (\n tokenBefore.type === 'Punctuator' &&\n !checkBlockStarts &&\n startPunctuators.has(tokenBefore.value)\n )\n ) {\n return;\n }\n\n if (tokenBefore.loc?.end?.line + lines >=\n /** @type {number} */\n (jsdocNode.loc?.start?.line)\n ) {\n const startLine = jsdocNode.loc?.start?.line;\n const sameLine = tokenBefore.loc?.end?.line === startLine;\n\n if (sameLine && ignoreSameLine) {\n return;\n }\n\n if (ignoreSingleLines && jsdocNode.loc?.start.line === jsdocNode.loc?.end.line) {\n return;\n }\n\n /** @type {import('eslint').Rule.ReportFixer} */\n const fix = (fixer) => {\n let indent = '';\n if (sameLine) {\n const spaceDiff = /** @type {number} */ (jsdocNode.loc?.start?.column) -\n /** @type {number} */ (tokenBefore.loc?.end?.column);\n // @ts-expect-error Should be a comment\n indent = /** @type {import('estree').Comment} */ (\n jsdocNode\n ).value.match(/^\\*\\n([\\t ]*) \\*/v)?.[1]?.slice(spaceDiff);\n if (!indent) {\n /** @type {import('eslint').AST.Token|import('estree').Comment|undefined} */\n let tokenPrior = tokenBefore;\n let startColumn;\n while (tokenPrior && tokenPrior?.loc?.start?.line === startLine) {\n startColumn = tokenPrior.loc?.start?.column;\n tokenPrior = tokensBefore.pop();\n }\n\n indent = ' '.repeat(\n /* c8 ignore next */\n /** @type {number} */ (startColumn ? startColumn - 1 : 0),\n );\n }\n }\n\n return fixer.insertTextAfter(\n /** @type {import('eslint').AST.Token} */\n (tokenBefore),\n '\\n'.repeat(lines) +\n (sameLine ? '\\n' + indent : ''),\n );\n };\n\n report(`Required ${lines} line(s) before JSDoc block`, fix);\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Enforces minimum number of newlines before JSDoc comment blocks',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/lines-before-block.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n checkBlockStarts: {\n type: 'boolean',\n },\n excludedTags: {\n items: {\n type: 'string',\n },\n type: 'array',\n },\n ignoreSameLine: {\n type: 'boolean',\n },\n ignoreSingleLines: {\n type: 'boolean',\n },\n lines: {\n type: 'integer',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9C;AACA;AACA;AACA;AACA;AACA,MAAMG,gBAAgB,GAAG,IAAIC,GAAG,CAAC,CAC/B,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CACnB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAJ,OAAA,GAEY,IAAAK,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC,SAAS;EACTC,MAAM;EACNC,UAAU;EACVC;AACF,CAAC,KAAK;EACJ,MAAM;IACJC,gBAAgB;IAChBC,YAAY,GAAG,CACb,MAAM,CACP;IACDC,cAAc,GAAG,IAAI;IAC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G,EAAES,MAAM,CAAC;QACpD;QACAF,MAAM,GAAG,uCACP3B,SAAS,CACTkB,KAAK,CAACY,KAAK,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,EAAEC,KAAK,CAACH,SAAS,CAAC;QACzD,IAAI,CAACD,MAAM,EAAE;UACX;UACA,IAAIK,UAAU,GAAGlB,WAAW;UAC5B,IAAImB,WAAW;UACf,OAAOD,UAAU,IAAIA,UAAU,EAAEb,GAAG,EAAEG,KAAK,EAAED,IAAI,KAAKE,SAAS,EAAE;YAC/DU,WAAW,GAAGD,UAAU,CAACb,GAAG,EAAEG,KAAK,EAAEO,MAAM;YAC3CG,UAAU,GAAGrB,YAAY,CAACuB,GAAG,CAAC,CAAC;UACjC;UAEAP,MAAM,GAAG,GAAG,CAACQ,MAAM,CACjB;UACA,qBAAuBF,WAAW,GAAGA,WAAW,GAAG,CAAC,GAAG,CACzD,CAAC;QACH;MACF;MAEA,OAAOP,KAAK,CAACU,eAAe,CAC1B;MACCtB,WAAW,EACZ,IAAI,CAACqB,MAAM,CAAC3B,KAAK,CAAC,IACjBgB,QAAQ,GAAG,IAAI,GAAGG,MAAM,GAAG,EAAE,CAChC,CAAC;IACH,CAAC;IAED1B,MAAM,CAAC,YAAYO,KAAK,6BAA6B,EAAEiB,GAAG,CAAC;EAC7D;AACF,CAAC,EAAE;EACDY,gBAAgB,EAAE,IAAI;EACtBC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJC,WAAW,EAAE,iEAAiE;MAC9EC,GAAG,EAAE;IACP,CAAC;IACDC,OAAO,EAAE,MAAM;IACfC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVzC,gBAAgB,EAAE;
|
|
1
|
+
{"version":3,"file":"linesBeforeBlock.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","startPunctuators","Set","_default","exports","iterateJsdoc","context","jsdocNode","report","sourceCode","utils","checkBlockStarts","excludedTags","ignoreSameLine","ignoreSingleLines","lines","options","hasATag","tokensBefore","getTokensBefore","includeComments","tokenBefore","at","type","has","value","loc","end","line","start","startLine","sameLine","fix","fixer","indent","spaceDiff","column","match","slice","tokenPrior","startColumn","pop","repeat","insertTextAfter","iterateAllJsdocs","meta","docs","description","url","fixable","schema","additionalProperties","properties","items","module"],"sources":["../../src/rules/linesBeforeBlock.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * Punctuators that begin a logical group should not require a line before it skipped. Specifically\n * `[` starts an array, `{` starts an object or block, `(` starts a grouping, and `=` starts a\n * declaration (like a variable or a type alias).\n */\nconst startPunctuators = new Set([\n '(', '=', '[', '{',\n]);\n\nexport default iterateJsdoc(({\n context,\n jsdocNode,\n report,\n sourceCode,\n utils,\n}) => {\n const {\n checkBlockStarts,\n excludedTags = [\n 'type',\n ],\n ignoreSameLine = true,\n ignoreSingleLines = true,\n lines = 1,\n } = context.options[0] || {};\n\n if (utils.hasATag(excludedTags)) {\n return;\n }\n\n const tokensBefore = sourceCode.getTokensBefore(jsdocNode, {\n includeComments: true,\n });\n const tokenBefore = tokensBefore.at(-1);\n if (\n !tokenBefore || (\n tokenBefore.type === 'Punctuator' &&\n !checkBlockStarts &&\n startPunctuators.has(tokenBefore.value)\n )\n ) {\n return;\n }\n\n if (tokenBefore.loc?.end?.line + lines >=\n /** @type {number} */\n (jsdocNode.loc?.start?.line)\n ) {\n const startLine = jsdocNode.loc?.start?.line;\n const sameLine = tokenBefore.loc?.end?.line === startLine;\n\n if (sameLine && ignoreSameLine) {\n return;\n }\n\n if (ignoreSingleLines && jsdocNode.loc?.start.line === jsdocNode.loc?.end.line) {\n return;\n }\n\n /** @type {import('eslint').Rule.ReportFixer} */\n const fix = (fixer) => {\n let indent = '';\n if (sameLine) {\n const spaceDiff = /** @type {number} */ (jsdocNode.loc?.start?.column) -\n /** @type {number} */ (tokenBefore.loc?.end?.column);\n // @ts-expect-error Should be a comment\n indent = /** @type {import('estree').Comment} */ (\n jsdocNode\n ).value.match(/^\\*\\n([\\t ]*) \\*/v)?.[1]?.slice(spaceDiff);\n if (!indent) {\n /** @type {import('eslint').AST.Token|import('estree').Comment|undefined} */\n let tokenPrior = tokenBefore;\n let startColumn;\n while (tokenPrior && tokenPrior?.loc?.start?.line === startLine) {\n startColumn = tokenPrior.loc?.start?.column;\n tokenPrior = tokensBefore.pop();\n }\n\n indent = ' '.repeat(\n /* c8 ignore next */\n /** @type {number} */ (startColumn ? startColumn - 1 : 0),\n );\n }\n }\n\n return fixer.insertTextAfter(\n /** @type {import('eslint').AST.Token} */\n (tokenBefore),\n '\\n'.repeat(lines) +\n (sameLine ? '\\n' + indent : ''),\n );\n };\n\n report(`Required ${lines} line(s) before JSDoc block`, fix);\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Enforces minimum number of newlines before JSDoc comment blocks',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/lines-before-block.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n checkBlockStarts: {\n description: `Whether to additionally check the start of blocks, such as classes or functions.\nDefaults to \\`false\\`.\n`,\n type: 'boolean',\n },\n excludedTags: {\n description: `An array of tags whose presence in the JSDoc block will prevent the\napplication of the rule. Defaults to \\`['type']\\` (i.e., if \\`@type\\` is present,\nlines before the block will not be added).\n`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n ignoreSameLine: {\n description: `This option excludes cases where the JSDoc block occurs on the same line as a\npreceding code or comment. Defaults to \\`true\\`.\n`,\n type: 'boolean',\n },\n ignoreSingleLines: {\n description: `This option excludes cases where the JSDoc block is only one line long.\nDefaults to \\`true\\`.\n`,\n type: 'boolean',\n },\n lines: {\n description: 'The minimum number of lines to require. Defaults to 1.',\n type: 'integer',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OA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