eslint-plugin-jsdoc 56.0.0 → 56.0.2

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.
Files changed (79) hide show
  1. package/dist/cjs/getJsdocProcessorPlugin.d.cts +5 -1
  2. package/dist/cjs/iterateJsdoc.d.cts +6 -2
  3. package/dist/getJsdocProcessorPlugin.cts +3 -1
  4. package/dist/iterateJsdoc.cts +9 -4
  5. package/package.json +4 -4
  6. package/src/getJsdocProcessorPlugin.cts +3 -1
  7. package/src/iterateJsdoc.cts +9 -4
  8. package/dist/cjs/WarnSettings.js +0 -30
  9. package/dist/cjs/alignTransform.js +0 -285
  10. package/dist/cjs/defaultTagOrder.js +0 -152
  11. package/dist/cjs/exportParser.js +0 -754
  12. package/dist/cjs/getDefaultTagStructureForMode.js +0 -840
  13. package/dist/cjs/getJsdocProcessorPlugin.cjs +0 -4
  14. package/dist/cjs/getJsdocProcessorPlugin.js +0 -553
  15. package/dist/cjs/index-cjs.js +0 -492
  16. package/dist/cjs/index.cjs.cjs +0 -6
  17. package/dist/cjs/iterateJsdoc.cjs +0 -38
  18. package/dist/cjs/iterateJsdoc.js +0 -1981
  19. package/dist/cjs/jsdocUtils.js +0 -1470
  20. package/dist/cjs/rules/checkAccess.js +0 -35
  21. package/dist/cjs/rules/checkAlignment.js +0 -63
  22. package/dist/cjs/rules/checkExamples.js +0 -486
  23. package/dist/cjs/rules/checkIndentation.js +0 -66
  24. package/dist/cjs/rules/checkLineAlignment.js +0 -297
  25. package/dist/cjs/rules/checkParamNames.js +0 -320
  26. package/dist/cjs/rules/checkPropertyNames.js +0 -105
  27. package/dist/cjs/rules/checkSyntax.js +0 -27
  28. package/dist/cjs/rules/checkTagNames.js +0 -252
  29. package/dist/cjs/rules/checkTemplateNames.js +0 -189
  30. package/dist/cjs/rules/checkTypes.js +0 -421
  31. package/dist/cjs/rules/checkValues.js +0 -163
  32. package/dist/cjs/rules/convertToJsdocComments.js +0 -313
  33. package/dist/cjs/rules/emptyTags.js +0 -79
  34. package/dist/cjs/rules/implementsOnClasses.js +0 -63
  35. package/dist/cjs/rules/importsAsDependencies.js +0 -105
  36. package/dist/cjs/rules/informativeDocs.js +0 -153
  37. package/dist/cjs/rules/linesBeforeBlock.js +0 -106
  38. package/dist/cjs/rules/matchDescription.js +0 -240
  39. package/dist/cjs/rules/matchName.js +0 -122
  40. package/dist/cjs/rules/multilineBlocks.js +0 -339
  41. package/dist/cjs/rules/noBadBlocks.js +0 -88
  42. package/dist/cjs/rules/noBlankBlockDescriptions.js +0 -56
  43. package/dist/cjs/rules/noBlankBlocks.js +0 -41
  44. package/dist/cjs/rules/noDefaults.js +0 -84
  45. package/dist/cjs/rules/noMissingSyntax.js +0 -164
  46. package/dist/cjs/rules/noMultiAsterisks.js +0 -83
  47. package/dist/cjs/rules/noRestrictedSyntax.js +0 -75
  48. package/dist/cjs/rules/noTypes.js +0 -88
  49. package/dist/cjs/rules/noUndefinedTypes.js +0 -451
  50. package/dist/cjs/rules/requireAsteriskPrefix.js +0 -144
  51. package/dist/cjs/rules/requireDescription.js +0 -136
  52. package/dist/cjs/rules/requireDescriptionCompleteSentence.js +0 -258
  53. package/dist/cjs/rules/requireExample.js +0 -103
  54. package/dist/cjs/rules/requireFileOverview.js +0 -117
  55. package/dist/cjs/rules/requireHyphenBeforeParamDescription.js +0 -144
  56. package/dist/cjs/rules/requireJsdoc.js +0 -629
  57. package/dist/cjs/rules/requireParam.js +0 -480
  58. package/dist/cjs/rules/requireParamDescription.js +0 -77
  59. package/dist/cjs/rules/requireParamName.js +0 -52
  60. package/dist/cjs/rules/requireParamType.js +0 -77
  61. package/dist/cjs/rules/requireProperty.js +0 -44
  62. package/dist/cjs/rules/requirePropertyDescription.js +0 -22
  63. package/dist/cjs/rules/requirePropertyName.js +0 -22
  64. package/dist/cjs/rules/requirePropertyType.js +0 -22
  65. package/dist/cjs/rules/requireReturns.js +0 -197
  66. package/dist/cjs/rules/requireReturnsCheck.js +0 -108
  67. package/dist/cjs/rules/requireReturnsDescription.js +0 -58
  68. package/dist/cjs/rules/requireReturnsType.js +0 -52
  69. package/dist/cjs/rules/requireTemplate.js +0 -173
  70. package/dist/cjs/rules/requireThrows.js +0 -101
  71. package/dist/cjs/rules/requireYields.js +0 -172
  72. package/dist/cjs/rules/requireYieldsCheck.js +0 -164
  73. package/dist/cjs/rules/sortTags.js +0 -392
  74. package/dist/cjs/rules/tagLines.js +0 -259
  75. package/dist/cjs/rules/textEscaping.js +0 -125
  76. package/dist/cjs/rules/typeFormatting.js +0 -328
  77. package/dist/cjs/rules/validTypes.js +0 -333
  78. package/dist/cjs/tagNames.js +0 -209
  79. package/dist/cjs/utils/hasReturnValue.js +0 -469
@@ -1,164 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const iterateJsdoc_js_1 = __importDefault(require("../iterateJsdoc.js"));
7
- /**
8
- * @typedef {{
9
- * comment: string,
10
- * context: string,
11
- * message: string,
12
- * minimum: import('../iterateJsdoc.js').Integer
13
- * }} ContextObject
14
- */
15
- /**
16
- * @typedef {string|ContextObject} Context
17
- */
18
- /**
19
- * @param {import('../iterateJsdoc.js').StateObject} state
20
- * @returns {void}
21
- */
22
- const setDefaults = (state) => {
23
- if (!state.selectorMap) {
24
- state.selectorMap = {};
25
- }
26
- };
27
- /**
28
- * @param {import('../iterateJsdoc.js').StateObject} state
29
- * @param {string} selector
30
- * @param {string} comment
31
- * @returns {void}
32
- */
33
- const incrementSelector = (state, selector, comment) => {
34
- if (!state.selectorMap[selector]) {
35
- state.selectorMap[selector] = {};
36
- }
37
- if (!state.selectorMap[selector][comment]) {
38
- state.selectorMap[selector][comment] = 0;
39
- }
40
- state.selectorMap[selector][comment]++;
41
- };
42
- exports.default = (0, iterateJsdoc_js_1.default)(({ context, info: { comment, }, state, utils, }) => {
43
- if (!context.options[0]) {
44
- // Handle error later
45
- return;
46
- }
47
- /**
48
- * @type {Context[]}
49
- */
50
- const contexts = context.options[0].contexts;
51
- const { contextStr, } = utils.findContext(contexts, comment);
52
- setDefaults(state);
53
- incrementSelector(state, contextStr, String(comment));
54
- }, {
55
- contextSelected: true,
56
- exit({ context, settings, state, }) {
57
- if (!context.options.length && !settings.contexts) {
58
- context.report({
59
- loc: {
60
- end: {
61
- column: 1,
62
- line: 1,
63
- },
64
- start: {
65
- column: 1,
66
- line: 1,
67
- },
68
- },
69
- message: 'Rule `no-missing-syntax` is missing a `contexts` option.',
70
- });
71
- return;
72
- }
73
- setDefaults(state);
74
- /**
75
- * @type {Context[]}
76
- */
77
- const contexts = (context.options[0] ?? {}).contexts ?? settings?.contexts;
78
- // Report when MISSING
79
- contexts.some((cntxt) => {
80
- const contextStr = typeof cntxt === 'object' ? cntxt.context ?? 'any' : cntxt;
81
- const comment = typeof cntxt === 'string' ? '' : cntxt?.comment;
82
- const contextKey = contextStr === 'any' ? 'undefined' : contextStr;
83
- if ((!state.selectorMap[contextKey] ||
84
- !state.selectorMap[contextKey][comment] ||
85
- state.selectorMap[contextKey][comment] < (
86
- // @ts-expect-error comment would need an object, not string
87
- cntxt?.minimum ?? 1)) &&
88
- (contextStr !== 'any' || Object.values(state.selectorMap).every((cmmnt) => {
89
- return !cmmnt[comment] || cmmnt[comment] < (
90
- // @ts-expect-error comment would need an object, not string
91
- cntxt?.minimum ?? 1);
92
- }))) {
93
- const message = typeof cntxt === 'string' ?
94
- 'Syntax is required: {{context}}' :
95
- cntxt?.message ?? ('Syntax is required: {{context}}' +
96
- (comment ? ' with {{comment}}' : ''));
97
- context.report({
98
- data: {
99
- comment,
100
- context: contextStr,
101
- },
102
- loc: {
103
- end: {
104
- column: 1,
105
- line: 1,
106
- },
107
- start: {
108
- column: 1,
109
- line: 1,
110
- },
111
- },
112
- message,
113
- });
114
- return true;
115
- }
116
- return false;
117
- });
118
- },
119
- matchContext: true,
120
- meta: {
121
- docs: {
122
- description: 'Reports when certain comment structures are always expected.',
123
- url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-missing-syntax.md#repos-sticky-header',
124
- },
125
- fixable: 'code',
126
- schema: [
127
- {
128
- additionalProperties: false,
129
- properties: {
130
- contexts: {
131
- items: {
132
- anyOf: [
133
- {
134
- type: 'string',
135
- },
136
- {
137
- additionalProperties: false,
138
- properties: {
139
- comment: {
140
- type: 'string',
141
- },
142
- context: {
143
- type: 'string',
144
- },
145
- message: {
146
- type: 'string',
147
- },
148
- minimum: {
149
- type: 'integer',
150
- },
151
- },
152
- type: 'object',
153
- },
154
- ],
155
- },
156
- type: 'array',
157
- },
158
- },
159
- type: 'object',
160
- },
161
- ],
162
- type: 'suggestion',
163
- },
164
- });
@@ -1,83 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const iterateJsdoc_js_1 = __importDefault(require("../iterateJsdoc.js"));
7
- const middleAsterisksBlockWS = /^([\t ]|\*(?!\*))+/v;
8
- const middleAsterisksNoBlockWS = /^\*+/v;
9
- const endAsterisksSingleLineBlockWS = /\*((?:\*|(?: |\t))*)\*$/v;
10
- const endAsterisksMultipleLineBlockWS = /((?:\*|(?: |\t))*)\*$/v;
11
- const endAsterisksSingleLineNoBlockWS = /\*(\**)\*$/v;
12
- const endAsterisksMultipleLineNoBlockWS = /(\**)\*$/v;
13
- exports.default = (0, iterateJsdoc_js_1.default)(({ context, jsdoc, utils, }) => {
14
- const { allowWhitespace = false, preventAtEnd = true, preventAtMiddleLines = true, } = context.options[0] || {};
15
- const middleAsterisks = allowWhitespace ? middleAsterisksNoBlockWS : middleAsterisksBlockWS;
16
- // eslint-disable-next-line complexity -- Todo
17
- jsdoc.source.some(({ number, tokens, }) => {
18
- const { delimiter, description, end, name, postDelimiter, tag, type, } = tokens;
19
- if (preventAtMiddleLines &&
20
- !end && !tag && !type && !name &&
21
- (!allowWhitespace && middleAsterisks.test(description) ||
22
- allowWhitespace && middleAsterisks.test(postDelimiter + description))) {
23
- // console.log('description', JSON.stringify(description));
24
- const fix = () => {
25
- tokens.description = description.replace(middleAsterisks, '');
26
- };
27
- utils.reportJSDoc('Should be no multiple asterisks on middle lines.', {
28
- line: number,
29
- }, fix, true);
30
- return true;
31
- }
32
- if (!preventAtEnd || !end) {
33
- return false;
34
- }
35
- const isSingleLineBlock = delimiter === '/**';
36
- const delim = isSingleLineBlock ? '*' : delimiter;
37
- const endAsterisks = allowWhitespace ?
38
- (isSingleLineBlock ? endAsterisksSingleLineNoBlockWS : endAsterisksMultipleLineNoBlockWS) :
39
- (isSingleLineBlock ? endAsterisksSingleLineBlockWS : endAsterisksMultipleLineBlockWS);
40
- const endingAsterisksAndSpaces = (allowWhitespace ? postDelimiter + description + delim : description + delim).match(endAsterisks);
41
- if (!endingAsterisksAndSpaces ||
42
- !isSingleLineBlock && endingAsterisksAndSpaces[1] && !endingAsterisksAndSpaces[1].trim()) {
43
- return false;
44
- }
45
- const endFix = () => {
46
- if (!isSingleLineBlock) {
47
- tokens.delimiter = '';
48
- }
49
- tokens.description = (description + delim).replace(endAsterisks, '');
50
- };
51
- utils.reportJSDoc('Should be no multiple asterisks on end lines.', {
52
- line: number,
53
- }, endFix, true);
54
- return true;
55
- });
56
- }, {
57
- iterateAllJsdocs: true,
58
- meta: {
59
- docs: {
60
- description: 'Prevents use of multiple asterisks at the beginning of lines.',
61
- url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-multi-asterisks.md#repos-sticky-header',
62
- },
63
- fixable: 'code',
64
- schema: [
65
- {
66
- additionalProperties: false,
67
- properties: {
68
- allowWhitespace: {
69
- type: 'boolean',
70
- },
71
- preventAtEnd: {
72
- type: 'boolean',
73
- },
74
- preventAtMiddleLines: {
75
- type: 'boolean',
76
- },
77
- },
78
- type: 'object',
79
- },
80
- ],
81
- type: 'suggestion',
82
- },
83
- });
@@ -1,75 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const iterateJsdoc_js_1 = __importDefault(require("../iterateJsdoc.js"));
7
- exports.default = (0, iterateJsdoc_js_1.default)(({ context, info: { comment, }, report, utils, }) => {
8
- if (!context.options.length) {
9
- report('Rule `no-restricted-syntax` is missing a `contexts` option.');
10
- return;
11
- }
12
- const { contexts, } = context.options[0];
13
- const { contextStr, foundContext, } = utils.findContext(contexts, comment);
14
- // We are not on the *particular* matching context/comment, so don't assume
15
- // we need reporting
16
- if (!foundContext) {
17
- return;
18
- }
19
- const message = /** @type {import('../iterateJsdoc.js').ContextObject} */ (foundContext)?.message ??
20
- 'Syntax is restricted: {{context}}' +
21
- (comment ? ' with {{comment}}' : '');
22
- report(message, null, null, comment ? {
23
- comment,
24
- context: contextStr,
25
- } : {
26
- context: contextStr,
27
- });
28
- }, {
29
- contextSelected: true,
30
- meta: {
31
- docs: {
32
- description: 'Reports when certain comment structures are present.',
33
- url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-restricted-syntax.md#repos-sticky-header',
34
- },
35
- fixable: 'code',
36
- schema: [
37
- {
38
- additionalProperties: false,
39
- properties: {
40
- contexts: {
41
- items: {
42
- anyOf: [
43
- {
44
- type: 'string',
45
- },
46
- {
47
- additionalProperties: false,
48
- properties: {
49
- comment: {
50
- type: 'string',
51
- },
52
- context: {
53
- type: 'string',
54
- },
55
- message: {
56
- type: 'string',
57
- },
58
- },
59
- type: 'object',
60
- },
61
- ],
62
- },
63
- type: 'array',
64
- },
65
- },
66
- required: [
67
- 'contexts',
68
- ],
69
- type: 'object',
70
- },
71
- ],
72
- type: 'suggestion',
73
- },
74
- nonGlobalSettings: true,
75
- });
@@ -1,88 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const iterateJsdoc_js_1 = __importDefault(require("../iterateJsdoc.js"));
7
- /**
8
- * @param {import('comment-parser').Line} line
9
- */
10
- const removeType = ({ tokens, }) => {
11
- tokens.postTag = '';
12
- tokens.type = '';
13
- };
14
- exports.default = (0, iterateJsdoc_js_1.default)(({ node, utils, }) => {
15
- if (!utils.isIteratingFunctionOrVariable() && !utils.isVirtualFunction()) {
16
- return;
17
- }
18
- const tags = utils.getPresentTags([
19
- 'param', 'arg', 'argument', 'returns', 'return',
20
- ]);
21
- for (const tag of tags) {
22
- if (tag.type) {
23
- utils.reportJSDoc(`Types are not permitted on @${tag.tag}.`, tag, () => {
24
- for (const source of tag.source) {
25
- removeType(source);
26
- }
27
- });
28
- }
29
- }
30
- if (node?.type === 'ClassDeclaration') {
31
- const propertyTags = utils.getPresentTags([
32
- 'prop', 'property',
33
- ]);
34
- for (const tag of propertyTags) {
35
- if (tag.type) {
36
- utils.reportJSDoc(`Types are not permitted on @${tag.tag} in the supplied context.`, tag, () => {
37
- for (const source of tag.source) {
38
- removeType(source);
39
- }
40
- });
41
- }
42
- }
43
- }
44
- }, {
45
- contextDefaults: [
46
- 'ArrowFunctionExpression', 'FunctionDeclaration', 'FunctionExpression', 'TSDeclareFunction',
47
- // Add this to above defaults
48
- 'TSMethodSignature', 'ClassDeclaration',
49
- ],
50
- meta: {
51
- docs: {
52
- description: 'This rule reports types being used on `@param` or `@returns`.',
53
- url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-types.md#repos-sticky-header',
54
- },
55
- fixable: 'code',
56
- schema: [
57
- {
58
- additionalProperties: false,
59
- properties: {
60
- contexts: {
61
- items: {
62
- anyOf: [
63
- {
64
- type: 'string',
65
- },
66
- {
67
- additionalProperties: false,
68
- properties: {
69
- comment: {
70
- type: 'string',
71
- },
72
- context: {
73
- type: 'string',
74
- },
75
- },
76
- type: 'object',
77
- },
78
- ],
79
- },
80
- type: 'array',
81
- },
82
- },
83
- type: 'object',
84
- },
85
- ],
86
- type: 'suggestion',
87
- },
88
- });