eslint-plugin-jsdoc 55.4.0 → 56.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/dist/cjs/WarnSettings.d.ts +16 -0
- package/dist/cjs/alignTransform.d.ts +33 -0
- package/dist/cjs/defaultTagOrder.d.ts +4 -0
- package/dist/cjs/exportParser.d.ts +40 -0
- package/dist/cjs/getDefaultTagStructureForMode.d.ts +10 -0
- package/dist/cjs/getJsdocProcessorPlugin.d.cts +1 -0
- package/dist/cjs/getJsdocProcessorPlugin.d.ts +66 -0
- package/dist/cjs/index-cjs.d.ts +16 -0
- package/dist/cjs/index.cjs.d.cts +2 -0
- package/dist/cjs/iterateJsdoc.d.cts +2 -0
- package/dist/cjs/iterateJsdoc.d.ts +462 -0
- package/dist/cjs/jsdocUtils.d.ts +454 -0
- package/dist/cjs/rules/checkAccess.d.ts +2 -0
- package/dist/cjs/rules/checkAlignment.d.ts +2 -0
- package/dist/cjs/rules/checkExamples.d.ts +3 -0
- package/dist/cjs/rules/checkIndentation.d.ts +2 -0
- package/dist/cjs/rules/checkLineAlignment.d.ts +9 -0
- package/dist/cjs/rules/checkParamNames.d.ts +2 -0
- package/dist/cjs/rules/checkPropertyNames.d.ts +2 -0
- package/dist/cjs/rules/checkSyntax.d.ts +2 -0
- package/dist/cjs/rules/checkTagNames.d.ts +2 -0
- package/dist/cjs/rules/checkTemplateNames.d.ts +2 -0
- package/dist/cjs/rules/checkTypes.d.ts +2 -0
- package/dist/cjs/rules/checkValues.d.ts +2 -0
- package/dist/cjs/rules/convertToJsdocComments.d.ts +251 -0
- package/dist/cjs/rules/emptyTags.d.ts +2 -0
- package/dist/cjs/rules/implementsOnClasses.d.ts +2 -0
- package/dist/cjs/rules/importsAsDependencies.d.ts +2 -0
- package/dist/cjs/rules/informativeDocs.d.ts +2 -0
- package/dist/cjs/rules/linesBeforeBlock.d.ts +2 -0
- package/dist/cjs/rules/matchDescription.d.ts +2 -0
- package/dist/cjs/rules/matchName.d.ts +2 -0
- package/dist/cjs/rules/multilineBlocks.d.ts +2 -0
- package/dist/cjs/rules/noBadBlocks.d.ts +2 -0
- package/dist/cjs/rules/noBlankBlockDescriptions.d.ts +2 -0
- package/dist/cjs/rules/noBlankBlocks.d.ts +2 -0
- package/dist/cjs/rules/noDefaults.d.ts +2 -0
- package/dist/cjs/rules/noMissingSyntax.d.ts +9 -0
- package/dist/cjs/rules/noMultiAsterisks.d.ts +2 -0
- package/dist/cjs/rules/noRestrictedSyntax.d.ts +2 -0
- package/dist/cjs/rules/noTypes.d.ts +2 -0
- package/dist/cjs/rules/noUndefinedTypes.d.ts +2 -0
- package/dist/cjs/rules/requireAsteriskPrefix.d.ts +2 -0
- package/dist/cjs/rules/requireDescription.d.ts +2 -0
- package/dist/cjs/rules/requireDescriptionCompleteSentence.d.ts +2 -0
- package/dist/cjs/rules/requireExample.d.ts +2 -0
- package/dist/cjs/rules/requireFileOverview.d.ts +2 -0
- package/dist/cjs/rules/requireHyphenBeforeParamDescription.d.ts +2 -0
- package/dist/cjs/rules/requireJsdoc.d.ts +25 -0
- package/dist/cjs/rules/requireParam.d.ts +3 -0
- package/dist/cjs/rules/requireParamDescription.d.ts +2 -0
- package/dist/cjs/rules/requireParamName.d.ts +2 -0
- package/dist/cjs/rules/requireParamType.d.ts +2 -0
- package/dist/cjs/rules/requireProperty.d.ts +2 -0
- package/dist/cjs/rules/requirePropertyDescription.d.ts +2 -0
- package/dist/cjs/rules/requirePropertyName.d.ts +2 -0
- package/dist/cjs/rules/requirePropertyType.d.ts +2 -0
- package/dist/cjs/rules/requireReturns.d.ts +2 -0
- package/dist/cjs/rules/requireReturnsCheck.d.ts +2 -0
- package/dist/cjs/rules/requireReturnsDescription.d.ts +2 -0
- package/dist/cjs/rules/requireReturnsType.d.ts +2 -0
- package/dist/cjs/rules/requireTemplate.d.ts +2 -0
- package/dist/cjs/rules/requireThrows.d.ts +2 -0
- package/dist/cjs/rules/requireYields.d.ts +2 -0
- package/dist/cjs/rules/requireYieldsCheck.d.ts +2 -0
- package/dist/cjs/rules/sortTags.d.ts +2 -0
- package/dist/cjs/rules/tagLines.d.ts +2 -0
- package/dist/cjs/rules/textEscaping.d.ts +2 -0
- package/dist/cjs/rules/typeFormatting.d.ts +2 -0
- package/dist/cjs/rules/validTypes.d.ts +2 -0
- package/dist/cjs/tagNames.d.ts +15 -0
- package/dist/cjs/utils/hasReturnValue.d.ts +19 -0
- package/dist/getJsdocProcessorPlugin.cts +3 -0
- package/dist/index.cjs.cts +3 -0
- package/dist/iterateJsdoc.cts +6 -0
- package/package.json +20 -9
- package/src/getJsdocProcessorPlugin.cts +3 -0
- package/src/index.cjs.cts +3 -0
- package/src/iterateJsdoc.cts +6 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default WarnSettings;
|
|
2
|
+
declare function WarnSettings(): {
|
|
3
|
+
/**
|
|
4
|
+
* Warn only once for each context and setting
|
|
5
|
+
* @param {{}} context
|
|
6
|
+
* @param {string} setting
|
|
7
|
+
* @returns {boolean}
|
|
8
|
+
*/
|
|
9
|
+
hasBeenWarned(context: {}, setting: string): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* @param {{}} context
|
|
12
|
+
* @param {string} setting
|
|
13
|
+
* @returns {void}
|
|
14
|
+
*/
|
|
15
|
+
markSettingAsWarned(context: {}, setting: string): void;
|
|
16
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export default alignTransform;
|
|
2
|
+
export type TypelessInfo = {
|
|
3
|
+
hasNoTypes: boolean;
|
|
4
|
+
maxNamedTagLength: import("./iterateJsdoc.js").Integer;
|
|
5
|
+
maxUnnamedTagLength: import("./iterateJsdoc.js").Integer;
|
|
6
|
+
};
|
|
7
|
+
export type Width = {
|
|
8
|
+
name: import("./iterateJsdoc.js").Integer;
|
|
9
|
+
start: import("./iterateJsdoc.js").Integer;
|
|
10
|
+
tag: import("./iterateJsdoc.js").Integer;
|
|
11
|
+
type: import("./iterateJsdoc.js").Integer;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* @param {{
|
|
15
|
+
* customSpacings: import('../src/rules/checkLineAlignment.js').CustomSpacings,
|
|
16
|
+
* tags: string[],
|
|
17
|
+
* indent: string,
|
|
18
|
+
* preserveMainDescriptionPostDelimiter: boolean,
|
|
19
|
+
* wrapIndent: string,
|
|
20
|
+
* disableWrapIndent: boolean,
|
|
21
|
+
* }} cfg
|
|
22
|
+
* @returns {(
|
|
23
|
+
* block: import('comment-parser').Block
|
|
24
|
+
* ) => import('comment-parser').Block}
|
|
25
|
+
*/
|
|
26
|
+
declare function alignTransform({ customSpacings, disableWrapIndent, indent, preserveMainDescriptionPostDelimiter, tags, wrapIndent, }: {
|
|
27
|
+
customSpacings: import("../src/rules/checkLineAlignment.js").CustomSpacings;
|
|
28
|
+
tags: string[];
|
|
29
|
+
indent: string;
|
|
30
|
+
preserveMainDescriptionPostDelimiter: boolean;
|
|
31
|
+
wrapIndent: string;
|
|
32
|
+
disableWrapIndent: boolean;
|
|
33
|
+
}): (block: import("comment-parser").Block) => import("comment-parser").Block;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
export { isUncommentedExport };
|
|
3
|
+
export { parse };
|
|
4
|
+
}
|
|
5
|
+
export default _default;
|
|
6
|
+
export type ValueObject = {
|
|
7
|
+
value: string;
|
|
8
|
+
};
|
|
9
|
+
export type CreatedNode = {
|
|
10
|
+
type?: string;
|
|
11
|
+
value?: ValueObject | import("eslint").Rule.Node | import("@typescript-eslint/types").TSESTree.Node;
|
|
12
|
+
props: {
|
|
13
|
+
[key: string]: CreatedNode | null;
|
|
14
|
+
};
|
|
15
|
+
special?: true;
|
|
16
|
+
globalVars?: CreatedNode;
|
|
17
|
+
exported?: boolean;
|
|
18
|
+
ANONYMOUS_DEFAULT?: import("eslint").Rule.Node;
|
|
19
|
+
};
|
|
20
|
+
export type CreateSymbol = (node: import("eslint").Rule.Node | null, globals: CreatedNode, value: import("eslint").Rule.Node | import("@typescript-eslint/types").TSESTree.Node | null, scope?: CreatedNode | undefined, isGlobal?: boolean | SymbolOptions | undefined) => CreatedNode | null;
|
|
21
|
+
export type SymbolOptions = {
|
|
22
|
+
simpleIdentifier?: boolean;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @param {import('eslint').Rule.Node} node
|
|
27
|
+
* @param {import('eslint').SourceCode} sourceCode
|
|
28
|
+
* @param {import('./rules/requireJsdoc.js').RequireJsdocOpts} opt
|
|
29
|
+
* @param {import('./iterateJsdoc.js').Settings} settings
|
|
30
|
+
* @returns {boolean}
|
|
31
|
+
*/
|
|
32
|
+
declare function isUncommentedExport(node: import("eslint").Rule.Node, sourceCode: import("eslint").SourceCode, opt: import("./rules/requireJsdoc.js").RequireJsdocOpts, settings: import("./iterateJsdoc.js").Settings): boolean;
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* @param {import('eslint').Rule.Node} ast
|
|
36
|
+
* @param {import('eslint').Rule.Node} node
|
|
37
|
+
* @param {import('./rules/requireJsdoc.js').RequireJsdocOpts} opt
|
|
38
|
+
* @returns {CreatedNode}
|
|
39
|
+
*/
|
|
40
|
+
declare function parse(ast: import("eslint").Rule.Node, node: import("eslint").Rule.Node, opt: import("./rules/requireJsdoc.js").RequireJsdocOpts): CreatedNode;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default getDefaultTagStructureForMode;
|
|
2
|
+
export type TagStructure = Map<string, Map<string, (string | boolean)>>;
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {Map<string, Map<string, (string|boolean)>>} TagStructure
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @param {import('./jsdocUtils.js').ParserMode} mode
|
|
8
|
+
* @returns {TagStructure}
|
|
9
|
+
*/
|
|
10
|
+
declare function getDefaultTagStructureForMode(mode: import("./jsdocUtils.js").ParserMode): TagStructure;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export function getJsdocProcessorPlugin(options?: JsdocProcessorOptions): ESLint.Plugin;
|
|
2
|
+
export type Integer = number;
|
|
3
|
+
export type JsdocProcessorOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* Require captions for example tags
|
|
6
|
+
*/
|
|
7
|
+
captionRequired?: boolean | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* See docs
|
|
10
|
+
*/
|
|
11
|
+
paddedIndent?: number | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* See docs
|
|
14
|
+
*/
|
|
15
|
+
checkDefaults?: boolean | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* See docs
|
|
18
|
+
*/
|
|
19
|
+
checkParams?: boolean | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* See docs
|
|
22
|
+
*/
|
|
23
|
+
checkExamples?: boolean | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* See docs
|
|
26
|
+
*/
|
|
27
|
+
checkProperties?: boolean | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* See docs
|
|
30
|
+
*/
|
|
31
|
+
matchingFileName?: string | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* See docs
|
|
34
|
+
*/
|
|
35
|
+
matchingFileNameDefaults?: string | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* See docs
|
|
38
|
+
*/
|
|
39
|
+
matchingFileNameParams?: string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* See docs
|
|
42
|
+
*/
|
|
43
|
+
matchingFileNameProperties?: string | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* See docs
|
|
46
|
+
*/
|
|
47
|
+
exampleCodeRegex?: string | RegExp | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* See docs
|
|
50
|
+
*/
|
|
51
|
+
rejectExampleCodeRegex?: string | RegExp | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* See docs
|
|
54
|
+
*/
|
|
55
|
+
allowedLanguagesToProcess?: string[] | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* See docs
|
|
58
|
+
*/
|
|
59
|
+
sourceType?: "module" | "script" | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* See docs
|
|
62
|
+
*/
|
|
63
|
+
parser?: Linter.ESTreeParser | Linter.NonESTreeParser | undefined;
|
|
64
|
+
};
|
|
65
|
+
import type { ESLint } from 'eslint';
|
|
66
|
+
import type { Linter } from 'eslint';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default index;
|
|
2
|
+
export type ConfigGroups = "recommended" | "stylistic" | "contents" | "logical" | "requirements";
|
|
3
|
+
export type ConfigVariants = "" | "-typescript" | "-typescript-flavor";
|
|
4
|
+
export type ErrorLevelVariants = "" | "-error";
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {"recommended" | "stylistic" | "contents" | "logical" | "requirements"} ConfigGroups
|
|
7
|
+
* @typedef {"" | "-typescript" | "-typescript-flavor"} ConfigVariants
|
|
8
|
+
* @typedef {"" | "-error"} ErrorLevelVariants
|
|
9
|
+
* @type {import('eslint').ESLint.Plugin & {
|
|
10
|
+
* configs: Record<`flat/${ConfigGroups}${ConfigVariants}${ErrorLevelVariants}`,
|
|
11
|
+
* import('eslint').Linter.Config>
|
|
12
|
+
* }}
|
|
13
|
+
*/
|
|
14
|
+
declare const index: import("eslint").ESLint.Plugin & {
|
|
15
|
+
configs: Record<`flat/${ConfigGroups}${ConfigVariants}${ErrorLevelVariants}`, import("eslint").Linter.Config>;
|
|
16
|
+
};
|
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {JsdocVisitor} iterator
|
|
3
|
+
* @param {RuleConfig} ruleConfig
|
|
4
|
+
* @returns {import('eslint').Rule.RuleModule}
|
|
5
|
+
*/
|
|
6
|
+
export default function iterateJsdoc(iterator: JsdocVisitor, ruleConfig: RuleConfig): import("eslint").Rule.RuleModule;
|
|
7
|
+
export { parseComment } from "@es-joy/jsdoccomment";
|
|
8
|
+
export type Integer = number;
|
|
9
|
+
export type JsdocBlockWithInline = import("@es-joy/jsdoccomment").JsdocBlockWithInline;
|
|
10
|
+
export type ContextObject = {
|
|
11
|
+
disallowName?: string;
|
|
12
|
+
allowName?: string;
|
|
13
|
+
context?: string;
|
|
14
|
+
comment?: string;
|
|
15
|
+
tags?: string[];
|
|
16
|
+
replacement?: string;
|
|
17
|
+
minimum?: Integer;
|
|
18
|
+
message?: string;
|
|
19
|
+
forceRequireReturn?: boolean;
|
|
20
|
+
};
|
|
21
|
+
export type Context = string | ContextObject;
|
|
22
|
+
export type CheckJsdoc = (info: {
|
|
23
|
+
lastIndex?: Integer;
|
|
24
|
+
isFunctionContext?: boolean;
|
|
25
|
+
selector?: string;
|
|
26
|
+
comment?: string;
|
|
27
|
+
}, handler: null | ((jsdoc: import("@es-joy/jsdoccomment").JsdocBlockWithInline) => boolean | undefined), node: import("eslint").Rule.Node) => void;
|
|
28
|
+
export type ForEachPreferredTag = (tagName: string, arrayHandler: (matchingJsdocTag: import("@es-joy/jsdoccomment").JsdocTagWithInline, targetTagName: string) => void, skipReportingBlockedTag?: boolean | undefined) => void;
|
|
29
|
+
export type ReportSettings = (message: string) => void;
|
|
30
|
+
export type ParseClosureTemplateTag = (tag: import("comment-parser").Spec) => string[];
|
|
31
|
+
export type GetPreferredTagNameObject = (cfg: {
|
|
32
|
+
tagName: string;
|
|
33
|
+
}) => string | false | {
|
|
34
|
+
message: string;
|
|
35
|
+
replacement?: string | undefined;
|
|
36
|
+
} | {
|
|
37
|
+
blocked: true;
|
|
38
|
+
tagName: string;
|
|
39
|
+
};
|
|
40
|
+
export type BasicUtils = {
|
|
41
|
+
forEachPreferredTag: ForEachPreferredTag;
|
|
42
|
+
reportSettings: ReportSettings;
|
|
43
|
+
parseClosureTemplateTag: ParseClosureTemplateTag;
|
|
44
|
+
getPreferredTagNameObject: GetPreferredTagNameObject;
|
|
45
|
+
pathDoesNotBeginWith: import("./jsdocUtils.js").PathDoesNotBeginWith;
|
|
46
|
+
};
|
|
47
|
+
export type IsIteratingFunction = () => boolean;
|
|
48
|
+
export type IsVirtualFunction = () => boolean;
|
|
49
|
+
export type Stringify = (tagBlock: import("comment-parser").Block, specRewire?: boolean | undefined) => string;
|
|
50
|
+
export type ReportJSDoc = (msg: string, tag?: import("comment-parser").Spec | {
|
|
51
|
+
line: Integer;
|
|
52
|
+
column?: Integer;
|
|
53
|
+
} | null | undefined, handler?: (() => void) | null | undefined, specRewire?: boolean | undefined, data?: undefined | {
|
|
54
|
+
[key: string]: string;
|
|
55
|
+
}) => any;
|
|
56
|
+
export type GetRegexFromString = (str: string, requiredFlags?: string | undefined) => RegExp;
|
|
57
|
+
export type GetTagDescription = (tg: import("comment-parser").Spec, returnArray?: boolean | undefined) => string[] | string;
|
|
58
|
+
export type SetTagDescription = (tg: import("comment-parser").Spec, matcher: RegExp, setter: (description: string) => string) => Integer;
|
|
59
|
+
export type GetDescription = () => {
|
|
60
|
+
description: string;
|
|
61
|
+
descriptions: string[];
|
|
62
|
+
lastDescriptionLine: Integer;
|
|
63
|
+
};
|
|
64
|
+
export type SetBlockDescription = (setter: (info: {
|
|
65
|
+
delimiter: string;
|
|
66
|
+
postDelimiter: string;
|
|
67
|
+
start: string;
|
|
68
|
+
}, seedTokens: (tokens?: Partial<import("comment-parser").Tokens>) => import("comment-parser").Tokens, descLines: string[]) => import("comment-parser").Line[]) => void;
|
|
69
|
+
export type SetDescriptionLines = (matcher: RegExp, setter: (description: string) => string) => Integer;
|
|
70
|
+
export type ChangeTag = (tag: import("comment-parser").Spec, ...tokens: Partial<import("comment-parser").Tokens>[]) => void;
|
|
71
|
+
export type SetTag = (tag: import("comment-parser").Spec & {
|
|
72
|
+
line: Integer;
|
|
73
|
+
}, tokens?: Partial<import("comment-parser").Tokens> | undefined) => void;
|
|
74
|
+
export type RemoveTag = (tagIndex: Integer, cfg?: {
|
|
75
|
+
removeEmptyBlock?: boolean;
|
|
76
|
+
tagSourceOffset?: Integer;
|
|
77
|
+
} | undefined) => void;
|
|
78
|
+
export type AddTag = (targetTagName: string, number?: number | undefined, tokens?: {} | import("comment-parser").Tokens | undefined) => void;
|
|
79
|
+
export type GetFirstLine = () => Integer | undefined;
|
|
80
|
+
export type SeedTokens = (tokens?: Partial<import("comment-parser").Tokens> | undefined) => import("comment-parser").Tokens;
|
|
81
|
+
/**
|
|
82
|
+
* Sets tokens to empty string.
|
|
83
|
+
*/
|
|
84
|
+
export type EmptyTokens = (tokens: import("comment-parser").Tokens) => void;
|
|
85
|
+
export type AddLine = (sourceIndex: Integer, tokens: Partial<import("comment-parser").Tokens>) => void;
|
|
86
|
+
export type AddLines = (tagIndex: Integer, tagSourceOffset: Integer, numLines: Integer) => void;
|
|
87
|
+
export type MakeMultiline = () => void;
|
|
88
|
+
export type GetFunctionParameterNames = (useDefaultObjectProperties?: boolean | undefined) => import("./jsdocUtils.js").ParamNameInfo[];
|
|
89
|
+
export type HasParams = () => Integer;
|
|
90
|
+
export type IsGenerator = () => boolean;
|
|
91
|
+
export type IsConstructor = () => boolean;
|
|
92
|
+
export type GetJsdocTagsDeep = (tagName: string) => false | {
|
|
93
|
+
idx: Integer;
|
|
94
|
+
name: string;
|
|
95
|
+
type: string;
|
|
96
|
+
}[];
|
|
97
|
+
export type GetPreferredTagName = (cfg: {
|
|
98
|
+
tagName: string;
|
|
99
|
+
skipReportingBlockedTag?: boolean;
|
|
100
|
+
allowObjectReturn?: boolean;
|
|
101
|
+
defaultMessage?: string;
|
|
102
|
+
}) => string | undefined | false | {
|
|
103
|
+
message: string;
|
|
104
|
+
replacement?: string | undefined;
|
|
105
|
+
} | {
|
|
106
|
+
blocked: true;
|
|
107
|
+
tagName: string;
|
|
108
|
+
};
|
|
109
|
+
export type IsValidTag = (name: string, definedTags: string[]) => boolean;
|
|
110
|
+
export type HasATag = (names: string[]) => boolean;
|
|
111
|
+
export type HasTag = (name: string) => boolean;
|
|
112
|
+
export type ComparePaths = (name: string) => (otherPathName: string) => boolean;
|
|
113
|
+
export type DropPathSegmentQuotes = (name: string) => string;
|
|
114
|
+
export type AvoidDocs = () => boolean;
|
|
115
|
+
export type TagMightHaveNamePositionTypePosition = (tagName: string, otherModeMaps?: import("./getDefaultTagStructureForMode.js").TagStructure[] | undefined) => boolean | {
|
|
116
|
+
otherMode: true;
|
|
117
|
+
};
|
|
118
|
+
export type TagMustHave = (tagName: string, otherModeMaps: import("./getDefaultTagStructureForMode.js").TagStructure[]) => boolean | {
|
|
119
|
+
otherMode: false;
|
|
120
|
+
};
|
|
121
|
+
export type TagMissingRequiredTypeOrNamepath = (tag: import("comment-parser").Spec, otherModeMaps: import("./getDefaultTagStructureForMode.js").TagStructure[]) => boolean | {
|
|
122
|
+
otherMode: false;
|
|
123
|
+
};
|
|
124
|
+
export type IsNamepathX = (tagName: string) => boolean;
|
|
125
|
+
export type GetTagStructureForMode = (mde: import("./jsdocUtils.js").ParserMode) => import("./getDefaultTagStructureForMode.js").TagStructure;
|
|
126
|
+
export type MayBeUndefinedTypeTag = (tag: import("comment-parser").Spec) => boolean;
|
|
127
|
+
export type HasValueOrExecutorHasNonEmptyResolveValue = (anyPromiseAsReturn: boolean, allBranches?: boolean | undefined) => boolean;
|
|
128
|
+
export type HasYieldValue = () => boolean;
|
|
129
|
+
export type HasYieldReturnValue = () => boolean;
|
|
130
|
+
export type HasThrowValue = () => boolean;
|
|
131
|
+
export type IsAsync = () => boolean | undefined;
|
|
132
|
+
export type GetTags = (tagName: string) => import("comment-parser").Spec[];
|
|
133
|
+
export type GetPresentTags = (tagList: string[]) => import("@es-joy/jsdoccomment").JsdocTagWithInline[];
|
|
134
|
+
export type FilterTags = (filter: (tag: import("@es-joy/jsdoccomment").JsdocTagWithInline) => boolean) => import("@es-joy/jsdoccomment").JsdocTagWithInline[];
|
|
135
|
+
export type FilterAllTags = (filter: (tag: (import("comment-parser").Spec | import("@es-joy/jsdoccomment").JsdocInlineTagNoType)) => boolean) => (import("comment-parser").Spec | import("@es-joy/jsdoccomment").JsdocInlineTagNoType)[];
|
|
136
|
+
export type GetTagsByType = (tags: import("comment-parser").Spec[]) => {
|
|
137
|
+
tagsWithNames: import("comment-parser").Spec[];
|
|
138
|
+
tagsWithoutNames: import("comment-parser").Spec[];
|
|
139
|
+
};
|
|
140
|
+
export type HasOptionTag = (tagName: string) => boolean;
|
|
141
|
+
export type GetClassNode = () => Node | null;
|
|
142
|
+
export type GetClassJsdoc = () => null | JsdocBlockWithInline;
|
|
143
|
+
export type ClassHasTag = (tagName: string) => boolean;
|
|
144
|
+
export type FindContext = (contexts: Context[], comment: string | undefined) => {
|
|
145
|
+
foundContext: Context | undefined;
|
|
146
|
+
contextStr: string;
|
|
147
|
+
};
|
|
148
|
+
export type Utils = BasicUtils & {
|
|
149
|
+
isIteratingFunction: IsIteratingFunction;
|
|
150
|
+
isIteratingFunctionOrVariable: IsIteratingFunction;
|
|
151
|
+
isVirtualFunction: IsVirtualFunction;
|
|
152
|
+
stringify: Stringify;
|
|
153
|
+
reportJSDoc: ReportJSDoc;
|
|
154
|
+
getRegexFromString: GetRegexFromString;
|
|
155
|
+
getTagDescription: GetTagDescription;
|
|
156
|
+
setTagDescription: SetTagDescription;
|
|
157
|
+
getDescription: GetDescription;
|
|
158
|
+
setBlockDescription: SetBlockDescription;
|
|
159
|
+
setDescriptionLines: SetDescriptionLines;
|
|
160
|
+
changeTag: ChangeTag;
|
|
161
|
+
setTag: SetTag;
|
|
162
|
+
removeTag: RemoveTag;
|
|
163
|
+
addTag: AddTag;
|
|
164
|
+
getFirstLine: GetFirstLine;
|
|
165
|
+
seedTokens: SeedTokens;
|
|
166
|
+
emptyTokens: EmptyTokens;
|
|
167
|
+
addLine: AddLine;
|
|
168
|
+
addLines: AddLines;
|
|
169
|
+
makeMultiline: MakeMultiline;
|
|
170
|
+
flattenRoots: import("./jsdocUtils.js").FlattenRoots;
|
|
171
|
+
getFunctionParameterNames: GetFunctionParameterNames;
|
|
172
|
+
hasParams: HasParams;
|
|
173
|
+
isGenerator: IsGenerator;
|
|
174
|
+
isConstructor: IsConstructor;
|
|
175
|
+
getJsdocTagsDeep: GetJsdocTagsDeep;
|
|
176
|
+
getPreferredTagName: GetPreferredTagName;
|
|
177
|
+
isValidTag: IsValidTag;
|
|
178
|
+
hasATag: HasATag;
|
|
179
|
+
hasTag: HasTag;
|
|
180
|
+
comparePaths: ComparePaths;
|
|
181
|
+
dropPathSegmentQuotes: DropPathSegmentQuotes;
|
|
182
|
+
avoidDocs: AvoidDocs;
|
|
183
|
+
tagMightHaveNamePosition: TagMightHaveNamePositionTypePosition;
|
|
184
|
+
tagMightHaveTypePosition: TagMightHaveNamePositionTypePosition;
|
|
185
|
+
tagMustHaveNamePosition: TagMustHave;
|
|
186
|
+
tagMustHaveTypePosition: TagMustHave;
|
|
187
|
+
tagMissingRequiredTypeOrNamepath: TagMissingRequiredTypeOrNamepath;
|
|
188
|
+
isNamepathDefiningTag: IsNamepathX;
|
|
189
|
+
isNamepathReferencingTag: IsNamepathX;
|
|
190
|
+
isNamepathOrUrlReferencingTag: IsNamepathX;
|
|
191
|
+
tagMightHaveNamepath: IsNamepathX;
|
|
192
|
+
getTagStructureForMode: GetTagStructureForMode;
|
|
193
|
+
mayBeUndefinedTypeTag: MayBeUndefinedTypeTag;
|
|
194
|
+
hasValueOrExecutorHasNonEmptyResolveValue: HasValueOrExecutorHasNonEmptyResolveValue;
|
|
195
|
+
hasYieldValue: HasYieldValue;
|
|
196
|
+
hasYieldReturnValue: HasYieldReturnValue;
|
|
197
|
+
hasThrowValue: HasThrowValue;
|
|
198
|
+
isAsync: IsAsync;
|
|
199
|
+
getTags: GetTags;
|
|
200
|
+
getPresentTags: GetPresentTags;
|
|
201
|
+
filterTags: FilterTags;
|
|
202
|
+
filterAllTags: FilterAllTags;
|
|
203
|
+
getTagsByType: GetTagsByType;
|
|
204
|
+
hasOptionTag: HasOptionTag;
|
|
205
|
+
getClassNode: GetClassNode;
|
|
206
|
+
getClassJsdoc: GetClassJsdoc;
|
|
207
|
+
classHasTag: ClassHasTag;
|
|
208
|
+
findContext: FindContext;
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
* Should use ESLint rule's typing.
|
|
212
|
+
*/
|
|
213
|
+
export type EslintRuleMeta = import("eslint").Rule.RuleMetaData;
|
|
214
|
+
/**
|
|
215
|
+
* A plain object for tracking state as needed by rules across iterations.
|
|
216
|
+
*/
|
|
217
|
+
export type StateObject = {
|
|
218
|
+
globalTags: {};
|
|
219
|
+
hasDuplicates: {
|
|
220
|
+
[key: string]: boolean;
|
|
221
|
+
};
|
|
222
|
+
selectorMap: {
|
|
223
|
+
[selector: string]: {
|
|
224
|
+
[comment: string]: Integer;
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
hasTag: {
|
|
228
|
+
[key: string]: boolean;
|
|
229
|
+
};
|
|
230
|
+
hasNonComment: number;
|
|
231
|
+
hasNonCommentBeforeTag: {
|
|
232
|
+
[key: string]: boolean | number;
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* The Node AST as supplied by the parser.
|
|
237
|
+
*/
|
|
238
|
+
export type Node = import("eslint").Rule.Node;
|
|
239
|
+
export type Report = (message: string, fix?: import("eslint").Rule.ReportFixer | null | undefined, jsdocLoc?: {
|
|
240
|
+
line?: Integer;
|
|
241
|
+
column?: Integer;
|
|
242
|
+
} | (import("comment-parser").Spec & {
|
|
243
|
+
line?: Integer;
|
|
244
|
+
}) | null | undefined, data?: undefined | {
|
|
245
|
+
[key: string]: string;
|
|
246
|
+
}) => void;
|
|
247
|
+
export type PreferredTypes = {
|
|
248
|
+
[key: string]: false | string | {
|
|
249
|
+
message: string;
|
|
250
|
+
replacement?: false | string;
|
|
251
|
+
skipRootChecking?: boolean;
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
export type StructuredTags = {
|
|
255
|
+
[key: string]: {
|
|
256
|
+
name?: "text" | "namepath-defining" | "namepath-referencing" | false;
|
|
257
|
+
type?: boolean | string[];
|
|
258
|
+
required?: ("name" | "type" | "typeOrNameRequired")[];
|
|
259
|
+
};
|
|
260
|
+
};
|
|
261
|
+
/**
|
|
262
|
+
* Settings from ESLint types.
|
|
263
|
+
*/
|
|
264
|
+
export type Settings = {
|
|
265
|
+
maxLines: Integer;
|
|
266
|
+
minLines: Integer;
|
|
267
|
+
tagNamePreference: import("./jsdocUtils.js").TagNamePreference;
|
|
268
|
+
mode: import("./jsdocUtils.js").ParserMode;
|
|
269
|
+
preferredTypes: PreferredTypes;
|
|
270
|
+
structuredTags: StructuredTags;
|
|
271
|
+
[name: string]: any;
|
|
272
|
+
contexts?: Context[];
|
|
273
|
+
};
|
|
274
|
+
export type JSDocSettings = {
|
|
275
|
+
settings?: {
|
|
276
|
+
jsdoc?: {
|
|
277
|
+
ignorePrivate: boolean;
|
|
278
|
+
ignoreInternal: boolean;
|
|
279
|
+
maxLines: Integer;
|
|
280
|
+
minLines: Integer;
|
|
281
|
+
tagNamePreference: import("./jsdocUtils.js").TagNamePreference;
|
|
282
|
+
preferredTypes: PreferredTypes;
|
|
283
|
+
structuredTags: StructuredTags;
|
|
284
|
+
overrideReplacesDocs: boolean;
|
|
285
|
+
ignoreReplacesDocs: boolean;
|
|
286
|
+
implementsReplacesDocs: boolean;
|
|
287
|
+
augmentsExtendsReplacesDocs: boolean;
|
|
288
|
+
exemptDestructuredRootsFromChecks: boolean;
|
|
289
|
+
mode: import("./jsdocUtils.js").ParserMode;
|
|
290
|
+
contexts: Context[];
|
|
291
|
+
};
|
|
292
|
+
};
|
|
293
|
+
};
|
|
294
|
+
/**
|
|
295
|
+
* Create the report function
|
|
296
|
+
*/
|
|
297
|
+
export type MakeReport = (context: import("eslint").Rule.RuleContext, commentNode: import("estree").Node) => Report;
|
|
298
|
+
export type JsdocVisitorBasic = (arg: {
|
|
299
|
+
context: import("eslint").Rule.RuleContext;
|
|
300
|
+
sourceCode: import("eslint").SourceCode;
|
|
301
|
+
indent?: string;
|
|
302
|
+
info?: {
|
|
303
|
+
comment?: string | undefined;
|
|
304
|
+
lastIndex?: Integer | undefined;
|
|
305
|
+
};
|
|
306
|
+
state?: StateObject;
|
|
307
|
+
globalState?: Map<string, Map<string, string>>;
|
|
308
|
+
jsdoc?: JsdocBlockWithInline;
|
|
309
|
+
jsdocNode?: import("eslint").Rule.Node & {
|
|
310
|
+
range: [number, number];
|
|
311
|
+
};
|
|
312
|
+
node?: Node;
|
|
313
|
+
allComments?: import("estree").Node[];
|
|
314
|
+
report?: Report;
|
|
315
|
+
makeReport?: MakeReport;
|
|
316
|
+
settings: Settings;
|
|
317
|
+
utils: BasicUtils;
|
|
318
|
+
}) => any;
|
|
319
|
+
export type JsdocVisitor = (arg: {
|
|
320
|
+
context: import("eslint").Rule.RuleContext;
|
|
321
|
+
sourceCode: import("eslint").SourceCode;
|
|
322
|
+
indent: string;
|
|
323
|
+
info: {
|
|
324
|
+
comment?: string | undefined;
|
|
325
|
+
lastIndex?: Integer | undefined;
|
|
326
|
+
};
|
|
327
|
+
state: StateObject;
|
|
328
|
+
globalState: Map<string, Map<string, string>>;
|
|
329
|
+
jsdoc: JsdocBlockWithInline;
|
|
330
|
+
jsdocNode: import("eslint").Rule.Node & {
|
|
331
|
+
range: [number, number];
|
|
332
|
+
};
|
|
333
|
+
node: Node | null;
|
|
334
|
+
allComments?: import("estree").Node[];
|
|
335
|
+
report: Report;
|
|
336
|
+
makeReport?: MakeReport;
|
|
337
|
+
settings: Settings;
|
|
338
|
+
utils: Utils;
|
|
339
|
+
}) => any;
|
|
340
|
+
export type NonCommentArgs = {
|
|
341
|
+
node: Node & {
|
|
342
|
+
range: [number, number];
|
|
343
|
+
};
|
|
344
|
+
state: StateObject;
|
|
345
|
+
};
|
|
346
|
+
export type RuleConfig = {
|
|
347
|
+
/**
|
|
348
|
+
* ESLint rule meta
|
|
349
|
+
*/
|
|
350
|
+
meta: EslintRuleMeta;
|
|
351
|
+
/**
|
|
352
|
+
* Any default contexts
|
|
353
|
+
*/
|
|
354
|
+
contextDefaults?: jsdocUtils.DefaultContexts | undefined;
|
|
355
|
+
/**
|
|
356
|
+
* Whether to force a `contexts` check
|
|
357
|
+
*/
|
|
358
|
+
contextSelected?: true | undefined;
|
|
359
|
+
/**
|
|
360
|
+
* Whether to iterate all JSDoc blocks by default
|
|
361
|
+
* regardless of context
|
|
362
|
+
*/
|
|
363
|
+
iterateAllJsdocs?: true | undefined;
|
|
364
|
+
/**
|
|
365
|
+
* Whether to check `@private` blocks (normally exempted)
|
|
366
|
+
*/
|
|
367
|
+
checkPrivate?: true | undefined;
|
|
368
|
+
/**
|
|
369
|
+
* Whether to check `@internal` blocks (normally exempted)
|
|
370
|
+
*/
|
|
371
|
+
checkInternal?: true | undefined;
|
|
372
|
+
/**
|
|
373
|
+
* Whether to iterates over all JSDoc blocks regardless of attachment
|
|
374
|
+
*/
|
|
375
|
+
checkFile?: true | undefined;
|
|
376
|
+
/**
|
|
377
|
+
* Whether to avoid relying on settings for global contexts
|
|
378
|
+
*/
|
|
379
|
+
nonGlobalSettings?: true | undefined;
|
|
380
|
+
/**
|
|
381
|
+
* Whether to disable the tracking of visited comment nodes (as
|
|
382
|
+
* non-tracked may conduct further actions)
|
|
383
|
+
*/
|
|
384
|
+
noTracking?: true | undefined;
|
|
385
|
+
/**
|
|
386
|
+
* Whether the rule expects contexts to be based on a match option
|
|
387
|
+
*/
|
|
388
|
+
matchContext?: true | undefined;
|
|
389
|
+
/**
|
|
390
|
+
* Handler to be executed upon exiting iteration of program AST
|
|
391
|
+
*/
|
|
392
|
+
exit?: ((args: {
|
|
393
|
+
context: import("eslint").Rule.RuleContext;
|
|
394
|
+
state: StateObject;
|
|
395
|
+
settings: Settings;
|
|
396
|
+
utils: BasicUtils;
|
|
397
|
+
}) => void) | undefined;
|
|
398
|
+
/**
|
|
399
|
+
* Handler to be executed if rule wishes
|
|
400
|
+
* to be supplied nodes without comments
|
|
401
|
+
*/
|
|
402
|
+
nonComment?: ((nca: NonCommentArgs) => void) | undefined;
|
|
403
|
+
};
|
|
404
|
+
/**
|
|
405
|
+
* @typedef {{
|
|
406
|
+
* [key: string]: false|string|{
|
|
407
|
+
* message: string,
|
|
408
|
+
* replacement?: false|string
|
|
409
|
+
* skipRootChecking?: boolean
|
|
410
|
+
* }
|
|
411
|
+
* }} PreferredTypes
|
|
412
|
+
*/
|
|
413
|
+
/**
|
|
414
|
+
* @typedef {{
|
|
415
|
+
* [key: string]: {
|
|
416
|
+
* name?: "text"|"namepath-defining"|"namepath-referencing"|false,
|
|
417
|
+
* type?: boolean|string[],
|
|
418
|
+
* required?: ("name"|"type"|"typeOrNameRequired")[]
|
|
419
|
+
* }
|
|
420
|
+
* }} StructuredTags
|
|
421
|
+
*/
|
|
422
|
+
/**
|
|
423
|
+
* Settings from ESLint types.
|
|
424
|
+
* @typedef {{
|
|
425
|
+
* maxLines: Integer,
|
|
426
|
+
* minLines: Integer,
|
|
427
|
+
* tagNamePreference: import('./jsdocUtils.js').TagNamePreference,
|
|
428
|
+
* mode: import('./jsdocUtils.js').ParserMode,
|
|
429
|
+
* preferredTypes: PreferredTypes,
|
|
430
|
+
* structuredTags: StructuredTags,
|
|
431
|
+
* [name: string]: any,
|
|
432
|
+
* contexts?: Context[]
|
|
433
|
+
* }} Settings
|
|
434
|
+
*/
|
|
435
|
+
/**
|
|
436
|
+
* @typedef {{
|
|
437
|
+
* settings?: {
|
|
438
|
+
* jsdoc?: {
|
|
439
|
+
* ignorePrivate: boolean,
|
|
440
|
+
* ignoreInternal: boolean,
|
|
441
|
+
* maxLines: Integer,
|
|
442
|
+
* minLines: Integer,
|
|
443
|
+
* tagNamePreference: import('./jsdocUtils.js').TagNamePreference,
|
|
444
|
+
* preferredTypes: PreferredTypes,
|
|
445
|
+
* structuredTags: StructuredTags,
|
|
446
|
+
* overrideReplacesDocs: boolean,
|
|
447
|
+
* ignoreReplacesDocs: boolean,
|
|
448
|
+
* implementsReplacesDocs: boolean,
|
|
449
|
+
* augmentsExtendsReplacesDocs: boolean,
|
|
450
|
+
* exemptDestructuredRootsFromChecks: boolean,
|
|
451
|
+
* mode: import('./jsdocUtils.js').ParserMode,
|
|
452
|
+
* contexts: Context[],
|
|
453
|
+
* }
|
|
454
|
+
* }
|
|
455
|
+
* }} JSDocSettings
|
|
456
|
+
*/
|
|
457
|
+
/**
|
|
458
|
+
* @param {import('eslint').Rule.RuleContext & JSDocSettings} context
|
|
459
|
+
* @returns {Settings|false}
|
|
460
|
+
*/
|
|
461
|
+
export function getSettings(context: import("eslint").Rule.RuleContext & JSDocSettings): Settings | false;
|
|
462
|
+
import * as jsdocUtils from './jsdocUtils.js';
|