eslint-plugin-jsdoc 55.3.0 → 56.0.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.
- package/dist/cjs/WarnSettings.d.ts +16 -0
- package/dist/cjs/WarnSettings.js +30 -0
- package/dist/cjs/alignTransform.d.ts +33 -0
- package/dist/cjs/alignTransform.js +285 -0
- package/dist/cjs/defaultTagOrder.d.ts +4 -0
- package/dist/cjs/defaultTagOrder.js +152 -0
- package/dist/cjs/exportParser.d.ts +40 -0
- package/dist/cjs/exportParser.js +754 -0
- package/dist/cjs/getDefaultTagStructureForMode.d.ts +10 -0
- package/dist/cjs/getDefaultTagStructureForMode.js +840 -0
- package/dist/cjs/getJsdocProcessorPlugin.cjs +4 -0
- package/dist/cjs/getJsdocProcessorPlugin.d.cts +1 -0
- package/dist/cjs/getJsdocProcessorPlugin.d.ts +66 -0
- package/dist/cjs/getJsdocProcessorPlugin.js +553 -0
- package/dist/cjs/index-cjs.d.ts +16 -0
- package/dist/cjs/index-cjs.js +492 -0
- package/dist/cjs/index.cjs.cjs +6 -0
- package/dist/cjs/index.cjs.d.cts +2 -0
- package/dist/cjs/iterateJsdoc.cjs +38 -0
- package/dist/cjs/iterateJsdoc.d.cts +2 -0
- package/dist/cjs/iterateJsdoc.d.ts +462 -0
- package/dist/cjs/iterateJsdoc.js +1981 -0
- package/dist/cjs/jsdocUtils.d.ts +454 -0
- package/dist/cjs/jsdocUtils.js +1470 -0
- package/dist/cjs/rules/checkAccess.d.ts +2 -0
- package/dist/cjs/rules/checkAccess.js +35 -0
- package/dist/cjs/rules/checkAlignment.d.ts +2 -0
- package/dist/cjs/rules/checkAlignment.js +63 -0
- package/dist/cjs/rules/checkExamples.d.ts +3 -0
- package/dist/cjs/rules/checkExamples.js +486 -0
- package/dist/cjs/rules/checkIndentation.d.ts +2 -0
- package/dist/cjs/rules/checkIndentation.js +66 -0
- package/dist/cjs/rules/checkLineAlignment.d.ts +9 -0
- package/dist/cjs/rules/checkLineAlignment.js +297 -0
- package/dist/cjs/rules/checkParamNames.d.ts +2 -0
- package/dist/cjs/rules/checkParamNames.js +320 -0
- package/dist/cjs/rules/checkPropertyNames.d.ts +2 -0
- package/dist/cjs/rules/checkPropertyNames.js +105 -0
- package/dist/cjs/rules/checkSyntax.d.ts +2 -0
- package/dist/cjs/rules/checkSyntax.js +27 -0
- package/dist/cjs/rules/checkTagNames.d.ts +2 -0
- package/dist/cjs/rules/checkTagNames.js +252 -0
- package/dist/cjs/rules/checkTemplateNames.d.ts +2 -0
- package/dist/cjs/rules/checkTemplateNames.js +189 -0
- package/dist/cjs/rules/checkTypes.d.ts +2 -0
- package/dist/cjs/rules/checkTypes.js +421 -0
- package/dist/cjs/rules/checkValues.d.ts +2 -0
- package/dist/cjs/rules/checkValues.js +163 -0
- package/dist/cjs/rules/convertToJsdocComments.d.ts +251 -0
- package/dist/cjs/rules/convertToJsdocComments.js +313 -0
- package/dist/cjs/rules/emptyTags.d.ts +2 -0
- package/dist/cjs/rules/emptyTags.js +79 -0
- package/dist/cjs/rules/implementsOnClasses.d.ts +2 -0
- package/dist/cjs/rules/implementsOnClasses.js +63 -0
- package/dist/cjs/rules/importsAsDependencies.d.ts +2 -0
- package/dist/cjs/rules/importsAsDependencies.js +105 -0
- package/dist/cjs/rules/informativeDocs.d.ts +2 -0
- package/dist/cjs/rules/informativeDocs.js +153 -0
- package/dist/cjs/rules/linesBeforeBlock.d.ts +2 -0
- package/dist/cjs/rules/linesBeforeBlock.js +106 -0
- package/dist/cjs/rules/matchDescription.d.ts +2 -0
- package/dist/cjs/rules/matchDescription.js +240 -0
- package/dist/cjs/rules/matchName.d.ts +2 -0
- package/dist/cjs/rules/matchName.js +122 -0
- package/dist/cjs/rules/multilineBlocks.d.ts +2 -0
- package/dist/cjs/rules/multilineBlocks.js +339 -0
- package/dist/cjs/rules/noBadBlocks.d.ts +2 -0
- package/dist/cjs/rules/noBadBlocks.js +88 -0
- package/dist/cjs/rules/noBlankBlockDescriptions.d.ts +2 -0
- package/dist/cjs/rules/noBlankBlockDescriptions.js +56 -0
- package/dist/cjs/rules/noBlankBlocks.d.ts +2 -0
- package/dist/cjs/rules/noBlankBlocks.js +41 -0
- package/dist/cjs/rules/noDefaults.d.ts +2 -0
- package/dist/cjs/rules/noDefaults.js +84 -0
- package/dist/cjs/rules/noMissingSyntax.d.ts +9 -0
- package/dist/cjs/rules/noMissingSyntax.js +164 -0
- package/dist/cjs/rules/noMultiAsterisks.d.ts +2 -0
- package/dist/cjs/rules/noMultiAsterisks.js +83 -0
- package/dist/cjs/rules/noRestrictedSyntax.d.ts +2 -0
- package/dist/cjs/rules/noRestrictedSyntax.js +75 -0
- package/dist/cjs/rules/noTypes.d.ts +2 -0
- package/dist/cjs/rules/noTypes.js +88 -0
- package/dist/cjs/rules/noUndefinedTypes.d.ts +2 -0
- package/dist/cjs/rules/noUndefinedTypes.js +451 -0
- package/dist/cjs/rules/requireAsteriskPrefix.d.ts +2 -0
- package/dist/cjs/rules/requireAsteriskPrefix.js +144 -0
- package/dist/cjs/rules/requireDescription.d.ts +2 -0
- package/dist/cjs/rules/requireDescription.js +136 -0
- package/dist/cjs/rules/requireDescriptionCompleteSentence.d.ts +2 -0
- package/dist/cjs/rules/requireDescriptionCompleteSentence.js +258 -0
- package/dist/cjs/rules/requireExample.d.ts +2 -0
- package/dist/cjs/rules/requireExample.js +103 -0
- package/dist/cjs/rules/requireFileOverview.d.ts +2 -0
- package/dist/cjs/rules/requireFileOverview.js +117 -0
- package/dist/cjs/rules/requireHyphenBeforeParamDescription.d.ts +2 -0
- package/dist/cjs/rules/requireHyphenBeforeParamDescription.js +144 -0
- package/dist/cjs/rules/requireJsdoc.d.ts +25 -0
- package/dist/cjs/rules/requireJsdoc.js +629 -0
- package/dist/cjs/rules/requireParam.d.ts +3 -0
- package/dist/cjs/rules/requireParam.js +480 -0
- package/dist/cjs/rules/requireParamDescription.d.ts +2 -0
- package/dist/cjs/rules/requireParamDescription.js +77 -0
- package/dist/cjs/rules/requireParamName.d.ts +2 -0
- package/dist/cjs/rules/requireParamName.js +52 -0
- package/dist/cjs/rules/requireParamType.d.ts +2 -0
- package/dist/cjs/rules/requireParamType.js +77 -0
- package/dist/cjs/rules/requireProperty.d.ts +2 -0
- package/dist/cjs/rules/requireProperty.js +44 -0
- package/dist/cjs/rules/requirePropertyDescription.d.ts +2 -0
- package/dist/cjs/rules/requirePropertyDescription.js +22 -0
- package/dist/cjs/rules/requirePropertyName.d.ts +2 -0
- package/dist/cjs/rules/requirePropertyName.js +22 -0
- package/dist/cjs/rules/requirePropertyType.d.ts +2 -0
- package/dist/cjs/rules/requirePropertyType.js +22 -0
- package/dist/cjs/rules/requireReturns.d.ts +2 -0
- package/dist/cjs/rules/requireReturns.js +197 -0
- package/dist/cjs/rules/requireReturnsCheck.d.ts +2 -0
- package/dist/cjs/rules/requireReturnsCheck.js +108 -0
- package/dist/cjs/rules/requireReturnsDescription.d.ts +2 -0
- package/dist/cjs/rules/requireReturnsDescription.js +58 -0
- package/dist/cjs/rules/requireReturnsType.d.ts +2 -0
- package/dist/cjs/rules/requireReturnsType.js +52 -0
- package/dist/cjs/rules/requireTemplate.d.ts +2 -0
- package/dist/cjs/rules/requireTemplate.js +173 -0
- package/dist/cjs/rules/requireThrows.d.ts +2 -0
- package/dist/cjs/rules/requireThrows.js +101 -0
- package/dist/cjs/rules/requireYields.d.ts +2 -0
- package/dist/cjs/rules/requireYields.js +172 -0
- package/dist/cjs/rules/requireYieldsCheck.d.ts +2 -0
- package/dist/cjs/rules/requireYieldsCheck.js +164 -0
- package/dist/cjs/rules/sortTags.d.ts +2 -0
- package/dist/cjs/rules/sortTags.js +392 -0
- package/dist/cjs/rules/tagLines.d.ts +2 -0
- package/dist/cjs/rules/tagLines.js +259 -0
- package/dist/cjs/rules/textEscaping.d.ts +2 -0
- package/dist/cjs/rules/textEscaping.js +125 -0
- package/dist/cjs/rules/typeFormatting.d.ts +2 -0
- package/dist/cjs/rules/typeFormatting.js +328 -0
- package/dist/cjs/rules/validTypes.d.ts +2 -0
- package/dist/cjs/rules/validTypes.js +333 -0
- package/dist/cjs/tagNames.d.ts +15 -0
- package/dist/cjs/tagNames.js +209 -0
- package/dist/cjs/utils/hasReturnValue.d.ts +19 -0
- package/dist/cjs/utils/hasReturnValue.js +469 -0
- package/dist/getJsdocProcessorPlugin.cts +3 -0
- package/dist/index.cjs.cts +3 -0
- package/dist/iterateJsdoc.cts +6 -0
- package/dist/rules/typeFormatting.cjs +82 -38
- package/dist/rules/typeFormatting.cjs.map +1 -1
- package/dist/rules.d.ts +4 -7
- package/package.json +24 -13
- package/src/getJsdocProcessorPlugin.cts +3 -0
- package/src/index.cjs.cts +3 -0
- package/src/iterateJsdoc.cts +6 -0
- package/src/rules/typeFormatting.js +104 -40
- package/src/rules.d.ts +4 -7
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
create(context: import("eslint").Rule.RuleContext): {
|
|
3
|
+
[x: string]: ((...args: any[]) => void) | ((codePath: import("eslint").Rule.CodePath, node: import("eslint").Rule.Node) => void) | ((segment: import("eslint").Rule.CodePathSegment, node: import("eslint").Rule.Node) => void) | ((fromSegment: import("eslint").Rule.CodePathSegment, toSegment: import("eslint").Rule.CodePathSegment, node: import("eslint").Rule.Node) => void) | ((node: import("eslint").Rule.Node) => void) | undefined;
|
|
4
|
+
onCodePathStart?: ((codePath: import("eslint").Rule.CodePath, node: import("eslint").Rule.Node) => void) | undefined;
|
|
5
|
+
onCodePathEnd?: ((codePath: import("eslint").Rule.CodePath, node: import("eslint").Rule.Node) => void) | undefined;
|
|
6
|
+
onCodePathSegmentStart?: ((segment: import("eslint").Rule.CodePathSegment, node: import("eslint").Rule.Node) => void) | undefined;
|
|
7
|
+
onCodePathSegmentEnd?: ((segment: import("eslint").Rule.CodePathSegment, node: import("eslint").Rule.Node) => void) | undefined;
|
|
8
|
+
onCodePathSegmentLoop?: ((fromSegment: import("eslint").Rule.CodePathSegment, toSegment: import("eslint").Rule.CodePathSegment, node: import("eslint").Rule.Node) => void) | undefined;
|
|
9
|
+
ArrayExpression?: ((node: import("estree").ArrayExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
10
|
+
"ArrayExpression:exit"?: ((node: import("estree").ArrayExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
11
|
+
ArrayPattern?: ((node: import("estree").ArrayPattern & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
12
|
+
"ArrayPattern:exit"?: ((node: import("estree").ArrayPattern & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
13
|
+
ArrowFunctionExpression?: ((node: import("estree").ArrowFunctionExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
14
|
+
"ArrowFunctionExpression:exit"?: ((node: import("estree").ArrowFunctionExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
15
|
+
AssignmentExpression?: ((node: import("estree").AssignmentExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
16
|
+
"AssignmentExpression:exit"?: ((node: import("estree").AssignmentExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
17
|
+
AssignmentPattern?: ((node: import("estree").AssignmentPattern & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
18
|
+
"AssignmentPattern:exit"?: ((node: import("estree").AssignmentPattern & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
19
|
+
AwaitExpression?: ((node: import("estree").AwaitExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
20
|
+
"AwaitExpression:exit"?: ((node: import("estree").AwaitExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
21
|
+
BinaryExpression?: ((node: import("estree").BinaryExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
22
|
+
"BinaryExpression:exit"?: ((node: import("estree").BinaryExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
23
|
+
BlockStatement?: ((node: import("estree").BlockStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
24
|
+
"BlockStatement:exit"?: ((node: import("estree").BlockStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
25
|
+
BreakStatement?: ((node: import("estree").BreakStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
26
|
+
"BreakStatement:exit"?: ((node: import("estree").BreakStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
27
|
+
CallExpression?: ((node: import("estree").CallExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
28
|
+
"CallExpression:exit"?: ((node: import("estree").CallExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
29
|
+
CatchClause?: ((node: import("estree").CatchClause & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
30
|
+
"CatchClause:exit"?: ((node: import("estree").CatchClause & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
31
|
+
ChainExpression?: ((node: import("estree").ChainExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
32
|
+
"ChainExpression:exit"?: ((node: import("estree").ChainExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
33
|
+
ClassBody?: ((node: import("estree").ClassBody & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
34
|
+
"ClassBody:exit"?: ((node: import("estree").ClassBody & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
35
|
+
ClassDeclaration?: ((node: import("estree").ClassDeclaration & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
36
|
+
"ClassDeclaration:exit"?: ((node: import("estree").ClassDeclaration & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
37
|
+
ClassExpression?: ((node: import("estree").ClassExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
38
|
+
"ClassExpression:exit"?: ((node: import("estree").ClassExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
39
|
+
ConditionalExpression?: ((node: import("estree").ConditionalExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
40
|
+
"ConditionalExpression:exit"?: ((node: import("estree").ConditionalExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
41
|
+
ContinueStatement?: ((node: import("estree").ContinueStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
42
|
+
"ContinueStatement:exit"?: ((node: import("estree").ContinueStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
43
|
+
DebuggerStatement?: ((node: import("estree").DebuggerStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
44
|
+
"DebuggerStatement:exit"?: ((node: import("estree").DebuggerStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
45
|
+
DoWhileStatement?: ((node: import("estree").DoWhileStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
46
|
+
"DoWhileStatement:exit"?: ((node: import("estree").DoWhileStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
47
|
+
EmptyStatement?: ((node: import("estree").EmptyStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
48
|
+
"EmptyStatement:exit"?: ((node: import("estree").EmptyStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
49
|
+
ExportAllDeclaration?: ((node: import("estree").ExportAllDeclaration & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
50
|
+
"ExportAllDeclaration:exit"?: ((node: import("estree").ExportAllDeclaration & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
51
|
+
ExportDefaultDeclaration?: ((node: import("estree").ExportDefaultDeclaration & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
52
|
+
"ExportDefaultDeclaration:exit"?: ((node: import("estree").ExportDefaultDeclaration & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
53
|
+
ExportNamedDeclaration?: ((node: import("estree").ExportNamedDeclaration & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
54
|
+
"ExportNamedDeclaration:exit"?: ((node: import("estree").ExportNamedDeclaration & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
55
|
+
ExportSpecifier?: ((node: import("estree").ExportSpecifier & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
56
|
+
"ExportSpecifier:exit"?: ((node: import("estree").ExportSpecifier & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
57
|
+
ExpressionStatement?: ((node: import("estree").ExpressionStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
58
|
+
"ExpressionStatement:exit"?: ((node: import("estree").ExpressionStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
59
|
+
ForInStatement?: ((node: import("estree").ForInStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
60
|
+
"ForInStatement:exit"?: ((node: import("estree").ForInStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
61
|
+
ForOfStatement?: ((node: import("estree").ForOfStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
62
|
+
"ForOfStatement:exit"?: ((node: import("estree").ForOfStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
63
|
+
ForStatement?: ((node: import("estree").ForStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
64
|
+
"ForStatement:exit"?: ((node: import("estree").ForStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
65
|
+
FunctionDeclaration?: ((node: import("estree").FunctionDeclaration & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
66
|
+
"FunctionDeclaration:exit"?: ((node: import("estree").FunctionDeclaration & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
67
|
+
FunctionExpression?: ((node: import("estree").FunctionExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
68
|
+
"FunctionExpression:exit"?: ((node: import("estree").FunctionExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
69
|
+
Identifier?: ((node: import("estree").Identifier & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
70
|
+
"Identifier:exit"?: ((node: import("estree").Identifier & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
71
|
+
IfStatement?: ((node: import("estree").IfStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
72
|
+
"IfStatement:exit"?: ((node: import("estree").IfStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
73
|
+
ImportDeclaration?: ((node: import("estree").ImportDeclaration & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
74
|
+
"ImportDeclaration:exit"?: ((node: import("estree").ImportDeclaration & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
75
|
+
ImportDefaultSpecifier?: ((node: import("estree").ImportDefaultSpecifier & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
76
|
+
"ImportDefaultSpecifier:exit"?: ((node: import("estree").ImportDefaultSpecifier & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
77
|
+
ImportExpression?: ((node: import("estree").ImportExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
78
|
+
"ImportExpression:exit"?: ((node: import("estree").ImportExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
79
|
+
ImportNamespaceSpecifier?: ((node: import("estree").ImportNamespaceSpecifier & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
80
|
+
"ImportNamespaceSpecifier:exit"?: ((node: import("estree").ImportNamespaceSpecifier & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
81
|
+
ImportSpecifier?: ((node: import("estree").ImportSpecifier & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
82
|
+
"ImportSpecifier:exit"?: ((node: import("estree").ImportSpecifier & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
83
|
+
LabeledStatement?: ((node: import("estree").LabeledStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
84
|
+
"LabeledStatement:exit"?: ((node: import("estree").LabeledStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
85
|
+
Literal?: ((node: import("estree").Literal & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
86
|
+
"Literal:exit"?: ((node: import("estree").Literal & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
87
|
+
LogicalExpression?: ((node: import("estree").LogicalExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
88
|
+
"LogicalExpression:exit"?: ((node: import("estree").LogicalExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
89
|
+
MemberExpression?: ((node: import("estree").MemberExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
90
|
+
"MemberExpression:exit"?: ((node: import("estree").MemberExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
91
|
+
MetaProperty?: ((node: import("estree").MetaProperty & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
92
|
+
"MetaProperty:exit"?: ((node: import("estree").MetaProperty & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
93
|
+
MethodDefinition?: ((node: import("estree").MethodDefinition & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
94
|
+
"MethodDefinition:exit"?: ((node: import("estree").MethodDefinition & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
95
|
+
NewExpression?: ((node: import("estree").NewExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
96
|
+
"NewExpression:exit"?: ((node: import("estree").NewExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
97
|
+
ObjectExpression?: ((node: import("estree").ObjectExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
98
|
+
"ObjectExpression:exit"?: ((node: import("estree").ObjectExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
99
|
+
ObjectPattern?: ((node: import("estree").ObjectPattern & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
100
|
+
"ObjectPattern:exit"?: ((node: import("estree").ObjectPattern & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
101
|
+
PrivateIdentifier?: ((node: import("estree").PrivateIdentifier & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
102
|
+
"PrivateIdentifier:exit"?: ((node: import("estree").PrivateIdentifier & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
103
|
+
Program?: ((node: import("estree").Program) => void) | undefined;
|
|
104
|
+
"Program:exit"?: ((node: import("estree").Program) => void) | undefined;
|
|
105
|
+
Property?: ((node: import("estree").Property & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
106
|
+
"Property:exit"?: ((node: import("estree").Property & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
107
|
+
PropertyDefinition?: ((node: import("estree").PropertyDefinition & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
108
|
+
"PropertyDefinition:exit"?: ((node: import("estree").PropertyDefinition & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
109
|
+
RestElement?: ((node: import("estree").RestElement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
110
|
+
"RestElement:exit"?: ((node: import("estree").RestElement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
111
|
+
ReturnStatement?: ((node: import("estree").ReturnStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
112
|
+
"ReturnStatement:exit"?: ((node: import("estree").ReturnStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
113
|
+
SequenceExpression?: ((node: import("estree").SequenceExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
114
|
+
"SequenceExpression:exit"?: ((node: import("estree").SequenceExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
115
|
+
SpreadElement?: ((node: import("estree").SpreadElement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
116
|
+
"SpreadElement:exit"?: ((node: import("estree").SpreadElement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
117
|
+
StaticBlock?: ((node: import("estree").StaticBlock & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
118
|
+
"StaticBlock:exit"?: ((node: import("estree").StaticBlock & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
119
|
+
Super?: ((node: import("estree").Super & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
120
|
+
"Super:exit"?: ((node: import("estree").Super & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
121
|
+
SwitchCase?: ((node: import("estree").SwitchCase & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
122
|
+
"SwitchCase:exit"?: ((node: import("estree").SwitchCase & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
123
|
+
SwitchStatement?: ((node: import("estree").SwitchStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
124
|
+
"SwitchStatement:exit"?: ((node: import("estree").SwitchStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
125
|
+
TaggedTemplateExpression?: ((node: import("estree").TaggedTemplateExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
126
|
+
"TaggedTemplateExpression:exit"?: ((node: import("estree").TaggedTemplateExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
127
|
+
TemplateElement?: ((node: import("estree").TemplateElement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
128
|
+
"TemplateElement:exit"?: ((node: import("estree").TemplateElement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
129
|
+
TemplateLiteral?: ((node: import("estree").TemplateLiteral & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
130
|
+
"TemplateLiteral:exit"?: ((node: import("estree").TemplateLiteral & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
131
|
+
ThisExpression?: ((node: import("estree").ThisExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
132
|
+
"ThisExpression:exit"?: ((node: import("estree").ThisExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
133
|
+
ThrowStatement?: ((node: import("estree").ThrowStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
134
|
+
"ThrowStatement:exit"?: ((node: import("estree").ThrowStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
135
|
+
TryStatement?: ((node: import("estree").TryStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
136
|
+
"TryStatement:exit"?: ((node: import("estree").TryStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
137
|
+
UnaryExpression?: ((node: import("estree").UnaryExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
138
|
+
"UnaryExpression:exit"?: ((node: import("estree").UnaryExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
139
|
+
UpdateExpression?: ((node: import("estree").UpdateExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
140
|
+
"UpdateExpression:exit"?: ((node: import("estree").UpdateExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
141
|
+
VariableDeclaration?: ((node: import("estree").VariableDeclaration & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
142
|
+
"VariableDeclaration:exit"?: ((node: import("estree").VariableDeclaration & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
143
|
+
VariableDeclarator?: ((node: import("estree").VariableDeclarator & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
144
|
+
"VariableDeclarator:exit"?: ((node: import("estree").VariableDeclarator & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
145
|
+
WhileStatement?: ((node: import("estree").WhileStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
146
|
+
"WhileStatement:exit"?: ((node: import("estree").WhileStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
147
|
+
WithStatement?: ((node: import("estree").WithStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
148
|
+
"WithStatement:exit"?: ((node: import("estree").WithStatement & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
149
|
+
YieldExpression?: ((node: import("estree").YieldExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
150
|
+
"YieldExpression:exit"?: ((node: import("estree").YieldExpression & import("eslint").Rule.NodeParentExtension) => void) | undefined;
|
|
151
|
+
};
|
|
152
|
+
meta: {
|
|
153
|
+
docs: {
|
|
154
|
+
description: string;
|
|
155
|
+
url: string;
|
|
156
|
+
};
|
|
157
|
+
fixable: "code";
|
|
158
|
+
messages: {
|
|
159
|
+
blockCommentsJsdocStyle: string;
|
|
160
|
+
lineCommentsJsdocStyle: string;
|
|
161
|
+
};
|
|
162
|
+
schema: {
|
|
163
|
+
additionalProperties: false;
|
|
164
|
+
properties: {
|
|
165
|
+
allowedPrefixes: {
|
|
166
|
+
items: {
|
|
167
|
+
type: "string";
|
|
168
|
+
};
|
|
169
|
+
type: "array";
|
|
170
|
+
};
|
|
171
|
+
contexts: {
|
|
172
|
+
items: {
|
|
173
|
+
anyOf: ({
|
|
174
|
+
type: "string";
|
|
175
|
+
additionalProperties?: undefined;
|
|
176
|
+
properties?: undefined;
|
|
177
|
+
} | {
|
|
178
|
+
additionalProperties: false;
|
|
179
|
+
properties: {
|
|
180
|
+
context: {
|
|
181
|
+
type: "string";
|
|
182
|
+
};
|
|
183
|
+
inlineCommentBlock: {
|
|
184
|
+
type: "boolean";
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
type: "object";
|
|
188
|
+
})[];
|
|
189
|
+
};
|
|
190
|
+
type: "array";
|
|
191
|
+
};
|
|
192
|
+
contextsAfter: {
|
|
193
|
+
items: {
|
|
194
|
+
anyOf: ({
|
|
195
|
+
type: "string";
|
|
196
|
+
additionalProperties?: undefined;
|
|
197
|
+
properties?: undefined;
|
|
198
|
+
} | {
|
|
199
|
+
additionalProperties: false;
|
|
200
|
+
properties: {
|
|
201
|
+
context: {
|
|
202
|
+
type: "string";
|
|
203
|
+
};
|
|
204
|
+
inlineCommentBlock: {
|
|
205
|
+
type: "boolean";
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
type: "object";
|
|
209
|
+
})[];
|
|
210
|
+
};
|
|
211
|
+
type: "array";
|
|
212
|
+
};
|
|
213
|
+
contextsBeforeAndAfter: {
|
|
214
|
+
items: {
|
|
215
|
+
anyOf: ({
|
|
216
|
+
type: "string";
|
|
217
|
+
additionalProperties?: undefined;
|
|
218
|
+
properties?: undefined;
|
|
219
|
+
} | {
|
|
220
|
+
additionalProperties: false;
|
|
221
|
+
properties: {
|
|
222
|
+
context: {
|
|
223
|
+
type: "string";
|
|
224
|
+
};
|
|
225
|
+
inlineCommentBlock: {
|
|
226
|
+
type: "boolean";
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
type: "object";
|
|
230
|
+
})[];
|
|
231
|
+
};
|
|
232
|
+
type: "array";
|
|
233
|
+
};
|
|
234
|
+
enableFixer: {
|
|
235
|
+
type: "boolean";
|
|
236
|
+
};
|
|
237
|
+
enforceJsdocLineStyle: {
|
|
238
|
+
enum: string[];
|
|
239
|
+
type: "string";
|
|
240
|
+
};
|
|
241
|
+
lineOrBlockStyle: {
|
|
242
|
+
enum: string[];
|
|
243
|
+
type: "string";
|
|
244
|
+
};
|
|
245
|
+
};
|
|
246
|
+
type: "object";
|
|
247
|
+
}[];
|
|
248
|
+
type: "suggestion";
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
export default _default;
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const iterateJsdoc_js_1 = require("../iterateJsdoc.js");
|
|
4
|
+
const jsdocUtils_js_1 = require("../jsdocUtils.js");
|
|
5
|
+
const jsdoccomment_1 = require("@es-joy/jsdoccomment");
|
|
6
|
+
/** @type {import('eslint').Rule.RuleModule} */
|
|
7
|
+
exports.default = {
|
|
8
|
+
create(context) {
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {import('eslint').AST.Token | import('estree').Comment | {
|
|
11
|
+
* type: import('eslint').AST.TokenType|"Line"|"Block"|"Shebang",
|
|
12
|
+
* range: [number, number],
|
|
13
|
+
* value: string
|
|
14
|
+
* }} Token
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* @callback AddComment
|
|
18
|
+
* @param {boolean|undefined} inlineCommentBlock
|
|
19
|
+
* @param {Token} comment
|
|
20
|
+
* @param {string} indent
|
|
21
|
+
* @param {number} lines
|
|
22
|
+
* @param {import('eslint').Rule.RuleFixer} fixer
|
|
23
|
+
*/
|
|
24
|
+
/* c8 ignore next -- Fallback to deprecated method */
|
|
25
|
+
const { sourceCode = context.getSourceCode(), } = context;
|
|
26
|
+
const settings = (0, iterateJsdoc_js_1.getSettings)(context);
|
|
27
|
+
if (!settings) {
|
|
28
|
+
return {};
|
|
29
|
+
}
|
|
30
|
+
const { allowedPrefixes = [
|
|
31
|
+
'@ts-', 'istanbul ', 'c8 ', 'v8 ', 'eslint', 'prettier-',
|
|
32
|
+
], contexts = settings.contexts || [], contextsAfter = /** @type {string[]} */ ([]), contextsBeforeAndAfter = [
|
|
33
|
+
'VariableDeclarator', 'TSPropertySignature', 'PropertyDefinition',
|
|
34
|
+
], enableFixer = true, enforceJsdocLineStyle = 'multi', lineOrBlockStyle = 'both', } = context.options[0] ?? {};
|
|
35
|
+
let reportingNonJsdoc = false;
|
|
36
|
+
/**
|
|
37
|
+
* @param {string} messageId
|
|
38
|
+
* @param {import('estree').Comment|Token} comment
|
|
39
|
+
* @param {import('eslint').Rule.Node} node
|
|
40
|
+
* @param {import('eslint').Rule.ReportFixer} fixer
|
|
41
|
+
*/
|
|
42
|
+
const report = (messageId, comment, node, fixer) => {
|
|
43
|
+
const loc = {
|
|
44
|
+
end: {
|
|
45
|
+
column: 0,
|
|
46
|
+
/* c8 ignore next 2 -- Guard */
|
|
47
|
+
// @ts-expect-error Ok
|
|
48
|
+
line: (comment.loc?.start?.line ?? 1),
|
|
49
|
+
},
|
|
50
|
+
start: {
|
|
51
|
+
column: 0,
|
|
52
|
+
/* c8 ignore next 2 -- Guard */
|
|
53
|
+
// @ts-expect-error Ok
|
|
54
|
+
line: (comment.loc?.start?.line ?? 1),
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
context.report({
|
|
58
|
+
fix: enableFixer ? fixer : null,
|
|
59
|
+
loc,
|
|
60
|
+
messageId,
|
|
61
|
+
node,
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* @param {import('eslint').Rule.Node} node
|
|
66
|
+
* @param {import('eslint').AST.Token | import('estree').Comment | {
|
|
67
|
+
* type: import('eslint').AST.TokenType|"Line"|"Block"|"Shebang",
|
|
68
|
+
* range: [number, number],
|
|
69
|
+
* value: string
|
|
70
|
+
* }} comment
|
|
71
|
+
* @param {AddComment} addComment
|
|
72
|
+
* @param {import('../iterateJsdoc.js').Context[]} ctxts
|
|
73
|
+
*/
|
|
74
|
+
const getFixer = (node, comment, addComment, ctxts) => {
|
|
75
|
+
return /** @type {import('eslint').Rule.ReportFixer} */ (fixer) => {
|
|
76
|
+
// Default to one line break if the `minLines`/`maxLines` settings allow
|
|
77
|
+
const lines = settings.minLines === 0 && settings.maxLines >= 1 ? 1 : settings.minLines;
|
|
78
|
+
let baseNode =
|
|
79
|
+
/**
|
|
80
|
+
* @type {import('@typescript-eslint/types').TSESTree.Node|import('eslint').Rule.Node}
|
|
81
|
+
*/ ((0, jsdoccomment_1.getReducedASTNode)(node, sourceCode));
|
|
82
|
+
const decorator = (0, jsdoccomment_1.getDecorator)(
|
|
83
|
+
/** @type {import('eslint').Rule.Node} */
|
|
84
|
+
(baseNode));
|
|
85
|
+
if (decorator) {
|
|
86
|
+
baseNode = /** @type {import('@typescript-eslint/types').TSESTree.Decorator} */ (decorator);
|
|
87
|
+
}
|
|
88
|
+
const indent = (0, jsdocUtils_js_1.getIndent)({
|
|
89
|
+
text: sourceCode.getText(
|
|
90
|
+
/** @type {import('eslint').Rule.Node} */ (baseNode),
|
|
91
|
+
/** @type {import('eslint').AST.SourceLocation} */
|
|
92
|
+
(
|
|
93
|
+
/** @type {import('eslint').Rule.Node} */ (baseNode).loc).start.column),
|
|
94
|
+
});
|
|
95
|
+
const { inlineCommentBlock, } =
|
|
96
|
+
/**
|
|
97
|
+
* @type {{
|
|
98
|
+
* context: string,
|
|
99
|
+
* inlineCommentBlock: boolean,
|
|
100
|
+
* minLineCount: import('../iterateJsdoc.js').Integer
|
|
101
|
+
* }[]}
|
|
102
|
+
*/ (ctxts).find((contxt) => {
|
|
103
|
+
if (typeof contxt === 'string') {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
const { context: ctxt, } = contxt;
|
|
107
|
+
return ctxt === node.type;
|
|
108
|
+
}) || {};
|
|
109
|
+
return addComment(inlineCommentBlock, comment, indent, lines, fixer);
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* @param {import('eslint').AST.Token | import('estree').Comment | {
|
|
114
|
+
* type: import('eslint').AST.TokenType|"Line"|"Block"|"Shebang",
|
|
115
|
+
* range: [number, number],
|
|
116
|
+
* value: string
|
|
117
|
+
* }} comment
|
|
118
|
+
* @param {import('eslint').Rule.Node} node
|
|
119
|
+
* @param {AddComment} addComment
|
|
120
|
+
* @param {import('../iterateJsdoc.js').Context[]} ctxts
|
|
121
|
+
*/
|
|
122
|
+
const reportings = (comment, node, addComment, ctxts) => {
|
|
123
|
+
const fixer = getFixer(node, comment, addComment, ctxts);
|
|
124
|
+
if (comment.type === 'Block') {
|
|
125
|
+
if (lineOrBlockStyle === 'line') {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
report('blockCommentsJsdocStyle', comment, node, fixer);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
if (comment.type === 'Line') {
|
|
132
|
+
if (lineOrBlockStyle === 'block') {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
report('lineCommentsJsdocStyle', comment, node, fixer);
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* @type {import('../iterateJsdoc.js').CheckJsdoc}
|
|
140
|
+
*/
|
|
141
|
+
const checkNonJsdoc = (_info, _handler, node) => {
|
|
142
|
+
const comment = (0, jsdoccomment_1.getNonJsdocComment)(sourceCode, node, settings);
|
|
143
|
+
if (!comment ||
|
|
144
|
+
/** @type {string[]} */
|
|
145
|
+
(allowedPrefixes).some((prefix) => {
|
|
146
|
+
return comment.value.trimStart().startsWith(prefix);
|
|
147
|
+
})) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
reportingNonJsdoc = true;
|
|
151
|
+
/** @type {AddComment} */
|
|
152
|
+
// eslint-disable-next-line unicorn/consistent-function-scoping -- Avoid conflicts
|
|
153
|
+
const addComment = (inlineCommentBlock, commentToAdd, indent, lines, fixer) => {
|
|
154
|
+
const insertion = (inlineCommentBlock || enforceJsdocLineStyle === 'single' ?
|
|
155
|
+
`/** ${commentToAdd.value.trim()} ` :
|
|
156
|
+
`/**\n${indent}*${commentToAdd.value.trimEnd()}\n${indent}`) +
|
|
157
|
+
`*/${'\n'.repeat((lines || 1) - 1)}`;
|
|
158
|
+
return fixer.replaceText(
|
|
159
|
+
/** @type {import('eslint').AST.Token} */
|
|
160
|
+
(commentToAdd), insertion);
|
|
161
|
+
};
|
|
162
|
+
reportings(comment, node, addComment, contexts);
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* @param {import('eslint').Rule.Node} node
|
|
166
|
+
* @param {import('../iterateJsdoc.js').Context[]} ctxts
|
|
167
|
+
*/
|
|
168
|
+
const checkNonJsdocAfter = (node, ctxts) => {
|
|
169
|
+
const comment = (0, jsdoccomment_1.getFollowingComment)(sourceCode, node);
|
|
170
|
+
if (!comment ||
|
|
171
|
+
comment.value.startsWith('*') ||
|
|
172
|
+
/** @type {string[]} */
|
|
173
|
+
(allowedPrefixes).some((prefix) => {
|
|
174
|
+
return comment.value.trimStart().startsWith(prefix);
|
|
175
|
+
})) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
/** @type {AddComment} */
|
|
179
|
+
const addComment = (inlineCommentBlock, commentToAdd, indent, lines, fixer) => {
|
|
180
|
+
const insertion = (inlineCommentBlock || enforceJsdocLineStyle === 'single' ?
|
|
181
|
+
`/** ${commentToAdd.value.trim()} ` :
|
|
182
|
+
`/**\n${indent}*${commentToAdd.value.trimEnd()}\n${indent}`) +
|
|
183
|
+
`*/${'\n'.repeat((lines || 1) - 1)}${lines ? `\n${indent.slice(1)}` : ' '}`;
|
|
184
|
+
return [
|
|
185
|
+
fixer.remove(
|
|
186
|
+
/** @type {import('eslint').AST.Token} */
|
|
187
|
+
(commentToAdd)), fixer.insertTextBefore(node.type === 'VariableDeclarator' ? node.parent : node, insertion),
|
|
188
|
+
];
|
|
189
|
+
};
|
|
190
|
+
reportings(comment, node, addComment, ctxts);
|
|
191
|
+
};
|
|
192
|
+
// Todo: add contexts to check after (and handle if want both before and after)
|
|
193
|
+
return {
|
|
194
|
+
...(0, jsdocUtils_js_1.getContextObject)((0, jsdocUtils_js_1.enforcedContexts)(context, true, settings), checkNonJsdoc),
|
|
195
|
+
...(0, jsdocUtils_js_1.getContextObject)(contextsAfter, (_info, _handler, node) => {
|
|
196
|
+
checkNonJsdocAfter(node, contextsAfter);
|
|
197
|
+
}),
|
|
198
|
+
...(0, jsdocUtils_js_1.getContextObject)(contextsBeforeAndAfter, (_info, _handler, node) => {
|
|
199
|
+
checkNonJsdoc({}, null, node);
|
|
200
|
+
if (!reportingNonJsdoc) {
|
|
201
|
+
checkNonJsdocAfter(node, contextsBeforeAndAfter);
|
|
202
|
+
}
|
|
203
|
+
}),
|
|
204
|
+
};
|
|
205
|
+
},
|
|
206
|
+
meta: {
|
|
207
|
+
docs: {
|
|
208
|
+
description: 'Converts non-JSDoc comments preceding or following nodes into JSDoc ones',
|
|
209
|
+
url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/convert-to-jsdoc-comments.md#repos-sticky-header',
|
|
210
|
+
},
|
|
211
|
+
fixable: 'code',
|
|
212
|
+
messages: {
|
|
213
|
+
blockCommentsJsdocStyle: 'Block comments should be JSDoc-style.',
|
|
214
|
+
lineCommentsJsdocStyle: 'Line comments should be JSDoc-style.',
|
|
215
|
+
},
|
|
216
|
+
schema: [
|
|
217
|
+
{
|
|
218
|
+
additionalProperties: false,
|
|
219
|
+
properties: {
|
|
220
|
+
allowedPrefixes: {
|
|
221
|
+
items: {
|
|
222
|
+
type: 'string',
|
|
223
|
+
},
|
|
224
|
+
type: 'array',
|
|
225
|
+
},
|
|
226
|
+
contexts: {
|
|
227
|
+
items: {
|
|
228
|
+
anyOf: [
|
|
229
|
+
{
|
|
230
|
+
type: 'string',
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
additionalProperties: false,
|
|
234
|
+
properties: {
|
|
235
|
+
context: {
|
|
236
|
+
type: 'string',
|
|
237
|
+
},
|
|
238
|
+
inlineCommentBlock: {
|
|
239
|
+
type: 'boolean',
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
type: 'object',
|
|
243
|
+
},
|
|
244
|
+
],
|
|
245
|
+
},
|
|
246
|
+
type: 'array',
|
|
247
|
+
},
|
|
248
|
+
contextsAfter: {
|
|
249
|
+
items: {
|
|
250
|
+
anyOf: [
|
|
251
|
+
{
|
|
252
|
+
type: 'string',
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
additionalProperties: false,
|
|
256
|
+
properties: {
|
|
257
|
+
context: {
|
|
258
|
+
type: 'string',
|
|
259
|
+
},
|
|
260
|
+
inlineCommentBlock: {
|
|
261
|
+
type: 'boolean',
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
type: 'object',
|
|
265
|
+
},
|
|
266
|
+
],
|
|
267
|
+
},
|
|
268
|
+
type: 'array',
|
|
269
|
+
},
|
|
270
|
+
contextsBeforeAndAfter: {
|
|
271
|
+
items: {
|
|
272
|
+
anyOf: [
|
|
273
|
+
{
|
|
274
|
+
type: 'string',
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
additionalProperties: false,
|
|
278
|
+
properties: {
|
|
279
|
+
context: {
|
|
280
|
+
type: 'string',
|
|
281
|
+
},
|
|
282
|
+
inlineCommentBlock: {
|
|
283
|
+
type: 'boolean',
|
|
284
|
+
},
|
|
285
|
+
},
|
|
286
|
+
type: 'object',
|
|
287
|
+
},
|
|
288
|
+
],
|
|
289
|
+
},
|
|
290
|
+
type: 'array',
|
|
291
|
+
},
|
|
292
|
+
enableFixer: {
|
|
293
|
+
type: 'boolean',
|
|
294
|
+
},
|
|
295
|
+
enforceJsdocLineStyle: {
|
|
296
|
+
enum: [
|
|
297
|
+
'multi', 'single',
|
|
298
|
+
],
|
|
299
|
+
type: 'string',
|
|
300
|
+
},
|
|
301
|
+
lineOrBlockStyle: {
|
|
302
|
+
enum: [
|
|
303
|
+
'block', 'line', 'both',
|
|
304
|
+
],
|
|
305
|
+
type: 'string',
|
|
306
|
+
},
|
|
307
|
+
},
|
|
308
|
+
type: 'object',
|
|
309
|
+
},
|
|
310
|
+
],
|
|
311
|
+
type: 'suggestion',
|
|
312
|
+
},
|
|
313
|
+
};
|