eslint-plugin-jsdoc 61.2.0 → 61.3.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/iterateJsdoc.d.ts +2 -2
- package/dist/cjs/jsdocUtils.d.ts +2 -1
- package/dist/iterateJsdoc.cjs +9 -4
- package/dist/iterateJsdoc.cjs.map +1 -1
- package/dist/iterateJsdoc.d.ts +2 -2
- package/dist/jsdocUtils.cjs +11 -1
- package/dist/jsdocUtils.cjs.map +1 -1
- package/dist/jsdocUtils.d.ts +2 -1
- package/dist/rules/checkIndentation.cjs +84 -7
- package/dist/rules/checkIndentation.cjs.map +1 -1
- package/dist/rules/requireParam.cjs +3 -8
- package/dist/rules/requireParam.cjs.map +1 -1
- package/dist/rules/tagLines.cjs +10 -9
- package/dist/rules/tagLines.cjs.map +1 -1
- package/dist/rules.d.ts +4 -0
- package/dist/to-valid-identifier.cjs +3 -1
- package/package.json +1 -1
- package/src/iterateJsdoc.js +9 -3
- package/src/jsdocUtils.js +15 -1
- package/src/rules/checkIndentation.js +89 -7
- package/src/rules/requireParam.js +5 -14
- package/src/rules/tagLines.js +13 -9
- package/src/rules.d.ts +4 -0
|
@@ -28,6 +28,17 @@ const maskCodeBlocks = str => {
|
|
|
28
28
|
return (margin + '\n').repeat(code.match(/\n/gv).length);
|
|
29
29
|
});
|
|
30
30
|
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @param {string[]} lines
|
|
34
|
+
* @param {number} lineIndex
|
|
35
|
+
* @returns {number}
|
|
36
|
+
*/
|
|
37
|
+
const getLineNumber = (lines, lineIndex) => {
|
|
38
|
+
const precedingText = lines.slice(0, lineIndex).join('\n');
|
|
39
|
+
const lineBreaks = precedingText.match(/\n/gv) || [];
|
|
40
|
+
return lineBreaks.length + 1;
|
|
41
|
+
};
|
|
31
42
|
var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
32
43
|
context,
|
|
33
44
|
jsdocNode,
|
|
@@ -35,17 +46,79 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
35
46
|
sourceCode
|
|
36
47
|
}) => {
|
|
37
48
|
const options = context.options[0] || {};
|
|
38
|
-
const /** @type {{excludeTags: string[]}} */{
|
|
49
|
+
const /** @type {{excludeTags: string[], allowIndentedSections: boolean}} */{
|
|
50
|
+
allowIndentedSections = false,
|
|
39
51
|
excludeTags = ['example']
|
|
40
52
|
} = options;
|
|
41
|
-
const reg = /^(?:\/?\**|[ \t]*)\*[ \t]{2}/gmv;
|
|
42
53
|
const textWithoutCodeBlocks = maskCodeBlocks(sourceCode.getText(jsdocNode));
|
|
43
54
|
const text = excludeTags.length ? maskExcludedContent(textWithoutCodeBlocks, excludeTags) : textWithoutCodeBlocks;
|
|
44
|
-
if (
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
55
|
+
if (allowIndentedSections) {
|
|
56
|
+
// When allowIndentedSections is enabled, only check for indentation on tag lines
|
|
57
|
+
// and the very first line of the main description
|
|
58
|
+
const lines = text.split('\n');
|
|
59
|
+
let hasSeenContent = false;
|
|
60
|
+
let currentSectionIndent = null;
|
|
61
|
+
for (const [lineIndex, line] of lines.entries()) {
|
|
62
|
+
// Check for indentation (two or more spaces after *)
|
|
63
|
+
const indentMatch = line.match(/^(?:\/?\**|[\t ]*)\*([\t ]{2,})/v);
|
|
64
|
+
if (indentMatch) {
|
|
65
|
+
// Check what comes after the indentation
|
|
66
|
+
const afterIndent = line.slice(indentMatch[0].length);
|
|
67
|
+
const indentAmount = indentMatch[1].length;
|
|
68
|
+
|
|
69
|
+
// If this is a tag line with indentation, always report
|
|
70
|
+
if (/^@\w+/v.test(afterIndent)) {
|
|
71
|
+
report('There must be no indentation.', null, {
|
|
72
|
+
line: getLineNumber(lines, lineIndex)
|
|
73
|
+
});
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// If we haven't seen any content yet (main description first line) and there's content, report
|
|
78
|
+
if (!hasSeenContent && afterIndent.trim().length > 0) {
|
|
79
|
+
report('There must be no indentation.', null, {
|
|
80
|
+
line: getLineNumber(lines, lineIndex)
|
|
81
|
+
});
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// For continuation lines, check consistency
|
|
86
|
+
if (hasSeenContent && afterIndent.trim().length > 0) {
|
|
87
|
+
if (currentSectionIndent === null) {
|
|
88
|
+
// First indented line in this section, set the indent level
|
|
89
|
+
currentSectionIndent = indentAmount;
|
|
90
|
+
} else if (indentAmount < currentSectionIndent) {
|
|
91
|
+
// Indentation is less than the established level (inconsistent)
|
|
92
|
+
report('There must be no indentation.', null, {
|
|
93
|
+
line: getLineNumber(lines, lineIndex)
|
|
94
|
+
});
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
} else if (/^\s*\*\s+\S/v.test(line)) {
|
|
99
|
+
// No indentation on this line, reset section indent tracking
|
|
100
|
+
// (unless it's just whitespace or a closing comment)
|
|
101
|
+
currentSectionIndent = null;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Track if we've seen any content (non-whitespace after the *)
|
|
105
|
+
if (/^\s*\*\s+\S/v.test(line)) {
|
|
106
|
+
hasSeenContent = true;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Reset section indent when we encounter a tag
|
|
110
|
+
if (/@\w+/v.test(line)) {
|
|
111
|
+
currentSectionIndent = null;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
} else {
|
|
115
|
+
const reg = /^(?:\/?\**|[ \t]*)\*[ \t]{2}/gmv;
|
|
116
|
+
if (reg.test(text)) {
|
|
117
|
+
const lineBreaks = text.slice(0, reg.lastIndex).match(/\n/gv) || [];
|
|
118
|
+
report('There must be no indentation.', null, {
|
|
119
|
+
line: lineBreaks.length
|
|
120
|
+
});
|
|
121
|
+
}
|
|
49
122
|
}
|
|
50
123
|
}, {
|
|
51
124
|
iterateAllJsdocs: true,
|
|
@@ -57,6 +130,10 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
57
130
|
schema: [{
|
|
58
131
|
additionalProperties: false,
|
|
59
132
|
properties: {
|
|
133
|
+
allowIndentedSections: {
|
|
134
|
+
description: 'Allows indentation of nested sections on subsequent lines (like bullet lists)',
|
|
135
|
+
type: 'boolean'
|
|
136
|
+
},
|
|
60
137
|
excludeTags: {
|
|
61
138
|
description: `Array of tags (e.g., \`['example', 'description']\`) whose content will be
|
|
62
139
|
"hidden" from the \`check-indentation\` rule. Defaults to \`['example']\`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkIndentation.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","maskExcludedContent","str","excludeTags","regContent","RegExp","join","replace","_match","margin","code","repeat","match","length","maskCodeBlocks","replaceAll","_default","exports","iterateJsdoc","context","jsdocNode","report","sourceCode","options","reg","textWithoutCodeBlocks","getText","text","test","lineBreaks","slice","lastIndex","line","iterateAllJsdocs","meta","docs","description","url","schema","additionalProperties","properties","items","pattern","type","module"],"sources":["../../src/rules/checkIndentation.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * @param {string} str\n * @param {string[]} excludeTags\n * @returns {string}\n */\nconst maskExcludedContent = (str, excludeTags) => {\n const regContent = new RegExp(`([ \\\\t]+\\\\*)[ \\\\t]@(?:${excludeTags.join('|')})(?=[ \\\\n])([\\\\w\\\\|\\\\W]*?\\\\n)(?=[ \\\\t]*\\\\*(?:[ \\\\t]*@\\\\w+\\\\s|\\\\/))`, 'gv');\n\n return str.replace(regContent, (_match, margin, code) => {\n return (margin + '\\n').repeat(code.match(/\\n/gv).length);\n });\n};\n\n/**\n * @param {string} str\n * @returns {string}\n */\nconst maskCodeBlocks = (str) => {\n const regContent = /([ \\t]+\\*)[ \\t]```[^\\n]*?([\\w\\|\\W]*?\\n)(?=[ \\t]*\\*(?:[ \\t]*(?:```|@\\w+\\s)|\\/))/gv;\n\n return str.replaceAll(regContent, (_match, margin, code) => {\n return (margin + '\\n').repeat(code.match(/\\n/gv).length);\n });\n};\n\nexport default iterateJsdoc(({\n context,\n jsdocNode,\n report,\n sourceCode,\n}) => {\n const options = context.options[0] || {};\n const /** @type {{excludeTags: string[]}} */ {\n excludeTags = [\n 'example',\n ],\n } = options;\n\n const reg = /^(?:\\/?\\**|[ \\t]*)\\*[ \\t]{2}/gmv;\n const textWithoutCodeBlocks = maskCodeBlocks(sourceCode.getText(jsdocNode));\n const text = excludeTags.length ? maskExcludedContent(textWithoutCodeBlocks, excludeTags) : textWithoutCodeBlocks;\n\n if (reg.test(text)) {\n const lineBreaks = text.slice(0, reg.lastIndex).match(/\\n/gv) || [];\n report('There must be no indentation.', null, {\n line: lineBreaks.length,\n });\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Reports invalid padding inside JSDoc blocks.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/check-indentation.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n excludeTags: {\n description: `Array of tags (e.g., \\`['example', 'description']\\`) whose content will be\n\"hidden\" from the \\`check-indentation\\` rule. Defaults to \\`['example']\\`.\n\nBy default, the whole JSDoc block will be checked for invalid padding.\nThat would include \\`@example\\` blocks too, which can get in the way\nof adding full, readable examples of code without ending up with multiple\nlinting issues.\n\nWhen disabled (by passing \\`excludeTags: []\\` option), the following code *will*\nreport a padding issue:\n\n\\`\\`\\`js\n/**\n * @example\n * anArray.filter((a) => {\n * return a.b;\n * });\n */\n\\`\\`\\``,\n items: {\n pattern: '^\\\\S+$',\n type: 'string',\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'layout',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA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;EAC3E,MAAMO,IAAI,GAAGxB,WAAW,CAACU,MAAM,GAAGZ,mBAAmB,CAACwB,qBAAqB,EAAEtB,WAAW,CAAC,GAAGsB,qBAAqB;EAEjH,IAAID,GAAG,CAACI,IAAI,CAACD,IAAI,CAAC,EAAE;IAClB,MAAME,UAAU,GAAGF,IAAI,CAACG,KAAK,CAAC,CAAC,EAAEN,GAAG,CAACO,SAAS,CAAC,CAACnB,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE;IACnES,MAAM,CAAC,+BAA+B,EAAE,IAAI,EAAE;MAC5CW,IAAI,EAAEH,UAAU,CAAChB;IACnB,CAAC,CAAC;EACJ;AACF,CAAC,EAAE;EACDoB,gBAAgB,EAAE,IAAI;EACtBC,IAAI,EAAE;IACJC,IAAI,EAAE;MACJC,WAAW,EAAE,8CAA8C;MAC3DC,GAAG,EAAE;IACP,CAAC;IACDC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACVrC,WAAW,EAAE;UACXiC,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;UACKK,KAAK,EAAE;YACLC,OAAO,EAAE,QAAQ;YACjBC,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAC,MAAA,CAAA3B,OAAA,GAAAA,OAAA,CAAAjB,OAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"checkIndentation.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","maskExcludedContent","str","excludeTags","regContent","RegExp","join","replace","_match","margin","code","repeat","match","length","maskCodeBlocks","replaceAll","getLineNumber","lines","lineIndex","precedingText","slice","lineBreaks","_default","exports","iterateJsdoc","context","jsdocNode","report","sourceCode","options","allowIndentedSections","textWithoutCodeBlocks","getText","text","split","hasSeenContent","currentSectionIndent","line","entries","indentMatch","afterIndent","indentAmount","test","trim","reg","lastIndex","iterateAllJsdocs","meta","docs","description","url","schema","additionalProperties","properties","type","items","pattern","module"],"sources":["../../src/rules/checkIndentation.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * @param {string} str\n * @param {string[]} excludeTags\n * @returns {string}\n */\nconst maskExcludedContent = (str, excludeTags) => {\n const regContent = new RegExp(`([ \\\\t]+\\\\*)[ \\\\t]@(?:${excludeTags.join('|')})(?=[ \\\\n])([\\\\w\\\\|\\\\W]*?\\\\n)(?=[ \\\\t]*\\\\*(?:[ \\\\t]*@\\\\w+\\\\s|\\\\/))`, 'gv');\n\n return str.replace(regContent, (_match, margin, code) => {\n return (margin + '\\n').repeat(code.match(/\\n/gv).length);\n });\n};\n\n/**\n * @param {string} str\n * @returns {string}\n */\nconst maskCodeBlocks = (str) => {\n const regContent = /([ \\t]+\\*)[ \\t]```[^\\n]*?([\\w\\|\\W]*?\\n)(?=[ \\t]*\\*(?:[ \\t]*(?:```|@\\w+\\s)|\\/))/gv;\n\n return str.replaceAll(regContent, (_match, margin, code) => {\n return (margin + '\\n').repeat(code.match(/\\n/gv).length);\n });\n};\n\n/**\n * @param {string[]} lines\n * @param {number} lineIndex\n * @returns {number}\n */\nconst getLineNumber = (lines, lineIndex) => {\n const precedingText = lines.slice(0, lineIndex).join('\\n');\n const lineBreaks = precedingText.match(/\\n/gv) || [];\n return lineBreaks.length + 1;\n};\n\nexport default iterateJsdoc(({\n context,\n jsdocNode,\n report,\n sourceCode,\n}) => {\n const options = context.options[0] || {};\n const /** @type {{excludeTags: string[], allowIndentedSections: boolean}} */ {\n allowIndentedSections = false,\n excludeTags = [\n 'example',\n ],\n } = options;\n\n const textWithoutCodeBlocks = maskCodeBlocks(sourceCode.getText(jsdocNode));\n const text = excludeTags.length ? maskExcludedContent(textWithoutCodeBlocks, excludeTags) : textWithoutCodeBlocks;\n\n if (allowIndentedSections) {\n // When allowIndentedSections is enabled, only check for indentation on tag lines\n // and the very first line of the main description\n const lines = text.split('\\n');\n let hasSeenContent = false;\n let currentSectionIndent = null;\n\n for (const [\n lineIndex,\n line,\n ] of lines.entries()) {\n // Check for indentation (two or more spaces after *)\n const indentMatch = line.match(/^(?:\\/?\\**|[\\t ]*)\\*([\\t ]{2,})/v);\n\n if (indentMatch) {\n // Check what comes after the indentation\n const afterIndent = line.slice(indentMatch[0].length);\n const indentAmount = indentMatch[1].length;\n\n // If this is a tag line with indentation, always report\n if (/^@\\w+/v.test(afterIndent)) {\n report('There must be no indentation.', null, {\n line: getLineNumber(lines, lineIndex),\n });\n return;\n }\n\n // If we haven't seen any content yet (main description first line) and there's content, report\n if (!hasSeenContent && afterIndent.trim().length > 0) {\n report('There must be no indentation.', null, {\n line: getLineNumber(lines, lineIndex),\n });\n return;\n }\n\n // For continuation lines, check consistency\n if (hasSeenContent && afterIndent.trim().length > 0) {\n if (currentSectionIndent === null) {\n // First indented line in this section, set the indent level\n currentSectionIndent = indentAmount;\n } else if (indentAmount < currentSectionIndent) {\n // Indentation is less than the established level (inconsistent)\n report('There must be no indentation.', null, {\n line: getLineNumber(lines, lineIndex),\n });\n return;\n }\n }\n } else if (/^\\s*\\*\\s+\\S/v.test(line)) {\n // No indentation on this line, reset section indent tracking\n // (unless it's just whitespace or a closing comment)\n currentSectionIndent = null;\n }\n\n // Track if we've seen any content (non-whitespace after the *)\n if (/^\\s*\\*\\s+\\S/v.test(line)) {\n hasSeenContent = true;\n }\n\n // Reset section indent when we encounter a tag\n if (/@\\w+/v.test(line)) {\n currentSectionIndent = null;\n }\n }\n } else {\n const reg = /^(?:\\/?\\**|[ \\t]*)\\*[ \\t]{2}/gmv;\n if (reg.test(text)) {\n const lineBreaks = text.slice(0, reg.lastIndex).match(/\\n/gv) || [];\n report('There must be no indentation.', null, {\n line: lineBreaks.length,\n });\n }\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Reports invalid padding inside JSDoc blocks.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/check-indentation.md#repos-sticky-header',\n },\n schema: [\n {\n additionalProperties: false,\n properties: {\n allowIndentedSections: {\n description: 'Allows indentation of nested sections on subsequent lines (like bullet lists)',\n type: 'boolean',\n },\n excludeTags: {\n description: `Array of tags (e.g., \\`['example', 'description']\\`) whose content will be\n\"hidden\" from the \\`check-indentation\\` rule. Defaults to \\`['example']\\`.\n\nBy default, the whole JSDoc block will be checked for invalid padding.\nThat would include \\`@example\\` blocks too, which can get in the way\nof adding full, readable examples of code without ending up with multiple\nlinting issues.\n\nWhen disabled (by passing \\`excludeTags: []\\` option), the following code *will*\nreport a padding issue:\n\n\\`\\`\\`js\n/**\n * @example\n * anArray.filter((a) => {\n * return a.b;\n * });\n */\n\\`\\`\\``,\n items: {\n pattern: '^\\\\S+$',\n type: 'string',\n },\n type: 'array',\n },\n },\n type: 'object',\n },\n ],\n type: 'layout',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9C;AACA;AACA;AACA;AACA;AACA,MAAMG,mBAAmB,GAAGA,CAACC,GAAG,EAAEC,WAAW,KAAK;EAChD,MAAMC,UAAU,GAAG,IAAIC,MAAM,CAAC,yBAAyBF,WAAW,CAACG,IAAI,CAAC,GAAG,CAAC,oEAAoE,EAAE,IAAI,CAAC;EAEvJ,OAAOJ,GAAG,CAACK,OAAO,CAACH,UAAU,EAAE,CAACI,MAAM,EAAEC,MAAM,EAAEC,IAAI,KAAK;IACvD,OAAO,CAACD,MAAM,GAAG,IAAI,EAAEE,MAAM,CAACD,IAAI,CAACE,KAAK,CAAC,MAAM,CAAC,CAACC,MAAM,CAAC;EAC1D,CAAC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AC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAG,MAAA,CAAAlC,OAAA,GAAAA,OAAA,CAAAvB,OAAA","ignoreList":[]}
|
|
@@ -62,13 +62,8 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
62
62
|
unnamedRootBase = ['root'],
|
|
63
63
|
useDefaultObjectProperties = false
|
|
64
64
|
} = context.options[0] || {};
|
|
65
|
-
if (interfaceExemptsParamsCheck) {
|
|
66
|
-
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
if (node && node.parent?.type === 'VariableDeclarator' && 'typeAnnotation' in node.parent.id && node.parent.id.typeAnnotation) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
65
|
+
if (interfaceExemptsParamsCheck && node && node.parent?.type === 'VariableDeclarator' && 'typeAnnotation' in node.parent.id && node.parent.id.typeAnnotation) {
|
|
66
|
+
return;
|
|
72
67
|
}
|
|
73
68
|
const preferredTagName = /** @type {string} */utils.getPreferredTagName({
|
|
74
69
|
tagName: 'param'
|
|
@@ -76,7 +71,7 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
76
71
|
if (!preferredTagName) {
|
|
77
72
|
return;
|
|
78
73
|
}
|
|
79
|
-
const functionParameterNames = utils.getFunctionParameterNames(useDefaultObjectProperties);
|
|
74
|
+
const functionParameterNames = utils.getFunctionParameterNames(useDefaultObjectProperties, interfaceExemptsParamsCheck);
|
|
80
75
|
if (!functionParameterNames.length) {
|
|
81
76
|
return;
|
|
82
77
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requireParam.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","rootNamer","desiredRoots","currentIndex","name","idx","incremented","length","base","suffix","shift","_default","exports","iterateJsdoc","context","jsdoc","node","utils","avoidDocs","hasTag","autoIncrementBase","checkDestructured","checkDestructuredRoots","checkRestProperty","checkTypesPattern","enableFixer","enableRestElementFixer","enableRootFixer","ignoreWhenAllParamsMissing","interfaceExemptsParamsCheck","unnamedRootBase","useDefaultObjectProperties","options","params","type","typeAnnotation","parent","id","preferredTagName","getPreferredTagName","tagName","functionParameterNames","getFunctionParameterNames","jsdocParameterNames","getJsdocTagsDeep","shallowJsdocParameterNames","filter","tag","includes","map","checkTypesRegex","getRegexFromString","missingTags","flattenedRoots","flattenRoots","names","paramIndex","hasParamIndex","cur","dropPathSegmentQuotes","String","getParamIndex","setParamIndex","entries","findExpectedIndex","jsdocTags","indexAtFunctionParams","remainingFlattenedRoots","slice","foundIndex","findIndex","newAdd","some","flattenedRoot","endsWith","tags","tagLineCount","source","tokens","end","nextRootName","namer","thisOffset","functionParameterIdx","functionParameterName","inc","Array","isArray","matchedJsdoc","rootName","search","hasPropertyRest","hasRestElement","rests","notCheckingNames","paramName","find","fpn","emptyParamIdx","push","remove","fullParamName","notCheckingName","paramType","comparePaths","undefined","startsWith","funcParamName","restElement","fix","createTokens","tagIndex","sourceIndex","spliceCount","number","delimiter","description","lineEnd","postDelimiter","postName","postTag","postType","start","splice","inlineTags","optional","problems","firstNumber","src","offset","expectedIdx","firstParamLine","baseOffset","fixer","missingTag","makeMultiline","reportJSDoc","contextDefaults","meta","docs","url","fixable","schema","additionalProperties","properties","checkConstructors","checkGetters","checkSetters","contexts","items","anyOf","comment","exemptedBy","noTracking","module"],"sources":["../../src/rules/requireParam.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * @typedef {[string, boolean, () => RootNamerReturn]} RootNamerReturn\n */\n\n/**\n * @param {string[]} desiredRoots\n * @param {number} currentIndex\n * @returns {RootNamerReturn}\n */\nconst rootNamer = (desiredRoots, currentIndex) => {\n /** @type {string} */\n let name;\n let idx = currentIndex;\n const incremented = desiredRoots.length <= 1;\n if (incremented) {\n const base = desiredRoots[0];\n const suffix = idx++;\n name = `${base}${suffix}`;\n } else {\n name = /** @type {string} */ (desiredRoots.shift());\n }\n\n return [\n name,\n incremented,\n () => {\n return rootNamer(desiredRoots, idx);\n },\n ];\n};\n\n/* eslint-disable complexity -- Temporary */\nexport default iterateJsdoc(({\n context,\n jsdoc,\n node,\n utils,\n}) => {\n /* eslint-enable complexity -- Temporary */\n if (utils.avoidDocs()) {\n return;\n }\n\n // Param type is specified by type in @type\n if (utils.hasTag('type')) {\n return;\n }\n\n const {\n autoIncrementBase = 0,\n checkDestructured = true,\n checkDestructuredRoots = true,\n checkRestProperty = false,\n checkTypesPattern = '/^(?:[oO]bject|[aA]rray|PlainObject|Generic(?:Object|Array))$/',\n enableFixer = true,\n enableRestElementFixer = true,\n enableRootFixer = true,\n ignoreWhenAllParamsMissing = false,\n interfaceExemptsParamsCheck = false,\n unnamedRootBase = [\n 'root',\n ],\n useDefaultObjectProperties = false,\n } = context.options[0] || {};\n\n if (interfaceExemptsParamsCheck) {\n if (node && 'params' in node && node.params.length === 1 &&\n node.params?.[0] && typeof node.params[0] === 'object' &&\n node.params[0].type === 'ObjectPattern' &&\n 'typeAnnotation' in node.params[0] && node.params[0].typeAnnotation\n ) {\n return;\n }\n\n if (node && node.parent?.type === 'VariableDeclarator' &&\n 'typeAnnotation' in node.parent.id && node.parent.id.typeAnnotation) {\n return;\n }\n }\n\n const preferredTagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'param',\n }));\n if (!preferredTagName) {\n return;\n }\n\n const functionParameterNames = utils.getFunctionParameterNames(useDefaultObjectProperties);\n if (!functionParameterNames.length) {\n return;\n }\n\n const jsdocParameterNames =\n /**\n * @type {{\n * idx: import('../iterateJsdoc.js').Integer;\n * name: string;\n * type: string;\n * }[]}\n */ (utils.getJsdocTagsDeep(preferredTagName));\n\n if (ignoreWhenAllParamsMissing && !jsdocParameterNames.length) {\n return;\n }\n\n const shallowJsdocParameterNames = jsdocParameterNames.filter((tag) => {\n return !tag.name.includes('.');\n }).map((tag, idx) => {\n return {\n ...tag,\n idx,\n };\n });\n\n const checkTypesRegex = utils.getRegexFromString(checkTypesPattern);\n\n /**\n * @type {{\n * functionParameterIdx: import('../iterateJsdoc.js').Integer,\n * functionParameterName: string,\n * inc: boolean|undefined,\n * remove?: true,\n * type?: string|undefined\n * }[]}\n */\n const missingTags = [];\n const flattenedRoots = utils.flattenRoots(functionParameterNames).names;\n\n /**\n * @type {{\n * [key: string]: import('../iterateJsdoc.js').Integer\n * }}\n */\n const paramIndex = {};\n\n /**\n * @param {string} cur\n * @returns {boolean}\n */\n const hasParamIndex = (cur) => {\n return utils.dropPathSegmentQuotes(String(cur)) in paramIndex;\n };\n\n /**\n *\n * @param {string|number|undefined} cur\n * @returns {import('../iterateJsdoc.js').Integer}\n */\n const getParamIndex = (cur) => {\n return paramIndex[utils.dropPathSegmentQuotes(String(cur))];\n };\n\n /**\n *\n * @param {string} cur\n * @param {import('../iterateJsdoc.js').Integer} idx\n * @returns {void}\n */\n const setParamIndex = (cur, idx) => {\n paramIndex[utils.dropPathSegmentQuotes(String(cur))] = idx;\n };\n\n for (const [\n idx,\n cur,\n ] of flattenedRoots.entries()) {\n setParamIndex(cur, idx);\n }\n\n /**\n *\n * @param {(import('@es-joy/jsdoccomment').JsdocTagWithInline & {\n * newAdd?: boolean\n * })[]} jsdocTags\n * @param {import('../iterateJsdoc.js').Integer} indexAtFunctionParams\n * @returns {{\n * foundIndex: import('../iterateJsdoc.js').Integer,\n * tagLineCount: import('../iterateJsdoc.js').Integer,\n * }}\n */\n const findExpectedIndex = (jsdocTags, indexAtFunctionParams) => {\n // Get the parameters that come after the current index in the flattened order\n const remainingFlattenedRoots = flattenedRoots.slice((indexAtFunctionParams || 0) + 1);\n\n // Find the first existing tag that comes after the current parameter in the flattened order\n const foundIndex = jsdocTags.findIndex(({\n name,\n newAdd,\n }) => {\n if (newAdd) {\n return false;\n }\n\n // Check if the tag name matches any of the remaining flattened roots\n return remainingFlattenedRoots.some((flattenedRoot) => {\n // The flattened roots don't have the root prefix (e.g., \"bar\", \"bar.baz\")\n // but JSDoc tags do (e.g., \"root0\", \"root0.bar\", \"root0.bar.baz\")\n // So we need to check if the tag name ends with the flattened root\n\n // Check if tag name ends with \".<flattenedRoot>\"\n if (name.endsWith(`.${flattenedRoot}`)) {\n return true;\n }\n\n // Also check if tag name exactly matches the flattenedRoot\n // (for single-level params)\n if (name === flattenedRoot) {\n return true;\n }\n\n return false;\n });\n });\n\n const tags = foundIndex > -1 ?\n jsdocTags.slice(0, foundIndex) :\n jsdocTags.filter(({\n tag,\n }) => {\n return tag === preferredTagName;\n });\n\n let tagLineCount = 0;\n for (const {\n source,\n } of tags) {\n for (const {\n tokens: {\n end,\n },\n } of source) {\n if (!end) {\n tagLineCount++;\n }\n }\n }\n\n return {\n foundIndex,\n tagLineCount,\n };\n };\n\n let [\n nextRootName,\n incremented,\n namer,\n ] = rootNamer([\n ...unnamedRootBase,\n ], autoIncrementBase);\n\n const thisOffset = functionParameterNames[0] === 'this' ? 1 : 0;\n\n for (const [\n functionParameterIdx,\n functionParameterName,\n ] of functionParameterNames.entries()) {\n let inc;\n if (Array.isArray(functionParameterName)) {\n const matchedJsdoc = shallowJsdocParameterNames[functionParameterIdx - thisOffset];\n\n /** @type {string} */\n let rootName;\n if (functionParameterName[0]) {\n rootName = functionParameterName[0];\n } else if (matchedJsdoc && matchedJsdoc.name) {\n rootName = matchedJsdoc.name;\n if (matchedJsdoc.type && matchedJsdoc.type.search(checkTypesRegex) === -1) {\n continue;\n }\n } else {\n rootName = nextRootName;\n inc = incremented;\n }\n\n [\n nextRootName,\n incremented,\n namer,\n ] = namer();\n\n const {\n hasPropertyRest,\n hasRestElement,\n names,\n rests,\n } = /**\n * @type {import('../jsdocUtils.js').FlattendRootInfo & {\n * annotationParamName?: string | undefined;\n * }}\n */ (functionParameterName[1]);\n const notCheckingNames = [];\n if (!enableRestElementFixer && hasRestElement) {\n continue;\n }\n\n if (!checkDestructuredRoots) {\n continue;\n }\n\n for (const [\n idx,\n paramName,\n ] of names.entries()) {\n // Add root if the root name is not in the docs (and is not already\n // in the tags to be fixed)\n if (!jsdocParameterNames.find(({\n name,\n }) => {\n return name === rootName;\n }) && !missingTags.find(({\n functionParameterName: fpn,\n }) => {\n return fpn === rootName;\n })) {\n const emptyParamIdx = jsdocParameterNames.findIndex(({\n name,\n }) => {\n return !name;\n });\n\n if (emptyParamIdx > -1) {\n missingTags.push({\n functionParameterIdx: emptyParamIdx,\n functionParameterName: rootName,\n inc,\n remove: true,\n });\n } else {\n missingTags.push({\n functionParameterIdx: hasParamIndex(rootName) ?\n getParamIndex(rootName) :\n getParamIndex(paramName),\n functionParameterName: rootName,\n inc,\n });\n }\n }\n\n if (!checkDestructured) {\n continue;\n }\n\n if (!checkRestProperty && rests[idx]) {\n continue;\n }\n\n const fullParamName = `${rootName}.${paramName}`;\n\n const notCheckingName = jsdocParameterNames.find(({\n name,\n type: paramType,\n }) => {\n return utils.comparePaths(name)(fullParamName) && paramType.search(checkTypesRegex) === -1 && paramType !== '';\n });\n\n if (notCheckingName !== undefined) {\n notCheckingNames.push(notCheckingName.name);\n }\n\n if (notCheckingNames.find((name) => {\n return fullParamName.startsWith(name);\n })) {\n continue;\n }\n\n if (jsdocParameterNames && !jsdocParameterNames.find(({\n name,\n }) => {\n return utils.comparePaths(name)(fullParamName);\n })) {\n missingTags.push({\n functionParameterIdx: getParamIndex(\n functionParameterName[0] ? fullParamName : paramName,\n ),\n functionParameterName: fullParamName,\n inc,\n type: hasRestElement && !hasPropertyRest ? '{...any}' : undefined,\n });\n }\n }\n\n continue;\n }\n\n /** @type {string} */\n let funcParamName;\n let type;\n if (typeof functionParameterName === 'object') {\n if (!enableRestElementFixer && functionParameterName.restElement) {\n continue;\n }\n\n funcParamName = /** @type {string} */ (functionParameterName.name);\n type = '{...any}';\n } else {\n funcParamName = /** @type {string} */ (functionParameterName);\n }\n\n if (jsdocParameterNames && !jsdocParameterNames.find(({\n name,\n }) => {\n return name === funcParamName;\n }) && funcParamName !== 'this') {\n missingTags.push({\n functionParameterIdx: getParamIndex(funcParamName),\n functionParameterName: funcParamName,\n inc,\n type,\n });\n }\n }\n\n /**\n *\n * @param {{\n * functionParameterIdx: import('../iterateJsdoc.js').Integer,\n * functionParameterName: string,\n * remove?: true,\n * inc?: boolean,\n * type?: string\n * }} cfg\n */\n const fix = ({\n functionParameterIdx,\n functionParameterName,\n inc,\n remove,\n type,\n }) => {\n if (inc && !enableRootFixer) {\n return;\n }\n\n /**\n *\n * @param {import('../iterateJsdoc.js').Integer} tagIndex\n * @param {import('../iterateJsdoc.js').Integer} sourceIndex\n * @param {import('../iterateJsdoc.js').Integer} spliceCount\n * @returns {void}\n */\n const createTokens = (tagIndex, sourceIndex, spliceCount) => {\n // console.log(sourceIndex, tagIndex, jsdoc.tags, jsdoc.source);\n const tokens = {\n number: sourceIndex + 1,\n source: '',\n tokens: {\n delimiter: '*',\n description: '',\n end: '',\n lineEnd: '',\n name: functionParameterName,\n newAdd: true,\n postDelimiter: ' ',\n postName: '',\n postTag: ' ',\n postType: type ? ' ' : '',\n start: jsdoc.source[sourceIndex].tokens.start,\n tag: `@${preferredTagName}`,\n type: type ?? '',\n },\n };\n\n /**\n * @type {(import('@es-joy/jsdoccomment').JsdocTagWithInline & {\n * newAdd?: true\n * })[]}\n */ (jsdoc.tags).splice(tagIndex, spliceCount, {\n description: '',\n inlineTags: [],\n name: functionParameterName,\n newAdd: true,\n optional: false,\n problems: [],\n source: [\n tokens,\n ],\n tag: preferredTagName,\n type: type ?? '',\n });\n const firstNumber = jsdoc.source[0].number;\n jsdoc.source.splice(sourceIndex, spliceCount, tokens);\n for (const [\n idx,\n src,\n ] of jsdoc.source.slice(sourceIndex).entries()) {\n src.number = firstNumber + sourceIndex + idx;\n }\n };\n\n const offset = jsdoc.source.findIndex(({\n tokens: {\n end,\n tag,\n },\n }) => {\n return tag || end;\n });\n if (remove) {\n createTokens(functionParameterIdx, offset + functionParameterIdx, 1);\n } else {\n const {\n foundIndex,\n tagLineCount: expectedIdx,\n } =\n findExpectedIndex(jsdoc.tags, functionParameterIdx);\n\n const firstParamLine = jsdoc.source.findIndex(({\n tokens,\n }) => {\n return tokens.tag === `@${preferredTagName}`;\n });\n const baseOffset = foundIndex > -1 || firstParamLine === -1 ?\n offset :\n firstParamLine;\n\n createTokens(expectedIdx, baseOffset + expectedIdx, 0);\n }\n };\n\n /**\n * @returns {void}\n */\n const fixer = () => {\n for (const missingTag of missingTags) {\n fix(missingTag);\n }\n };\n\n if (missingTags.length && jsdoc.source.length === 1) {\n utils.makeMultiline();\n }\n\n for (const {\n functionParameterName,\n } of missingTags) {\n utils.reportJSDoc(\n `Missing JSDoc @${preferredTagName} \"${functionParameterName}\" declaration.`,\n null,\n enableFixer ? fixer : null,\n );\n }\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Requires that all function parameters are documented with a `@param` tag.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-param.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n autoIncrementBase: {\n default: 0,\n description: `Numeric to indicate the number at which to begin auto-incrementing roots.\nDefaults to \\`0\\`.`,\n type: 'integer',\n },\n checkConstructors: {\n default: true,\n description: `A value indicating whether \\`constructor\\`s should be checked. Defaults to\n\\`true\\`.`,\n type: 'boolean',\n },\n checkDestructured: {\n default: true,\n description: 'Whether to require destructured properties. Defaults to `true`.',\n type: 'boolean',\n },\n checkDestructuredRoots: {\n default: true,\n description: `Whether to check the existence of a corresponding \\`@param\\` for root objects\nof destructured properties (e.g., that for \\`function ({a, b}) {}\\`, that there\nis something like \\`@param myRootObj\\` defined that can correspond to\nthe \\`{a, b}\\` object parameter).\n\nIf \\`checkDestructuredRoots\\` is \\`false\\`, \\`checkDestructured\\` will also be\nimplied to be \\`false\\` (i.e., the inside of the roots will not be checked\neither, e.g., it will also not complain if \\`a\\` or \\`b\\` do not have their own\ndocumentation). Defaults to \\`true\\`.`,\n type: 'boolean',\n },\n checkGetters: {\n default: false,\n description: 'A value indicating whether getters should be checked. Defaults to `false`.',\n type: 'boolean',\n },\n checkRestProperty: {\n default: false,\n description: `If set to \\`true\\`, will report (and add fixer insertions) for missing rest\nproperties. Defaults to \\`false\\`.\n\nIf set to \\`true\\`, note that you can still document the subproperties of the\nrest property using other jsdoc features, e.g., \\`@typedef\\`:\n\n\\`\\`\\`js\n/**\n * @typedef ExtraOptions\n * @property innerProp1\n * @property innerProp2\n */\n\n/**\n * @param cfg\n * @param cfg.num\n * @param {ExtraOptions} extra\n */\nfunction quux ({num, ...extra}) {\n}\n\\`\\`\\`\n\nSetting this option to \\`false\\` (the default) may be useful in cases where\nyou already have separate \\`@param\\` definitions for each of the properties\nwithin the rest property.\n\nFor example, with the option disabled, this will not give an error despite\n\\`extra\\` not having any definition:\n\n\\`\\`\\`js\n/**\n * @param cfg\n * @param cfg.num\n */\nfunction quux ({num, ...extra}) {\n}\n\\`\\`\\`\n\nNor will this:\n\n\\`\\`\\`js\n/**\n * @param cfg\n * @param cfg.num\n * @param cfg.innerProp1\n * @param cfg.innerProp2\n */\nfunction quux ({num, ...extra}) {\n}\n\\`\\`\\``,\n type: 'boolean',\n },\n checkSetters: {\n default: false,\n description: 'A value indicating whether setters should be checked. Defaults to `false`.',\n type: 'boolean',\n },\n checkTypesPattern: {\n description: `When one specifies a type, unless it is of a generic type, like \\`object\\`\nor \\`array\\`, it may be considered unnecessary to have that object's\ndestructured components required, especially where generated docs will\nlink back to the specified type. For example:\n\n\\`\\`\\`js\n/**\n * @param {SVGRect} bbox - a SVGRect\n */\nexport const bboxToObj = function ({x, y, width, height}) {\n return {x, y, width, height};\n};\n\\`\\`\\`\n\nBy default \\`checkTypesPattern\\` is set to\n\\`/^(?:[oO]bject|[aA]rray|PlainObject|Generic(?:Object|Array))$/v\\`,\nmeaning that destructuring will be required only if the type of the \\`@param\\`\n(the text between curly brackets) is a match for \"Object\" or \"Array\" (with or\nwithout initial caps), \"PlainObject\", or \"GenericObject\", \"GenericArray\" (or\nif no type is present). So in the above example, the lack of a match will\nmean that no complaint will be given about the undocumented destructured\nparameters.\n\nNote that the \\`/\\` delimiters are optional, but necessary to add flags.\n\nDefaults to using (only) the \\`v\\` flag, so to add your own flags, encapsulate\nyour expression as a string, but like a literal, e.g., \\`/^object$/vi\\`.\n\nYou could set this regular expression to a more expansive list, or you\ncould restrict it such that even types matching those strings would not\nneed destructuring.`,\n type: 'string',\n },\n contexts: {\n description: `Set this to an array of strings representing the AST context (or an object with\noptional \\`context\\` and \\`comment\\` properties) where you wish the rule to be applied.\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nOverrides the default contexts (\\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`). May be useful for adding such as\n\\`TSMethodSignature\\` in TypeScript or restricting the contexts\nwhich are checked.\n\nSee the [\"AST and Selectors\"](../#advanced-ast-and-selectors)\nsection of our Advanced docs for more on the expected format.`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n enableFixer: {\n description: 'Whether to enable the fixer. Defaults to `true`.',\n type: 'boolean',\n },\n enableRestElementFixer: {\n description: `Whether to enable the rest element fixer.\n\nThe fixer will automatically report/insert\n[JSDoc repeatable parameters](https://jsdoc.app/tags-param.html#multiple-types-and-repeatable-parameters)\nif missing.\n\n\\`\\`\\`js\n/**\n * @param {GenericArray} cfg\n * @param {number} cfg.\"0\"\n */\nfunction baar ([a, ...extra]) {\n //\n}\n\\`\\`\\`\n\n...becomes:\n\n\\`\\`\\`js\n/**\n * @param {GenericArray} cfg\n * @param {number} cfg.\"0\"\n * @param {...any} cfg.\"1\"\n */\nfunction baar ([a, ...extra]) {\n //\n}\n\\`\\`\\`\n\nNote that the type \\`any\\` is included since we don't know of any specific\ntype to use.\n\nDefaults to \\`true\\`.`,\n type: 'boolean',\n },\n enableRootFixer: {\n description: `Whether to enable the auto-adding of incrementing roots.\n\nThe default behavior of \\`true\\` is for \"root\" to be auto-inserted for missing\nroots, followed by a 0-based auto-incrementing number.\n\nSo for:\n\n\\`\\`\\`js\nfunction quux ({foo}, {bar}, {baz}) {\n}\n\\`\\`\\`\n\n...the default JSDoc that would be added if the fixer is enabled would be:\n\n\\`\\`\\`js\n/**\n* @param root0\n* @param root0.foo\n* @param root1\n* @param root1.bar\n* @param root2\n* @param root2.baz\n*/\n\\`\\`\\`\n\nHas no effect if \\`enableFixer\\` is set to \\`false\\`.`,\n type: 'boolean',\n },\n exemptedBy: {\n description: `Array of tags (e.g., \\`['type']\\`) whose presence on the document block\navoids the need for a \\`@param\\`. Defaults to an array with\n\\`inheritdoc\\`. If you set this array, it will overwrite the default,\nso be sure to add back \\`inheritdoc\\` if you wish its presence to cause\nexemption of the rule.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n ignoreWhenAllParamsMissing: {\n description: `Set to \\`true\\` to ignore reporting when all params are missing. Defaults to\n\\`false\\`.`,\n type: 'boolean',\n },\n interfaceExemptsParamsCheck: {\n description: `Set if you wish TypeScript interfaces to exempt checks for the existence of\n\\`@param\\`'s.\n\nWill check for a type defining the function itself (on a variable\ndeclaration) or if there is a single destructured object with a type.\nDefaults to \\`false\\`.`,\n type: 'boolean',\n },\n unnamedRootBase: {\n description: `An array of root names to use in the fixer when roots are missing. Defaults\nto \\`['root']\\`. Note that only when all items in the array besides the last\nare exhausted will auto-incrementing occur. So, with\n\\`unnamedRootBase: ['arg', 'config']\\`, the following:\n\n\\`\\`\\`js\nfunction quux ({foo}, [bar], {baz}) {\n}\n\\`\\`\\`\n\n...will get the following JSDoc block added:\n\n\\`\\`\\`js\n/**\n* @param arg\n* @param arg.foo\n* @param config0\n* @param config0.\"0\" (\\`bar\\`)\n* @param config1\n* @param config1.baz\n*/\n\\`\\`\\``,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n useDefaultObjectProperties: {\n description: `Set to \\`true\\` if you wish to expect documentation of properties on objects\nsupplied as default values. Defaults to \\`false\\`.`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n\n // We cannot cache comment nodes as the contexts may recur with the\n // same comment node but a different JS node, and we may need the different\n // JS node to ensure we iterate its context\n noTracking: true,\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAMG,SAAS,GAAGA,CAACC,YAAY,EAAEC,YAAY,KAAK;EAChD;EACA,IAAIC,IAAI;EACR,IAAIC,GAAG,GAAGF,YAAY;EACtB,MAAMG,WAAW,GAAGJ,YAAY,CAACK,MAAM,IAAI,CAAC;EAC5C,IAAID,WAAW,EAAE;IACf,MAAME,IAAI,GAAGN,YAAY,CAAC,CAAC,CAAC;IAC5B,MAAMO,MAAM,GAAGJ,GAAG,EAAE;IACpBD,IAAI,GAAG,GAAGI,IAAI,GAAGC,MAAM,EAAE;EAC3B,CAAC,MAAM;IACLL,IAAI,GAAG,qBAAuBF,YAAY,CAACQ,KAAK,CAAC,CAAE;EACrD;EAEA,OAAO,CACLN,IAAI,EACJE,WAAW,EACX,MAAM;IACJ,OAAOL,SAAS,CAACC,YAAY,EAAEG,GAAG,CAAC;EACrC,CAAC,CACF;AACH,CAAC;;AAED;AAAA,IAAAM,QAAA,GAAAC,OAAA,CAAAZ,OAAA,GACe,IAAAa,qBAAY,EAAC,CAAC;EAC3BC,OAAO;EACPC,KAAK;EACLC,IAAI;EACJC;AACF,CAAC,KAAK;EACJ;EACA,IAAIA,KAAK,CAACC,SAAS,CAAC,CAAC,EAAE;IACrB;EACF;;EAEA;EACA,IAAID,KAAK,CAACE,MAAM,CAAC,MAAM,CAAC,EAAE;IACxB;EACF;EA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,GAAG,EAAE;IACP,CAAC;IACDC,OAAO,EAAE,MAAM;IACfC,MAAM,EAAE,CACN;MACEC,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE;QACV5H,iBAAiB,EAAE;UACjBpB,OAAO,EAAE,CAAC;UACVoH,WAAW,EAAE;AACzB,mBAAmB;UACPlF,IAAI,EAAE;QACR,CAAC;QACD+G,iBAAiB,EAAE;UACjBjJ,OAAO,EAAE,IAAI;UACboH,WAAW,EAAE;AACzB,UAAU;UACElF,IAAI,EAAE;QACR,CAAC;QACDb,iBAAiB,EAAE;UACjBrB,OAAO,EAAE,IAAI;UACboH,WAAW,EAAE,iEAAiE;UAC9ElF,IAAI,EAAE;QACR,CAAC;QACDZ,sBAAsB,EAAE;UACtBtB,OAAO,EAAE,IAAI;UACboH,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC;UAC1BlF,IAAI,EAAE;QACR,CAAC;QACDgH,YAAY,EAAE;UACZlJ,OAAO,EAAE,KAAK;UACdoH,WAAW,EAAE,4EAA4E;UACzFlF,IAAI,EAAE;QACR,CAAC;QACDX,iBAAiB,EAAE;UACjBvB,OAAO,EAAE,KAAK;UACdoH,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;UACKlF,IAAI,EAAE;QACR,CAAC;QACDiH,YAAY,EAAE;UACZnJ,OAAO,EAAE,KAAK;UACdoH,WAAW,EAAE,4EAA4E;UACzFlF,IAAI,EAAE;QACR,CAAC;QACDV,iBAAiB,EAAE;UACjB4F,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;UACRlF,IAAI,EAAE;QACR,CAAC;QACDkH,QAAQ,EAAE;UACRhC,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D;UAClDiC,KAAK,EAAE;YACLC,KAAK,EAAE,CACL;cACEpH,IAAI,EAAE;YACR,CAAC,EACD;cACE6G,oBAAoB,EAAE,KAAK;cAC3BC,UAAU,EAAE;gBACVO,OAAO,EAAE;kBACPrH,IAAI,EAAE;gBACR,CAAC;gBACDpB,OAAO,EAAE;kBACPoB,IAAI,EAAE;gBACR;cACF,CAAC;cACDA,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDT,WAAW,EAAE;UACX2F,WAAW,EAAE,kDAAkD;UAC/DlF,IAAI,EAAE;QACR,CAAC;QACDR,sBAAsB,EAAE;UACtB0F,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;UACVlF,IAAI,EAAE;QACR,CAAC;QACDP,eAAe,EAAE;UACfyF,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD;UAC1ClF,IAAI,EAAE;QACR,CAAC;QACDsH,UAAU,EAAE;UACVpC,WAAW,EAAE;AACzB;AACA;AACA;AACA,uBAAuB;UACXiC,KAAK,EAAE;YACLnH,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDN,0BAA0B,EAAE;UAC1BwF,WAAW,EAAE;AACzB,WAAW;UACClF,IAAI,EAAE;QACR,CAAC;QACDL,2BAA2B,EAAE;UAC3BuF,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA,uBAAuB;UACXlF,IAAI,EAAE;QACR,CAAC;QACDJ,eAAe,EAAE;UACfsF,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;UACKiC,KAAK,EAAE;YACLnH,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDH,0BAA0B,EAAE;UAC1BqF,WAAW,EAAE;AACzB,mDAAmD;UACvClF,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR,CAAC;EAED;EACA;EACA;EACAuH,UAAU,EAAE;AACd,CAAC,CAAC;AAAAC,MAAA,CAAA9I,OAAA,GAAAA,OAAA,CAAAZ,OAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"requireParam.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","rootNamer","desiredRoots","currentIndex","name","idx","incremented","length","base","suffix","shift","_default","exports","iterateJsdoc","context","jsdoc","node","utils","avoidDocs","hasTag","autoIncrementBase","checkDestructured","checkDestructuredRoots","checkRestProperty","checkTypesPattern","enableFixer","enableRestElementFixer","enableRootFixer","ignoreWhenAllParamsMissing","interfaceExemptsParamsCheck","unnamedRootBase","useDefaultObjectProperties","options","parent","type","id","typeAnnotation","preferredTagName","getPreferredTagName","tagName","functionParameterNames","getFunctionParameterNames","jsdocParameterNames","getJsdocTagsDeep","shallowJsdocParameterNames","filter","tag","includes","map","checkTypesRegex","getRegexFromString","missingTags","flattenedRoots","flattenRoots","names","paramIndex","hasParamIndex","cur","dropPathSegmentQuotes","String","getParamIndex","setParamIndex","entries","findExpectedIndex","jsdocTags","indexAtFunctionParams","remainingFlattenedRoots","slice","foundIndex","findIndex","newAdd","some","flattenedRoot","endsWith","tags","tagLineCount","source","tokens","end","nextRootName","namer","thisOffset","functionParameterIdx","functionParameterName","inc","Array","isArray","matchedJsdoc","rootName","search","hasPropertyRest","hasRestElement","rests","notCheckingNames","paramName","find","fpn","emptyParamIdx","push","remove","fullParamName","notCheckingName","paramType","comparePaths","undefined","startsWith","funcParamName","restElement","fix","createTokens","tagIndex","sourceIndex","spliceCount","number","delimiter","description","lineEnd","postDelimiter","postName","postTag","postType","start","splice","inlineTags","optional","problems","firstNumber","src","offset","expectedIdx","firstParamLine","baseOffset","fixer","missingTag","makeMultiline","reportJSDoc","contextDefaults","meta","docs","url","fixable","schema","additionalProperties","properties","checkConstructors","checkGetters","checkSetters","contexts","items","anyOf","comment","exemptedBy","noTracking","module"],"sources":["../../src/rules/requireParam.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * @typedef {[string, boolean, () => RootNamerReturn]} RootNamerReturn\n */\n\n/**\n * @param {string[]} desiredRoots\n * @param {number} currentIndex\n * @returns {RootNamerReturn}\n */\nconst rootNamer = (desiredRoots, currentIndex) => {\n /** @type {string} */\n let name;\n let idx = currentIndex;\n const incremented = desiredRoots.length <= 1;\n if (incremented) {\n const base = desiredRoots[0];\n const suffix = idx++;\n name = `${base}${suffix}`;\n } else {\n name = /** @type {string} */ (desiredRoots.shift());\n }\n\n return [\n name,\n incremented,\n () => {\n return rootNamer(desiredRoots, idx);\n },\n ];\n};\n\n/* eslint-disable complexity -- Temporary */\nexport default iterateJsdoc(({\n context,\n jsdoc,\n node,\n utils,\n}) => {\n /* eslint-enable complexity -- Temporary */\n if (utils.avoidDocs()) {\n return;\n }\n\n // Param type is specified by type in @type\n if (utils.hasTag('type')) {\n return;\n }\n\n const {\n autoIncrementBase = 0,\n checkDestructured = true,\n checkDestructuredRoots = true,\n checkRestProperty = false,\n checkTypesPattern = '/^(?:[oO]bject|[aA]rray|PlainObject|Generic(?:Object|Array))$/',\n enableFixer = true,\n enableRestElementFixer = true,\n enableRootFixer = true,\n ignoreWhenAllParamsMissing = false,\n interfaceExemptsParamsCheck = false,\n unnamedRootBase = [\n 'root',\n ],\n useDefaultObjectProperties = false,\n } = context.options[0] || {};\n\n if (interfaceExemptsParamsCheck && node &&\n node.parent?.type === 'VariableDeclarator' &&\n 'typeAnnotation' in node.parent.id && node.parent.id.typeAnnotation) {\n return;\n }\n\n const preferredTagName = /** @type {string} */ (utils.getPreferredTagName({\n tagName: 'param',\n }));\n if (!preferredTagName) {\n return;\n }\n\n const functionParameterNames = utils.getFunctionParameterNames(useDefaultObjectProperties, interfaceExemptsParamsCheck);\n if (!functionParameterNames.length) {\n return;\n }\n\n const jsdocParameterNames =\n /**\n * @type {{\n * idx: import('../iterateJsdoc.js').Integer;\n * name: string;\n * type: string;\n * }[]}\n */ (utils.getJsdocTagsDeep(preferredTagName));\n\n if (ignoreWhenAllParamsMissing && !jsdocParameterNames.length) {\n return;\n }\n\n const shallowJsdocParameterNames = jsdocParameterNames.filter((tag) => {\n return !tag.name.includes('.');\n }).map((tag, idx) => {\n return {\n ...tag,\n idx,\n };\n });\n\n const checkTypesRegex = utils.getRegexFromString(checkTypesPattern);\n\n /**\n * @type {{\n * functionParameterIdx: import('../iterateJsdoc.js').Integer,\n * functionParameterName: string,\n * inc: boolean|undefined,\n * remove?: true,\n * type?: string|undefined\n * }[]}\n */\n const missingTags = [];\n const flattenedRoots = utils.flattenRoots(functionParameterNames).names;\n\n /**\n * @type {{\n * [key: string]: import('../iterateJsdoc.js').Integer\n * }}\n */\n const paramIndex = {};\n\n /**\n * @param {string} cur\n * @returns {boolean}\n */\n const hasParamIndex = (cur) => {\n return utils.dropPathSegmentQuotes(String(cur)) in paramIndex;\n };\n\n /**\n *\n * @param {string|number|undefined} cur\n * @returns {import('../iterateJsdoc.js').Integer}\n */\n const getParamIndex = (cur) => {\n return paramIndex[utils.dropPathSegmentQuotes(String(cur))];\n };\n\n /**\n *\n * @param {string} cur\n * @param {import('../iterateJsdoc.js').Integer} idx\n * @returns {void}\n */\n const setParamIndex = (cur, idx) => {\n paramIndex[utils.dropPathSegmentQuotes(String(cur))] = idx;\n };\n\n for (const [\n idx,\n cur,\n ] of flattenedRoots.entries()) {\n setParamIndex(cur, idx);\n }\n\n /**\n *\n * @param {(import('@es-joy/jsdoccomment').JsdocTagWithInline & {\n * newAdd?: boolean\n * })[]} jsdocTags\n * @param {import('../iterateJsdoc.js').Integer} indexAtFunctionParams\n * @returns {{\n * foundIndex: import('../iterateJsdoc.js').Integer,\n * tagLineCount: import('../iterateJsdoc.js').Integer,\n * }}\n */\n const findExpectedIndex = (jsdocTags, indexAtFunctionParams) => {\n // Get the parameters that come after the current index in the flattened order\n const remainingFlattenedRoots = flattenedRoots.slice((indexAtFunctionParams || 0) + 1);\n\n // Find the first existing tag that comes after the current parameter in the flattened order\n const foundIndex = jsdocTags.findIndex(({\n name,\n newAdd,\n }) => {\n if (newAdd) {\n return false;\n }\n\n // Check if the tag name matches any of the remaining flattened roots\n return remainingFlattenedRoots.some((flattenedRoot) => {\n // The flattened roots don't have the root prefix (e.g., \"bar\", \"bar.baz\")\n // but JSDoc tags do (e.g., \"root0\", \"root0.bar\", \"root0.bar.baz\")\n // So we need to check if the tag name ends with the flattened root\n\n // Check if tag name ends with \".<flattenedRoot>\"\n if (name.endsWith(`.${flattenedRoot}`)) {\n return true;\n }\n\n // Also check if tag name exactly matches the flattenedRoot\n // (for single-level params)\n if (name === flattenedRoot) {\n return true;\n }\n\n return false;\n });\n });\n\n const tags = foundIndex > -1 ?\n jsdocTags.slice(0, foundIndex) :\n jsdocTags.filter(({\n tag,\n }) => {\n return tag === preferredTagName;\n });\n\n let tagLineCount = 0;\n for (const {\n source,\n } of tags) {\n for (const {\n tokens: {\n end,\n },\n } of source) {\n if (!end) {\n tagLineCount++;\n }\n }\n }\n\n return {\n foundIndex,\n tagLineCount,\n };\n };\n\n let [\n nextRootName,\n incremented,\n namer,\n ] = rootNamer([\n ...unnamedRootBase,\n ], autoIncrementBase);\n\n const thisOffset = functionParameterNames[0] === 'this' ? 1 : 0;\n\n for (const [\n functionParameterIdx,\n functionParameterName,\n ] of functionParameterNames.entries()) {\n let inc;\n if (Array.isArray(functionParameterName)) {\n const matchedJsdoc = shallowJsdocParameterNames[functionParameterIdx - thisOffset];\n\n /** @type {string} */\n let rootName;\n if (functionParameterName[0]) {\n rootName = functionParameterName[0];\n } else if (matchedJsdoc && matchedJsdoc.name) {\n rootName = matchedJsdoc.name;\n if (matchedJsdoc.type && matchedJsdoc.type.search(checkTypesRegex) === -1) {\n continue;\n }\n } else {\n rootName = nextRootName;\n inc = incremented;\n }\n\n [\n nextRootName,\n incremented,\n namer,\n ] = namer();\n\n const {\n hasPropertyRest,\n hasRestElement,\n names,\n rests,\n } = /**\n * @type {import('../jsdocUtils.js').FlattendRootInfo & {\n * annotationParamName?: string | undefined;\n * }}\n */ (functionParameterName[1]);\n const notCheckingNames = [];\n if (!enableRestElementFixer && hasRestElement) {\n continue;\n }\n\n if (!checkDestructuredRoots) {\n continue;\n }\n\n for (const [\n idx,\n paramName,\n ] of names.entries()) {\n // Add root if the root name is not in the docs (and is not already\n // in the tags to be fixed)\n if (!jsdocParameterNames.find(({\n name,\n }) => {\n return name === rootName;\n }) && !missingTags.find(({\n functionParameterName: fpn,\n }) => {\n return fpn === rootName;\n })) {\n const emptyParamIdx = jsdocParameterNames.findIndex(({\n name,\n }) => {\n return !name;\n });\n\n if (emptyParamIdx > -1) {\n missingTags.push({\n functionParameterIdx: emptyParamIdx,\n functionParameterName: rootName,\n inc,\n remove: true,\n });\n } else {\n missingTags.push({\n functionParameterIdx: hasParamIndex(rootName) ?\n getParamIndex(rootName) :\n getParamIndex(paramName),\n functionParameterName: rootName,\n inc,\n });\n }\n }\n\n if (!checkDestructured) {\n continue;\n }\n\n if (!checkRestProperty && rests[idx]) {\n continue;\n }\n\n const fullParamName = `${rootName}.${paramName}`;\n\n const notCheckingName = jsdocParameterNames.find(({\n name,\n type: paramType,\n }) => {\n return utils.comparePaths(name)(fullParamName) && paramType.search(checkTypesRegex) === -1 && paramType !== '';\n });\n\n if (notCheckingName !== undefined) {\n notCheckingNames.push(notCheckingName.name);\n }\n\n if (notCheckingNames.find((name) => {\n return fullParamName.startsWith(name);\n })) {\n continue;\n }\n\n if (jsdocParameterNames && !jsdocParameterNames.find(({\n name,\n }) => {\n return utils.comparePaths(name)(fullParamName);\n })) {\n missingTags.push({\n functionParameterIdx: getParamIndex(\n functionParameterName[0] ? fullParamName : paramName,\n ),\n functionParameterName: fullParamName,\n inc,\n type: hasRestElement && !hasPropertyRest ? '{...any}' : undefined,\n });\n }\n }\n\n continue;\n }\n\n /** @type {string} */\n let funcParamName;\n let type;\n if (typeof functionParameterName === 'object') {\n if (!enableRestElementFixer && functionParameterName.restElement) {\n continue;\n }\n\n funcParamName = /** @type {string} */ (functionParameterName.name);\n type = '{...any}';\n } else {\n funcParamName = /** @type {string} */ (functionParameterName);\n }\n\n if (jsdocParameterNames && !jsdocParameterNames.find(({\n name,\n }) => {\n return name === funcParamName;\n }) && funcParamName !== 'this') {\n missingTags.push({\n functionParameterIdx: getParamIndex(funcParamName),\n functionParameterName: funcParamName,\n inc,\n type,\n });\n }\n }\n\n /**\n *\n * @param {{\n * functionParameterIdx: import('../iterateJsdoc.js').Integer,\n * functionParameterName: string,\n * remove?: true,\n * inc?: boolean,\n * type?: string\n * }} cfg\n */\n const fix = ({\n functionParameterIdx,\n functionParameterName,\n inc,\n remove,\n type,\n }) => {\n if (inc && !enableRootFixer) {\n return;\n }\n\n /**\n *\n * @param {import('../iterateJsdoc.js').Integer} tagIndex\n * @param {import('../iterateJsdoc.js').Integer} sourceIndex\n * @param {import('../iterateJsdoc.js').Integer} spliceCount\n * @returns {void}\n */\n const createTokens = (tagIndex, sourceIndex, spliceCount) => {\n // console.log(sourceIndex, tagIndex, jsdoc.tags, jsdoc.source);\n const tokens = {\n number: sourceIndex + 1,\n source: '',\n tokens: {\n delimiter: '*',\n description: '',\n end: '',\n lineEnd: '',\n name: functionParameterName,\n newAdd: true,\n postDelimiter: ' ',\n postName: '',\n postTag: ' ',\n postType: type ? ' ' : '',\n start: jsdoc.source[sourceIndex].tokens.start,\n tag: `@${preferredTagName}`,\n type: type ?? '',\n },\n };\n\n /**\n * @type {(import('@es-joy/jsdoccomment').JsdocTagWithInline & {\n * newAdd?: true\n * })[]}\n */ (jsdoc.tags).splice(tagIndex, spliceCount, {\n description: '',\n inlineTags: [],\n name: functionParameterName,\n newAdd: true,\n optional: false,\n problems: [],\n source: [\n tokens,\n ],\n tag: preferredTagName,\n type: type ?? '',\n });\n const firstNumber = jsdoc.source[0].number;\n jsdoc.source.splice(sourceIndex, spliceCount, tokens);\n for (const [\n idx,\n src,\n ] of jsdoc.source.slice(sourceIndex).entries()) {\n src.number = firstNumber + sourceIndex + idx;\n }\n };\n\n const offset = jsdoc.source.findIndex(({\n tokens: {\n end,\n tag,\n },\n }) => {\n return tag || end;\n });\n if (remove) {\n createTokens(functionParameterIdx, offset + functionParameterIdx, 1);\n } else {\n const {\n foundIndex,\n tagLineCount: expectedIdx,\n } =\n findExpectedIndex(jsdoc.tags, functionParameterIdx);\n\n const firstParamLine = jsdoc.source.findIndex(({\n tokens,\n }) => {\n return tokens.tag === `@${preferredTagName}`;\n });\n const baseOffset = foundIndex > -1 || firstParamLine === -1 ?\n offset :\n firstParamLine;\n\n createTokens(expectedIdx, baseOffset + expectedIdx, 0);\n }\n };\n\n /**\n * @returns {void}\n */\n const fixer = () => {\n for (const missingTag of missingTags) {\n fix(missingTag);\n }\n };\n\n if (missingTags.length && jsdoc.source.length === 1) {\n utils.makeMultiline();\n }\n\n for (const {\n functionParameterName,\n } of missingTags) {\n utils.reportJSDoc(\n `Missing JSDoc @${preferredTagName} \"${functionParameterName}\" declaration.`,\n null,\n enableFixer ? fixer : null,\n );\n }\n}, {\n contextDefaults: true,\n meta: {\n docs: {\n description: 'Requires that all function parameters are documented with a `@param` tag.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/require-param.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n additionalProperties: false,\n properties: {\n autoIncrementBase: {\n default: 0,\n description: `Numeric to indicate the number at which to begin auto-incrementing roots.\nDefaults to \\`0\\`.`,\n type: 'integer',\n },\n checkConstructors: {\n default: true,\n description: `A value indicating whether \\`constructor\\`s should be checked. Defaults to\n\\`true\\`.`,\n type: 'boolean',\n },\n checkDestructured: {\n default: true,\n description: 'Whether to require destructured properties. Defaults to `true`.',\n type: 'boolean',\n },\n checkDestructuredRoots: {\n default: true,\n description: `Whether to check the existence of a corresponding \\`@param\\` for root objects\nof destructured properties (e.g., that for \\`function ({a, b}) {}\\`, that there\nis something like \\`@param myRootObj\\` defined that can correspond to\nthe \\`{a, b}\\` object parameter).\n\nIf \\`checkDestructuredRoots\\` is \\`false\\`, \\`checkDestructured\\` will also be\nimplied to be \\`false\\` (i.e., the inside of the roots will not be checked\neither, e.g., it will also not complain if \\`a\\` or \\`b\\` do not have their own\ndocumentation). Defaults to \\`true\\`.`,\n type: 'boolean',\n },\n checkGetters: {\n default: false,\n description: 'A value indicating whether getters should be checked. Defaults to `false`.',\n type: 'boolean',\n },\n checkRestProperty: {\n default: false,\n description: `If set to \\`true\\`, will report (and add fixer insertions) for missing rest\nproperties. Defaults to \\`false\\`.\n\nIf set to \\`true\\`, note that you can still document the subproperties of the\nrest property using other jsdoc features, e.g., \\`@typedef\\`:\n\n\\`\\`\\`js\n/**\n * @typedef ExtraOptions\n * @property innerProp1\n * @property innerProp2\n */\n\n/**\n * @param cfg\n * @param cfg.num\n * @param {ExtraOptions} extra\n */\nfunction quux ({num, ...extra}) {\n}\n\\`\\`\\`\n\nSetting this option to \\`false\\` (the default) may be useful in cases where\nyou already have separate \\`@param\\` definitions for each of the properties\nwithin the rest property.\n\nFor example, with the option disabled, this will not give an error despite\n\\`extra\\` not having any definition:\n\n\\`\\`\\`js\n/**\n * @param cfg\n * @param cfg.num\n */\nfunction quux ({num, ...extra}) {\n}\n\\`\\`\\`\n\nNor will this:\n\n\\`\\`\\`js\n/**\n * @param cfg\n * @param cfg.num\n * @param cfg.innerProp1\n * @param cfg.innerProp2\n */\nfunction quux ({num, ...extra}) {\n}\n\\`\\`\\``,\n type: 'boolean',\n },\n checkSetters: {\n default: false,\n description: 'A value indicating whether setters should be checked. Defaults to `false`.',\n type: 'boolean',\n },\n checkTypesPattern: {\n description: `When one specifies a type, unless it is of a generic type, like \\`object\\`\nor \\`array\\`, it may be considered unnecessary to have that object's\ndestructured components required, especially where generated docs will\nlink back to the specified type. For example:\n\n\\`\\`\\`js\n/**\n * @param {SVGRect} bbox - a SVGRect\n */\nexport const bboxToObj = function ({x, y, width, height}) {\n return {x, y, width, height};\n};\n\\`\\`\\`\n\nBy default \\`checkTypesPattern\\` is set to\n\\`/^(?:[oO]bject|[aA]rray|PlainObject|Generic(?:Object|Array))$/v\\`,\nmeaning that destructuring will be required only if the type of the \\`@param\\`\n(the text between curly brackets) is a match for \"Object\" or \"Array\" (with or\nwithout initial caps), \"PlainObject\", or \"GenericObject\", \"GenericArray\" (or\nif no type is present). So in the above example, the lack of a match will\nmean that no complaint will be given about the undocumented destructured\nparameters.\n\nNote that the \\`/\\` delimiters are optional, but necessary to add flags.\n\nDefaults to using (only) the \\`v\\` flag, so to add your own flags, encapsulate\nyour expression as a string, but like a literal, e.g., \\`/^object$/vi\\`.\n\nYou could set this regular expression to a more expansive list, or you\ncould restrict it such that even types matching those strings would not\nneed destructuring.`,\n type: 'string',\n },\n contexts: {\n description: `Set this to an array of strings representing the AST context (or an object with\noptional \\`context\\` and \\`comment\\` properties) where you wish the rule to be applied.\n\n\\`context\\` defaults to \\`any\\` and \\`comment\\` defaults to no specific comment context.\n\nOverrides the default contexts (\\`ArrowFunctionExpression\\`, \\`FunctionDeclaration\\`,\n\\`FunctionExpression\\`). May be useful for adding such as\n\\`TSMethodSignature\\` in TypeScript or restricting the contexts\nwhich are checked.\n\nSee the [\"AST and Selectors\"](../#advanced-ast-and-selectors)\nsection of our Advanced docs for more on the expected format.`,\n items: {\n anyOf: [\n {\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n comment: {\n type: 'string',\n },\n context: {\n type: 'string',\n },\n },\n type: 'object',\n },\n ],\n },\n type: 'array',\n },\n enableFixer: {\n description: 'Whether to enable the fixer. Defaults to `true`.',\n type: 'boolean',\n },\n enableRestElementFixer: {\n description: `Whether to enable the rest element fixer.\n\nThe fixer will automatically report/insert\n[JSDoc repeatable parameters](https://jsdoc.app/tags-param.html#multiple-types-and-repeatable-parameters)\nif missing.\n\n\\`\\`\\`js\n/**\n * @param {GenericArray} cfg\n * @param {number} cfg.\"0\"\n */\nfunction baar ([a, ...extra]) {\n //\n}\n\\`\\`\\`\n\n...becomes:\n\n\\`\\`\\`js\n/**\n * @param {GenericArray} cfg\n * @param {number} cfg.\"0\"\n * @param {...any} cfg.\"1\"\n */\nfunction baar ([a, ...extra]) {\n //\n}\n\\`\\`\\`\n\nNote that the type \\`any\\` is included since we don't know of any specific\ntype to use.\n\nDefaults to \\`true\\`.`,\n type: 'boolean',\n },\n enableRootFixer: {\n description: `Whether to enable the auto-adding of incrementing roots.\n\nThe default behavior of \\`true\\` is for \"root\" to be auto-inserted for missing\nroots, followed by a 0-based auto-incrementing number.\n\nSo for:\n\n\\`\\`\\`js\nfunction quux ({foo}, {bar}, {baz}) {\n}\n\\`\\`\\`\n\n...the default JSDoc that would be added if the fixer is enabled would be:\n\n\\`\\`\\`js\n/**\n* @param root0\n* @param root0.foo\n* @param root1\n* @param root1.bar\n* @param root2\n* @param root2.baz\n*/\n\\`\\`\\`\n\nHas no effect if \\`enableFixer\\` is set to \\`false\\`.`,\n type: 'boolean',\n },\n exemptedBy: {\n description: `Array of tags (e.g., \\`['type']\\`) whose presence on the document block\navoids the need for a \\`@param\\`. Defaults to an array with\n\\`inheritdoc\\`. If you set this array, it will overwrite the default,\nso be sure to add back \\`inheritdoc\\` if you wish its presence to cause\nexemption of the rule.`,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n ignoreWhenAllParamsMissing: {\n description: `Set to \\`true\\` to ignore reporting when all params are missing. Defaults to\n\\`false\\`.`,\n type: 'boolean',\n },\n interfaceExemptsParamsCheck: {\n description: `Set if you wish TypeScript interfaces to exempt checks for the existence of\n\\`@param\\`'s.\n\nWill check for a type defining the function itself (on a variable\ndeclaration) or if there is a single destructured object with a type.\nDefaults to \\`false\\`.`,\n type: 'boolean',\n },\n unnamedRootBase: {\n description: `An array of root names to use in the fixer when roots are missing. Defaults\nto \\`['root']\\`. Note that only when all items in the array besides the last\nare exhausted will auto-incrementing occur. So, with\n\\`unnamedRootBase: ['arg', 'config']\\`, the following:\n\n\\`\\`\\`js\nfunction quux ({foo}, [bar], {baz}) {\n}\n\\`\\`\\`\n\n...will get the following JSDoc block added:\n\n\\`\\`\\`js\n/**\n* @param arg\n* @param arg.foo\n* @param config0\n* @param config0.\"0\" (\\`bar\\`)\n* @param config1\n* @param config1.baz\n*/\n\\`\\`\\``,\n items: {\n type: 'string',\n },\n type: 'array',\n },\n useDefaultObjectProperties: {\n description: `Set to \\`true\\` if you wish to expect documentation of properties on objects\nsupplied as default values. Defaults to \\`false\\`.`,\n type: 'boolean',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n\n // We cannot cache comment nodes as the contexts may recur with the\n // same comment node but a different JS node, and we may need the different\n // JS node to ensure we iterate its context\n noTracking: true,\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9C;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAMG,SAAS,GAAGA,CAACC,YAAY,EAAEC,YAAY,KAAK;EAChD;EACA,IAAIC,IAAI;EACR,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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;UACKjF,IAAI,EAAE;QACR,CAAC;QACDgH,YAAY,EAAE;UACZlJ,OAAO,EAAE,KAAK;UACdmH,WAAW,EAAE,4EAA4E;UACzFjF,IAAI,EAAE;QACR,CAAC;QACDV,iBAAiB,EAAE;UACjB2F,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;UACRjF,IAAI,EAAE;QACR,CAAC;QACDiH,QAAQ,EAAE;UACRhC,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8DAA8D;UAClDiC,KAAK,EAAE;YACLC,KAAK,EAAE,CACL;cACEnH,IAAI,EAAE;YACR,CAAC,EACD;cACE4G,oBAAoB,EAAE,KAAK;cAC3BC,UAAU,EAAE;gBACVO,OAAO,EAAE;kBACPpH,IAAI,EAAE;gBACR,CAAC;gBACDpB,OAAO,EAAE;kBACPoB,IAAI,EAAE;gBACR;cACF,CAAC;cACDA,IAAI,EAAE;YACR,CAAC;UAEL,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDT,WAAW,EAAE;UACX0F,WAAW,EAAE,kDAAkD;UAC/DjF,IAAI,EAAE;QACR,CAAC;QACDR,sBAAsB,EAAE;UACtByF,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;UACVjF,IAAI,EAAE;QACR,CAAC;QACDP,eAAe,EAAE;UACfwF,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD;UAC1CjF,IAAI,EAAE;QACR,CAAC;QACDqH,UAAU,EAAE;UACVpC,WAAW,EAAE;AACzB;AACA;AACA;AACA,uBAAuB;UACXiC,KAAK,EAAE;YACLlH,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDN,0BAA0B,EAAE;UAC1BuF,WAAW,EAAE;AACzB,WAAW;UACCjF,IAAI,EAAE;QACR,CAAC;QACDL,2BAA2B,EAAE;UAC3BsF,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA,uBAAuB;UACXjF,IAAI,EAAE;QACR,CAAC;QACDJ,eAAe,EAAE;UACfqF,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;UACKiC,KAAK,EAAE;YACLlH,IAAI,EAAE;UACR,CAAC;UACDA,IAAI,EAAE;QACR,CAAC;QACDH,0BAA0B,EAAE;UAC1BoF,WAAW,EAAE;AACzB,mDAAmD;UACvCjF,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR,CAAC;EAED;EACA;EACA;EACAsH,UAAU,EAAE;AACd,CAAC,CAAC;AAAAC,MAAA,CAAA7I,OAAA,GAAAA,OAAA,CAAAZ,OAAA","ignoreList":[]}
|
package/dist/rules/tagLines.cjs
CHANGED
|
@@ -36,15 +36,16 @@ const checkMaxBlockLines = ({
|
|
|
36
36
|
utils.reportJSDoc(`Expected a maximum of ${maxBlockLines} line${maxBlockLines === 1 ? '' : 's'} within block description`, {
|
|
37
37
|
line: excessIndexLine
|
|
38
38
|
}, () => {
|
|
39
|
-
utils.setBlockDescription((info, seedTokens, descLines) => {
|
|
40
|
-
|
|
39
|
+
utils.setBlockDescription((info, seedTokens, descLines, postDelims) => {
|
|
40
|
+
const newPostDelims = [...postDelims.slice(0, excessIndexLine), ...postDelims.slice(excessIndexLine + excessBlockLines - 1 - maxBlockLines)];
|
|
41
|
+
return [...descLines.slice(0, excessIndexLine), ...descLines.slice(excessIndexLine + excessBlockLines - 1 - maxBlockLines)].map((desc, idx) => {
|
|
41
42
|
return {
|
|
42
43
|
number: 0,
|
|
43
44
|
source: '',
|
|
44
45
|
tokens: seedTokens({
|
|
45
46
|
...info,
|
|
46
47
|
description: desc,
|
|
47
|
-
postDelimiter:
|
|
48
|
+
postDelimiter: newPostDelims[idx]
|
|
48
49
|
})
|
|
49
50
|
};
|
|
50
51
|
});
|
|
@@ -225,15 +226,15 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
225
226
|
utils.reportJSDoc(`Expected only ${startLines} line${startLines === 1 ? '' : 's'} after block description`, {
|
|
226
227
|
line: lastDescriptionLine - trailingDiff
|
|
227
228
|
}, () => {
|
|
228
|
-
utils.setBlockDescription((info, seedTokens, descLines) => {
|
|
229
|
-
return descLines.slice(0, -trailingDiff).map(desc => {
|
|
229
|
+
utils.setBlockDescription((info, seedTokens, descLines, postDelims) => {
|
|
230
|
+
return descLines.slice(0, -trailingDiff).map((desc, idx) => {
|
|
230
231
|
return {
|
|
231
232
|
number: 0,
|
|
232
233
|
source: '',
|
|
233
234
|
tokens: seedTokens({
|
|
234
235
|
...info,
|
|
235
236
|
description: desc,
|
|
236
|
-
postDelimiter:
|
|
237
|
+
postDelimiter: postDelims[idx]
|
|
237
238
|
})
|
|
238
239
|
};
|
|
239
240
|
});
|
|
@@ -243,19 +244,19 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({
|
|
|
243
244
|
utils.reportJSDoc(`Expected ${startLines} lines after block description`, {
|
|
244
245
|
line: lastDescriptionLine
|
|
245
246
|
}, () => {
|
|
246
|
-
utils.setBlockDescription((info, seedTokens, descLines) => {
|
|
247
|
+
utils.setBlockDescription((info, seedTokens, descLines, postDelims) => {
|
|
247
248
|
return [...descLines, ...Array.from({
|
|
248
249
|
length: -trailingDiff
|
|
249
250
|
}, () => {
|
|
250
251
|
return '';
|
|
251
|
-
})].map(desc => {
|
|
252
|
+
})].map((desc, idx) => {
|
|
252
253
|
return {
|
|
253
254
|
number: 0,
|
|
254
255
|
source: '',
|
|
255
256
|
tokens: seedTokens({
|
|
256
257
|
...info,
|
|
257
258
|
description: desc,
|
|
258
|
-
postDelimiter: desc.trim() ?
|
|
259
|
+
postDelimiter: desc.trim() ? postDelims[idx] : ''
|
|
259
260
|
})
|
|
260
261
|
};
|
|
261
262
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tagLines.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","checkMaxBlockLines","maxBlockLines","startLines","utils","reportJSDoc","description","getDescription","excessBlockLinesRegex","RegExp","excessBlockLinesMatch","match","excessBlockLines","length","excessIndexLine","slice","index","line","setBlockDescription","info","seedTokens","descLines","map","desc","number","source","tokens","postDelimiter","trim","_default","exports","iterateJsdoc","context","jsdoc","alwaysNever","applyToEndTag","count","endLines","tags","options","some","tg","tagIdx","lastTag","lastEmpty","reportIndex","emptyLinesCount","idx","end","name","tag","type","entries","includes","lines","empty","lineDiff","fixer","removeTag","tagSourceOffset","addLines","currentTag","tagSourceIdx","splice","push","currentTg","tagCount","defaultAlways","overrideAlways","fixCount","lastDescriptionLine","test","trailingLines","trailingDiff","Array","from","iterateAllJsdocs","meta","docs","url","fixable","schema","enum","additionalProperties","properties","anyOf","patternProperties","module"],"sources":["../../src/rules/tagLines.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * @param {{\n * maxBlockLines: null|number,\n * startLines: null|number,\n * utils: import('../iterateJsdoc.js').Utils\n * }} cfg\n */\nconst checkMaxBlockLines = ({\n maxBlockLines,\n startLines,\n utils,\n}) => {\n if (typeof maxBlockLines !== 'number') {\n return false;\n }\n\n if (typeof startLines === 'number' && maxBlockLines < startLines) {\n utils.reportJSDoc(\n 'If set to a number, `maxBlockLines` must be greater than or equal to `startLines`.',\n );\n return true;\n }\n\n const {\n description,\n } = utils.getDescription();\n const excessBlockLinesRegex = new RegExp('\\n{' + (maxBlockLines + 2) + ',}', 'v');\n const excessBlockLinesMatch = description.match(excessBlockLinesRegex);\n const excessBlockLines = excessBlockLinesMatch?.[0]?.length ?? 0;\n if (excessBlockLinesMatch) {\n const excessIndexLine = description.slice(0, excessBlockLinesMatch.index).match(/\\n/gv)?.length ?? 0;\n utils.reportJSDoc(\n `Expected a maximum of ${maxBlockLines} line${maxBlockLines === 1 ? '' : 's'} within block description`,\n {\n line: excessIndexLine,\n },\n () => {\n utils.setBlockDescription((info, seedTokens, descLines) => {\n return [\n ...descLines.slice(0, excessIndexLine),\n ...descLines.slice(excessIndexLine + excessBlockLines - 1 - maxBlockLines),\n ].map((desc) => {\n return {\n number: 0,\n source: '',\n tokens: seedTokens({\n ...info,\n description: desc,\n postDelimiter: desc.trim() ? ' ' : '',\n }),\n };\n });\n });\n },\n );\n return true;\n }\n\n return false;\n};\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n utils,\n}) => {\n const [\n alwaysNever = 'never',\n {\n applyToEndTag = true,\n count = 1,\n endLines = 0,\n maxBlockLines = null,\n startLines = 0,\n tags = {},\n } = {},\n ] = context.options;\n\n jsdoc.tags.some((tg, tagIdx) => {\n let lastTag;\n\n /**\n * @type {null|import('../iterateJsdoc.js').Integer}\n */\n let lastEmpty = null;\n\n /**\n * @type {null|import('../iterateJsdoc.js').Integer}\n */\n let reportIndex = null;\n let emptyLinesCount = 0;\n for (const [\n idx,\n {\n tokens: {\n description,\n end,\n name,\n tag,\n type,\n },\n },\n ] of tg.source.entries()) {\n // May be text after a line break within a tag description\n if (description) {\n reportIndex = null;\n }\n\n if (lastTag && [\n 'always', 'any',\n ].includes(tags[lastTag.slice(1)]?.lines)) {\n continue;\n }\n\n const empty = !tag && !name && !type && !description;\n if (\n empty && !end &&\n (alwaysNever === 'never' ||\n lastTag && tags[lastTag.slice(1)]?.lines === 'never'\n )\n ) {\n reportIndex = idx;\n\n continue;\n }\n\n if (!end) {\n if (empty) {\n emptyLinesCount++;\n } else {\n emptyLinesCount = 0;\n }\n\n lastEmpty = empty ? idx : null;\n }\n\n lastTag = tag;\n }\n\n if (\n typeof endLines === 'number' &&\n lastEmpty !== null && tagIdx === jsdoc.tags.length - 1\n ) {\n const lineDiff = endLines - emptyLinesCount;\n\n if (lineDiff < 0) {\n const fixer = () => {\n utils.removeTag(tagIdx, {\n tagSourceOffset: /** @type {import('../iterateJsdoc.js').Integer} */ (\n lastEmpty\n ) + lineDiff + 1,\n });\n };\n\n utils.reportJSDoc(\n `Expected ${endLines} trailing lines`,\n {\n line: tg.source[lastEmpty].number + lineDiff + 1,\n },\n fixer,\n );\n } else if (lineDiff > 0) {\n const fixer = () => {\n utils.addLines(\n tagIdx,\n /** @type {import('../iterateJsdoc.js').Integer} */ (lastEmpty),\n endLines - emptyLinesCount,\n );\n };\n\n utils.reportJSDoc(\n `Expected ${endLines} trailing lines`,\n {\n line: tg.source[lastEmpty].number,\n },\n fixer,\n );\n }\n\n return true;\n }\n\n if (reportIndex !== null) {\n const fixer = () => {\n utils.removeTag(tagIdx, {\n tagSourceOffset: /** @type {import('../iterateJsdoc.js').Integer} */ (\n reportIndex\n ),\n });\n };\n\n utils.reportJSDoc(\n 'Expected no lines between tags',\n {\n line: tg.source[0].number + 1,\n },\n fixer,\n );\n\n return true;\n }\n\n return false;\n });\n\n (applyToEndTag ? jsdoc.tags : jsdoc.tags.slice(0, -1)).some((tg, tagIdx) => {\n /**\n * @type {{\n * idx: import('../iterateJsdoc.js').Integer,\n * number: import('../iterateJsdoc.js').Integer\n * }[]}\n */\n const lines = [];\n\n let currentTag;\n let tagSourceIdx = 0;\n for (const [\n idx,\n {\n number,\n tokens: {\n description,\n end,\n name,\n tag,\n type,\n },\n },\n ] of tg.source.entries()) {\n if (description) {\n lines.splice(0);\n tagSourceIdx = idx;\n }\n\n if (tag) {\n currentTag = tag;\n }\n\n if (!tag && !name && !type && !description && !end) {\n lines.push({\n idx,\n number,\n });\n }\n }\n\n const currentTg = currentTag && tags[currentTag.slice(1)];\n const tagCount = currentTg?.count;\n\n const defaultAlways = alwaysNever === 'always' && currentTg?.lines !== 'never' &&\n currentTg?.lines !== 'any' && lines.length < count;\n\n let overrideAlways;\n let fixCount = count;\n if (!defaultAlways) {\n fixCount = typeof tagCount === 'number' ? tagCount : count;\n overrideAlways = currentTg?.lines === 'always' &&\n lines.length < fixCount;\n }\n\n if (defaultAlways || overrideAlways) {\n const fixer = () => {\n utils.addLines(tagIdx, lines[lines.length - 1]?.idx || tagSourceIdx + 1, fixCount - lines.length);\n };\n\n const line = lines[lines.length - 1]?.number || tg.source[tagSourceIdx].number;\n utils.reportJSDoc(\n `Expected ${fixCount} line${fixCount === 1 ? '' : 's'} between tags but found ${lines.length}`,\n {\n line,\n },\n fixer,\n );\n\n return true;\n }\n\n return false;\n });\n\n if (checkMaxBlockLines({\n maxBlockLines,\n startLines,\n utils,\n })) {\n return;\n }\n\n if (typeof startLines === 'number') {\n if (!jsdoc.tags.length) {\n return;\n }\n\n const {\n description,\n lastDescriptionLine,\n } = utils.getDescription();\n if (!(/\\S/v).test(description)) {\n return;\n }\n\n const trailingLines = description.match(/\\n+$/v)?.[0]?.length;\n const trailingDiff = (trailingLines ?? 0) - startLines;\n if (trailingDiff > 0) {\n utils.reportJSDoc(\n `Expected only ${startLines} line${startLines === 1 ? '' : 's'} after block description`,\n {\n line: lastDescriptionLine - trailingDiff,\n },\n () => {\n utils.setBlockDescription((info, seedTokens, descLines) => {\n return descLines.slice(0, -trailingDiff).map((desc) => {\n return {\n number: 0,\n source: '',\n tokens: seedTokens({\n ...info,\n description: desc,\n postDelimiter: desc.trim() ? info.postDelimiter : '',\n }),\n };\n });\n });\n },\n );\n } else if (trailingDiff < 0) {\n utils.reportJSDoc(\n `Expected ${startLines} lines after block description`,\n {\n line: lastDescriptionLine,\n },\n () => {\n utils.setBlockDescription((info, seedTokens, descLines) => {\n return [\n ...descLines,\n ...Array.from({\n length: -trailingDiff,\n }, () => {\n return '';\n }),\n ].map((desc) => {\n return {\n number: 0,\n source: '',\n tokens: seedTokens({\n ...info,\n description: desc,\n postDelimiter: desc.trim() ? info.postDelimiter : '',\n }),\n };\n });\n });\n },\n );\n }\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Enforces lines (or no lines) before, after, or between tags.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/tag-lines.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n description: `Defaults to \"never\". \"any\" is only useful with \\`tags\\` (allowing non-enforcement of lines except\nfor particular tags) or with \\`startLines\\`, \\`endLines\\`, or \\`maxBlockLines\\`. It is also\nnecessary if using the linebreak-setting options of the \\`sort-tags\\` rule\nso that the two rules won't conflict in both attempting to set lines\nbetween tags.`,\n enum: [\n 'always', 'any', 'never',\n ],\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n applyToEndTag: {\n description: `Set to \\`false\\` and use with \"always\" to indicate the normal lines to be\nadded after tags should not be added after the final tag.\n\nDefaults to \\`true\\`.`,\n type: 'boolean',\n },\n count: {\n description: `Use with \"always\" to indicate the number of lines to require be present.\n\nDefaults to 1.`,\n type: 'integer',\n },\n endLines: {\n anyOf: [\n {\n type: 'integer',\n },\n {\n type: 'null',\n },\n ],\n description: `If not set to \\`null\\`, will enforce end lines to the given count on the\nfinal tag only.\n\nDefaults to \\`0\\`.`,\n },\n maxBlockLines: {\n anyOf: [\n {\n type: 'integer',\n },\n {\n type: 'null',\n },\n ],\n description: `If not set to \\`null\\`, will enforce a maximum number of lines to the given count anywhere in the block description.\n\nNote that if non-\\`null\\`, \\`maxBlockLines\\` must be greater than or equal to \\`startLines\\`.\n\nDefaults to \\`null\\`.`,\n },\n startLines: {\n anyOf: [\n {\n type: 'integer',\n },\n {\n type: 'null',\n },\n ],\n description: `If not set to \\`null\\`, will enforce end lines to the given count before the\nfirst tag only, unless there is only whitespace content, in which case,\na line count will not be enforced.\n\nDefaults to \\`0\\`.`,\n },\n tags: {\n description: `Overrides the default behavior depending on specific tags.\n\nAn object whose keys are tag names and whose values are objects with the\nfollowing keys:\n\n1. \\`lines\\` - Set to \\`always\\`, \\`never\\`, or \\`any\\` to override.\n2. \\`count\\` - Overrides main \\`count\\` (for \"always\")\n\nDefaults to empty object.`,\n patternProperties: {\n '.*': {\n additionalProperties: false,\n properties: {\n count: {\n type: 'integer',\n },\n lines: {\n enum: [\n 'always', 'never', 'any',\n ],\n type: 'string',\n },\n },\n },\n },\n type: 'object',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,kBAAkB,GAAGA,CAAC;EAC1BC,aAAa;EACbC,UAAU;EACVC;AACF,CAAC,KAAK;EACJ,IAAI,OAAOF,aAAa,KAAK,QAAQ,EAAE;IACrC,OAAO,KAAK;EACd;EAEA,IAAI,OAAOC,UAAU,KAAK,QAAQ,IAAID,aAAa,GAAGC,UAAU,EAAE;IAChEC,KAAK,CAACC,WAAW,CACf,oFACF,CAAC;IACD,OAAO,IAAI;EACb;EAEA,MAAM;IACJC;EACF,CAAC,GAAGF,KAAK,CAACG,cAAc,CAAC,CAAC;EAC1B,MAAMC,qBAAqB,GAAG,IAAIC,MAAM,CAAC,KAAK,IAAIP,aAAa,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC;EACjF,MAAMQ,qBAAqB,GAAGJ,WAAW,CAACK,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C,CACF;UACD7C,WAAW,EAAE;AACzB;AACA;AACA;QACU,CAAC;QACDJ,aAAa,EAAE;UACbmF,KAAK,EAAE,CACL;YACElC,IAAI,EAAE;UACR,CAAC,EACD;YACEA,IAAI,EAAE;UACR,CAAC,CACF;UACD7C,WAAW,EAAE;AACzB;AACA;AACA;AACA;QACU,CAAC;QACDH,UAAU,EAAE;UACVkF,KAAK,EAAE,CACL;YACElC,IAAI,EAAE;UACR,CAAC,EACD;YACEA,IAAI,EAAE;UACR,CAAC,CACF;UACD7C,WAAW,EAAE;AACzB;AACA;AACA;AACA;QACU,CAAC;QACDgC,IAAI,EAAE;UACJhC,WAAW,EAAE;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B;UACdgF,iBAAiB,EAAE;YACjB,IAAI,EAAE;cACJH,oBAAoB,EAAE,KAAK;cAC3BC,UAAU,EAAE;gBACVhD,KAAK,EAAE;kBACLe,IAAI,EAAE;gBACR,CAAC;gBACDG,KAAK,EAAE;kBACL4B,IAAI,EAAE,CACJ,QAAQ,EAAE,OAAO,EAAE,KAAK,CACzB;kBACD/B,IAAI,EAAE;gBACR;cACF;YACF;UACF,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAoC,MAAA,CAAAzD,OAAA,GAAAA,OAAA,CAAA9B,OAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"tagLines.cjs","names":["_iterateJsdoc","_interopRequireDefault","require","e","__esModule","default","checkMaxBlockLines","maxBlockLines","startLines","utils","reportJSDoc","description","getDescription","excessBlockLinesRegex","RegExp","excessBlockLinesMatch","match","excessBlockLines","length","excessIndexLine","slice","index","line","setBlockDescription","info","seedTokens","descLines","postDelims","newPostDelims","map","desc","idx","number","source","tokens","postDelimiter","_default","exports","iterateJsdoc","context","jsdoc","alwaysNever","applyToEndTag","count","endLines","tags","options","some","tg","tagIdx","lastTag","lastEmpty","reportIndex","emptyLinesCount","end","name","tag","type","entries","includes","lines","empty","lineDiff","fixer","removeTag","tagSourceOffset","addLines","currentTag","tagSourceIdx","splice","push","currentTg","tagCount","defaultAlways","overrideAlways","fixCount","lastDescriptionLine","test","trailingLines","trailingDiff","Array","from","trim","iterateAllJsdocs","meta","docs","url","fixable","schema","enum","additionalProperties","properties","anyOf","patternProperties","module"],"sources":["../../src/rules/tagLines.js"],"sourcesContent":["import iterateJsdoc from '../iterateJsdoc.js';\n\n/**\n * @param {{\n * maxBlockLines: null|number,\n * startLines: null|number,\n * utils: import('../iterateJsdoc.js').Utils\n * }} cfg\n */\nconst checkMaxBlockLines = ({\n maxBlockLines,\n startLines,\n utils,\n}) => {\n if (typeof maxBlockLines !== 'number') {\n return false;\n }\n\n if (typeof startLines === 'number' && maxBlockLines < startLines) {\n utils.reportJSDoc(\n 'If set to a number, `maxBlockLines` must be greater than or equal to `startLines`.',\n );\n return true;\n }\n\n const {\n description,\n } = utils.getDescription();\n const excessBlockLinesRegex = new RegExp('\\n{' + (maxBlockLines + 2) + ',}', 'v');\n const excessBlockLinesMatch = description.match(excessBlockLinesRegex);\n const excessBlockLines = excessBlockLinesMatch?.[0]?.length ?? 0;\n if (excessBlockLinesMatch) {\n const excessIndexLine = description.slice(0, excessBlockLinesMatch.index).match(/\\n/gv)?.length ?? 0;\n utils.reportJSDoc(\n `Expected a maximum of ${maxBlockLines} line${maxBlockLines === 1 ? '' : 's'} within block description`,\n {\n line: excessIndexLine,\n },\n () => {\n utils.setBlockDescription((info, seedTokens, descLines, postDelims) => {\n const newPostDelims = [\n ...postDelims.slice(0, excessIndexLine),\n ...postDelims.slice(excessIndexLine + excessBlockLines - 1 - maxBlockLines),\n ];\n return [\n ...descLines.slice(0, excessIndexLine),\n ...descLines.slice(excessIndexLine + excessBlockLines - 1 - maxBlockLines),\n ].map((desc, idx) => {\n return {\n number: 0,\n source: '',\n tokens: seedTokens({\n ...info,\n description: desc,\n postDelimiter: newPostDelims[idx],\n }),\n };\n });\n });\n },\n );\n return true;\n }\n\n return false;\n};\n\nexport default iterateJsdoc(({\n context,\n jsdoc,\n utils,\n}) => {\n const [\n alwaysNever = 'never',\n {\n applyToEndTag = true,\n count = 1,\n endLines = 0,\n maxBlockLines = null,\n startLines = 0,\n tags = {},\n } = {},\n ] = context.options;\n\n jsdoc.tags.some((tg, tagIdx) => {\n let lastTag;\n\n /**\n * @type {null|import('../iterateJsdoc.js').Integer}\n */\n let lastEmpty = null;\n\n /**\n * @type {null|import('../iterateJsdoc.js').Integer}\n */\n let reportIndex = null;\n let emptyLinesCount = 0;\n for (const [\n idx,\n {\n tokens: {\n description,\n end,\n name,\n tag,\n type,\n },\n },\n ] of tg.source.entries()) {\n // May be text after a line break within a tag description\n if (description) {\n reportIndex = null;\n }\n\n if (lastTag && [\n 'always', 'any',\n ].includes(tags[lastTag.slice(1)]?.lines)) {\n continue;\n }\n\n const empty = !tag && !name && !type && !description;\n if (\n empty && !end &&\n (alwaysNever === 'never' ||\n lastTag && tags[lastTag.slice(1)]?.lines === 'never'\n )\n ) {\n reportIndex = idx;\n\n continue;\n }\n\n if (!end) {\n if (empty) {\n emptyLinesCount++;\n } else {\n emptyLinesCount = 0;\n }\n\n lastEmpty = empty ? idx : null;\n }\n\n lastTag = tag;\n }\n\n if (\n typeof endLines === 'number' &&\n lastEmpty !== null && tagIdx === jsdoc.tags.length - 1\n ) {\n const lineDiff = endLines - emptyLinesCount;\n\n if (lineDiff < 0) {\n const fixer = () => {\n utils.removeTag(tagIdx, {\n tagSourceOffset: /** @type {import('../iterateJsdoc.js').Integer} */ (\n lastEmpty\n ) + lineDiff + 1,\n });\n };\n\n utils.reportJSDoc(\n `Expected ${endLines} trailing lines`,\n {\n line: tg.source[lastEmpty].number + lineDiff + 1,\n },\n fixer,\n );\n } else if (lineDiff > 0) {\n const fixer = () => {\n utils.addLines(\n tagIdx,\n /** @type {import('../iterateJsdoc.js').Integer} */ (lastEmpty),\n endLines - emptyLinesCount,\n );\n };\n\n utils.reportJSDoc(\n `Expected ${endLines} trailing lines`,\n {\n line: tg.source[lastEmpty].number,\n },\n fixer,\n );\n }\n\n return true;\n }\n\n if (reportIndex !== null) {\n const fixer = () => {\n utils.removeTag(tagIdx, {\n tagSourceOffset: /** @type {import('../iterateJsdoc.js').Integer} */ (\n reportIndex\n ),\n });\n };\n\n utils.reportJSDoc(\n 'Expected no lines between tags',\n {\n line: tg.source[0].number + 1,\n },\n fixer,\n );\n\n return true;\n }\n\n return false;\n });\n\n (applyToEndTag ? jsdoc.tags : jsdoc.tags.slice(0, -1)).some((tg, tagIdx) => {\n /**\n * @type {{\n * idx: import('../iterateJsdoc.js').Integer,\n * number: import('../iterateJsdoc.js').Integer\n * }[]}\n */\n const lines = [];\n\n let currentTag;\n let tagSourceIdx = 0;\n for (const [\n idx,\n {\n number,\n tokens: {\n description,\n end,\n name,\n tag,\n type,\n },\n },\n ] of tg.source.entries()) {\n if (description) {\n lines.splice(0);\n tagSourceIdx = idx;\n }\n\n if (tag) {\n currentTag = tag;\n }\n\n if (!tag && !name && !type && !description && !end) {\n lines.push({\n idx,\n number,\n });\n }\n }\n\n const currentTg = currentTag && tags[currentTag.slice(1)];\n const tagCount = currentTg?.count;\n\n const defaultAlways = alwaysNever === 'always' && currentTg?.lines !== 'never' &&\n currentTg?.lines !== 'any' && lines.length < count;\n\n let overrideAlways;\n let fixCount = count;\n if (!defaultAlways) {\n fixCount = typeof tagCount === 'number' ? tagCount : count;\n overrideAlways = currentTg?.lines === 'always' &&\n lines.length < fixCount;\n }\n\n if (defaultAlways || overrideAlways) {\n const fixer = () => {\n utils.addLines(tagIdx, lines[lines.length - 1]?.idx || tagSourceIdx + 1, fixCount - lines.length);\n };\n\n const line = lines[lines.length - 1]?.number || tg.source[tagSourceIdx].number;\n utils.reportJSDoc(\n `Expected ${fixCount} line${fixCount === 1 ? '' : 's'} between tags but found ${lines.length}`,\n {\n line,\n },\n fixer,\n );\n\n return true;\n }\n\n return false;\n });\n\n if (checkMaxBlockLines({\n maxBlockLines,\n startLines,\n utils,\n })) {\n return;\n }\n\n if (typeof startLines === 'number') {\n if (!jsdoc.tags.length) {\n return;\n }\n\n const {\n description,\n lastDescriptionLine,\n } = utils.getDescription();\n if (!(/\\S/v).test(description)) {\n return;\n }\n\n const trailingLines = description.match(/\\n+$/v)?.[0]?.length;\n const trailingDiff = (trailingLines ?? 0) - startLines;\n if (trailingDiff > 0) {\n utils.reportJSDoc(\n `Expected only ${startLines} line${startLines === 1 ? '' : 's'} after block description`,\n {\n line: lastDescriptionLine - trailingDiff,\n },\n () => {\n utils.setBlockDescription((info, seedTokens, descLines, postDelims) => {\n return descLines.slice(0, -trailingDiff).map((desc, idx) => {\n return {\n number: 0,\n source: '',\n tokens: seedTokens({\n ...info,\n description: desc,\n postDelimiter: postDelims[idx],\n }),\n };\n });\n });\n },\n );\n } else if (trailingDiff < 0) {\n utils.reportJSDoc(\n `Expected ${startLines} lines after block description`,\n {\n line: lastDescriptionLine,\n },\n () => {\n utils.setBlockDescription((info, seedTokens, descLines, postDelims) => {\n return [\n ...descLines,\n ...Array.from({\n length: -trailingDiff,\n }, () => {\n return '';\n }),\n ].map((desc, idx) => {\n return {\n number: 0,\n source: '',\n tokens: seedTokens({\n ...info,\n description: desc,\n postDelimiter: desc.trim() ? postDelims[idx] : '',\n }),\n };\n });\n });\n },\n );\n }\n }\n}, {\n iterateAllJsdocs: true,\n meta: {\n docs: {\n description: 'Enforces lines (or no lines) before, after, or between tags.',\n url: 'https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/tag-lines.md#repos-sticky-header',\n },\n fixable: 'code',\n schema: [\n {\n description: `Defaults to \"never\". \"any\" is only useful with \\`tags\\` (allowing non-enforcement of lines except\nfor particular tags) or with \\`startLines\\`, \\`endLines\\`, or \\`maxBlockLines\\`. It is also\nnecessary if using the linebreak-setting options of the \\`sort-tags\\` rule\nso that the two rules won't conflict in both attempting to set lines\nbetween tags.`,\n enum: [\n 'always', 'any', 'never',\n ],\n type: 'string',\n },\n {\n additionalProperties: false,\n properties: {\n applyToEndTag: {\n description: `Set to \\`false\\` and use with \"always\" to indicate the normal lines to be\nadded after tags should not be added after the final tag.\n\nDefaults to \\`true\\`.`,\n type: 'boolean',\n },\n count: {\n description: `Use with \"always\" to indicate the number of lines to require be present.\n\nDefaults to 1.`,\n type: 'integer',\n },\n endLines: {\n anyOf: [\n {\n type: 'integer',\n },\n {\n type: 'null',\n },\n ],\n description: `If not set to \\`null\\`, will enforce end lines to the given count on the\nfinal tag only.\n\nDefaults to \\`0\\`.`,\n },\n maxBlockLines: {\n anyOf: [\n {\n type: 'integer',\n },\n {\n type: 'null',\n },\n ],\n description: `If not set to \\`null\\`, will enforce a maximum number of lines to the given count anywhere in the block description.\n\nNote that if non-\\`null\\`, \\`maxBlockLines\\` must be greater than or equal to \\`startLines\\`.\n\nDefaults to \\`null\\`.`,\n },\n startLines: {\n anyOf: [\n {\n type: 'integer',\n },\n {\n type: 'null',\n },\n ],\n description: `If not set to \\`null\\`, will enforce end lines to the given count before the\nfirst tag only, unless there is only whitespace content, in which case,\na line count will not be enforced.\n\nDefaults to \\`0\\`.`,\n },\n tags: {\n description: `Overrides the default behavior depending on specific tags.\n\nAn object whose keys are tag names and whose values are objects with the\nfollowing keys:\n\n1. \\`lines\\` - Set to \\`always\\`, \\`never\\`, or \\`any\\` to override.\n2. \\`count\\` - Overrides main \\`count\\` (for \"always\")\n\nDefaults to empty object.`,\n patternProperties: {\n '.*': {\n additionalProperties: false,\n properties: {\n count: {\n type: 'integer',\n },\n lines: {\n enum: [\n 'always', 'never', 'any',\n ],\n type: 'string',\n },\n },\n },\n },\n type: 'object',\n },\n },\n type: 'object',\n },\n ],\n type: 'suggestion',\n },\n});\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA8C,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,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A;AACA;AACA;AACA,0BAA0B;UACdkF,iBAAiB,EAAE;YACjB,IAAI,EAAE;cACJH,oBAAoB,EAAE,KAAK;cAC3BC,UAAU,EAAE;gBACVhD,KAAK,EAAE;kBACLc,IAAI,EAAE;gBACR,CAAC;gBACDG,KAAK,EAAE;kBACL6B,IAAI,EAAE,CACJ,QAAQ,EAAE,OAAO,EAAE,KAAK,CACzB;kBACDhC,IAAI,EAAE;gBACR;cACF;YACF;UACF,CAAC;UACDA,IAAI,EAAE;QACR;MACF,CAAC;MACDA,IAAI,EAAE;IACR,CAAC,CACF;IACDA,IAAI,EAAE;EACR;AACF,CAAC,CAAC;AAAAqC,MAAA,CAAAzD,OAAA,GAAAA,OAAA,CAAAhC,OAAA","ignoreList":[]}
|
package/dist/rules.d.ts
CHANGED
|
@@ -47,6 +47,10 @@ export interface Rules {
|
|
|
47
47
|
| []
|
|
48
48
|
| [
|
|
49
49
|
{
|
|
50
|
+
/**
|
|
51
|
+
* Allows indentation of nested sections on subsequent lines (like bullet lists)
|
|
52
|
+
*/
|
|
53
|
+
allowIndentedSections?: boolean;
|
|
50
54
|
/**
|
|
51
55
|
* Array of tags (e.g., `['example', 'description']`) whose content will be
|
|
52
56
|
* "hidden" from the `check-indentation` rule. Defaults to `['example']`.
|
|
@@ -43,13 +43,15 @@ const identifiers = [
|
|
|
43
43
|
'with',
|
|
44
44
|
'yield',
|
|
45
45
|
|
|
46
|
-
// Future reserved keywords
|
|
46
|
+
// Future reserved keywords (strict mode)
|
|
47
47
|
'implements',
|
|
48
48
|
'interface',
|
|
49
|
+
'let',
|
|
49
50
|
'package',
|
|
50
51
|
'private',
|
|
51
52
|
'protected',
|
|
52
53
|
'public',
|
|
54
|
+
'static',
|
|
53
55
|
|
|
54
56
|
// Not keywords, but still restricted
|
|
55
57
|
'arguments',
|
package/package.json
CHANGED