eslint-plugin-jsdoc 48.8.2 → 48.9.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/README.md +7 -0
- package/dist/WarnSettings.cjs +2 -2
- package/dist/WarnSettings.cjs.map +1 -1
- package/dist/getJsdocProcessorPlugin.cjs +538 -0
- package/dist/getJsdocProcessorPlugin.cjs.map +1 -0
- package/dist/index.cjs +84 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/iterateJsdoc.cjs +58 -112
- package/dist/iterateJsdoc.cjs.map +1 -1
- package/dist/jsdocUtils.cjs +226 -48
- package/dist/jsdocUtils.cjs.map +1 -1
- package/dist/rules/checkTemplateNames.cjs +28 -15
- package/dist/rules/checkTemplateNames.cjs.map +1 -1
- package/dist/rules/convertToJsdocComments.cjs +5 -6
- package/dist/rules/convertToJsdocComments.cjs.map +1 -1
- package/dist/rules/requireJsdoc.cjs +7 -7
- package/dist/rules/requireJsdoc.cjs.map +1 -1
- package/dist/rules/requireTemplate.cjs +33 -16
- package/dist/rules/requireTemplate.cjs.map +1 -1
- package/eslint.config.js +3 -2
- package/package.json +2 -1
- package/src/WarnSettings.js +2 -2
- package/src/getJsdocProcessorPlugin.js +602 -0
- package/src/index.js +108 -0
- package/src/iterateJsdoc.js +21 -97
- package/src/jsdocUtils.js +191 -7
- package/src/rules/checkTemplateNames.js +32 -19
- package/src/rules/convertToJsdocComments.js +10 -6
- package/src/rules/requireJsdoc.js +16 -8
- package/src/rules/requireTemplate.js +38 -20
package/README.md
CHANGED
|
@@ -17,6 +17,7 @@ JSDoc linting rules for ESLint.
|
|
|
17
17
|
* [Options](#user-content-eslint-plugin-jsdoc-options)
|
|
18
18
|
* [Settings](#user-content-eslint-plugin-jsdoc-settings)
|
|
19
19
|
* [Advanced](#user-content-eslint-plugin-jsdoc-advanced)
|
|
20
|
+
* [Processors](#user-content-eslint-plugin-jsdoc-processors)
|
|
20
21
|
* [Rules](#user-content-eslint-plugin-jsdoc-rules)
|
|
21
22
|
|
|
22
23
|
|
|
@@ -241,6 +242,12 @@ See [Settings](./docs/settings.md#readme).
|
|
|
241
242
|
|
|
242
243
|
See [Advanced](./docs/advanced.md#readme).
|
|
243
244
|
|
|
245
|
+
<a name="user-content-eslint-plugin-jsdoc-processors"></a>
|
|
246
|
+
<a name="eslint-plugin-jsdoc-processors"></a>
|
|
247
|
+
## Processors
|
|
248
|
+
|
|
249
|
+
See our `@example` and other item [processors](./docs/processors.md#readme).
|
|
250
|
+
|
|
244
251
|
<a name="user-content-eslint-plugin-jsdoc-rules"></a>
|
|
245
252
|
<a name="eslint-plugin-jsdoc-rules"></a>
|
|
246
253
|
## Rules
|
package/dist/WarnSettings.cjs
CHANGED
|
@@ -10,7 +10,7 @@ const WarnSettings = function () {
|
|
|
10
10
|
return {
|
|
11
11
|
/**
|
|
12
12
|
* Warn only once for each context and setting
|
|
13
|
-
* @param {
|
|
13
|
+
* @param {{}} context
|
|
14
14
|
* @param {string} setting
|
|
15
15
|
* @returns {boolean}
|
|
16
16
|
*/
|
|
@@ -18,7 +18,7 @@ const WarnSettings = function () {
|
|
|
18
18
|
return warnedSettings.has(context) && /** @type {Set<string>} */warnedSettings.get(context).has(setting);
|
|
19
19
|
},
|
|
20
20
|
/**
|
|
21
|
-
* @param {
|
|
21
|
+
* @param {{}} context
|
|
22
22
|
* @param {string} setting
|
|
23
23
|
* @returns {void}
|
|
24
24
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WarnSettings.cjs","names":["WarnSettings","warnedSettings","WeakMap","hasBeenWarned","context","setting","has","get","markSettingAsWarned","set","Set","add","_default","exports","default","module"],"sources":["../src/WarnSettings.js"],"sourcesContent":["const WarnSettings = function () {\n /** @type {WeakMap<object, Set<string>>} */\n const warnedSettings = new WeakMap();\n\n return {\n /**\n * Warn only once for each context and setting\n * @param {
|
|
1
|
+
{"version":3,"file":"WarnSettings.cjs","names":["WarnSettings","warnedSettings","WeakMap","hasBeenWarned","context","setting","has","get","markSettingAsWarned","set","Set","add","_default","exports","default","module"],"sources":["../src/WarnSettings.js"],"sourcesContent":["const WarnSettings = function () {\n /** @type {WeakMap<object, Set<string>>} */\n const warnedSettings = new WeakMap();\n\n return {\n /**\n * Warn only once for each context and setting\n * @param {{}} context\n * @param {string} setting\n * @returns {boolean}\n */\n hasBeenWarned (context, setting) {\n return warnedSettings.has(context) && /** @type {Set<string>} */ (\n warnedSettings.get(context)\n ).has(setting);\n },\n\n /**\n * @param {{}} context\n * @param {string} setting\n * @returns {void}\n */\n markSettingAsWarned (context, setting) {\n // c8 ignore else\n if (!warnedSettings.has(context)) {\n warnedSettings.set(context, new Set());\n }\n\n /** @type {Set<string>} */ (warnedSettings.get(context)).add(setting);\n },\n };\n};\n\nexport default WarnSettings;\n"],"mappings":";;;;;;AAAA,MAAMA,YAAY,GAAG,SAAAA,CAAA,EAAY;EAC/B;EACA,MAAMC,cAAc,GAAG,IAAIC,OAAO,CAAC,CAAC;EAEpC,OAAO;IACL;AACJ;AACA;AACA;AACA;AACA;IACIC,aAAaA,CAAEC,OAAO,EAAEC,OAAO,EAAE;MAC/B,OAAOJ,cAAc,CAACK,GAAG,CAACF,OAAO,CAAC,IAAI,0BACpCH,cAAc,CAACM,GAAG,CAACH,OAAO,CAAC,CAC3BE,GAAG,CAACD,OAAO,CAAC;IAChB,CAAC;IAED;AACJ;AACA;AACA;AACA;IACIG,mBAAmBA,CAAEJ,OAAO,EAAEC,OAAO,EAAE;MACrC;MACA,IAAI,CAACJ,cAAc,CAACK,GAAG,CAACF,OAAO,CAAC,EAAE;QAChCH,cAAc,CAACQ,GAAG,CAACL,OAAO,EAAE,IAAIM,GAAG,CAAC,CAAC,CAAC;MACxC;;MAEA;MAA4BT,cAAc,CAACM,GAAG,CAACH,OAAO,CAAC,CAAEO,GAAG,CAACN,OAAO,CAAC;IACvE;EACF,CAAC;AACH,CAAC;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEad,YAAY;AAAAe,MAAA,CAAAF,OAAA,GAAAA,OAAA,CAAAC,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,538 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getJsdocProcessorPlugin = void 0;
|
|
7
|
+
var _fs = require("fs");
|
|
8
|
+
var espree = _interopRequireWildcard(require("espree"));
|
|
9
|
+
var _jsdocUtils = require("./jsdocUtils.cjs");
|
|
10
|
+
var _jsdoccomment = require("@es-joy/jsdoccomment");
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
+
// Todo: Support TS by fenced block type
|
|
14
|
+
|
|
15
|
+
const {
|
|
16
|
+
version
|
|
17
|
+
} = JSON.parse(
|
|
18
|
+
// @ts-expect-error `Buffer` is ok for `JSON.parse`
|
|
19
|
+
(0, _fs.readFileSync)('./package.json'));
|
|
20
|
+
|
|
21
|
+
// const zeroBasedLineIndexAdjust = -1;
|
|
22
|
+
const likelyNestedJSDocIndentSpace = 1;
|
|
23
|
+
const preTagSpaceLength = 1;
|
|
24
|
+
|
|
25
|
+
// If a space is present, we should ignore it
|
|
26
|
+
const firstLinePrefixLength = preTagSpaceLength;
|
|
27
|
+
const hasCaptionRegex = /^\s*<caption>([\s\S]*?)<\/caption>/u;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @param {string} str
|
|
31
|
+
* @returns {string}
|
|
32
|
+
*/
|
|
33
|
+
const escapeStringRegexp = str => {
|
|
34
|
+
return str.replaceAll(/[.*+?^${}()|[\]\\]/gu, '\\$&');
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @param {string} str
|
|
39
|
+
* @param {string} ch
|
|
40
|
+
* @returns {import('./iterateJsdoc.js').Integer}
|
|
41
|
+
*/
|
|
42
|
+
const countChars = (str, ch) => {
|
|
43
|
+
return (str.match(new RegExp(escapeStringRegexp(ch), 'gu')) || []).length;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @param {string} text
|
|
48
|
+
* @returns {[
|
|
49
|
+
* import('./iterateJsdoc.js').Integer,
|
|
50
|
+
* import('./iterateJsdoc.js').Integer
|
|
51
|
+
* ]}
|
|
52
|
+
*/
|
|
53
|
+
const getLinesCols = text => {
|
|
54
|
+
const matchLines = countChars(text, '\n');
|
|
55
|
+
const colDelta = matchLines ? text.slice(text.lastIndexOf('\n') + 1).length : text.length;
|
|
56
|
+
return [matchLines, colDelta];
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @typedef {number} Integer
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @typedef {object} JsdocProcessorOptions
|
|
65
|
+
* @property {boolean} [captionRequired]
|
|
66
|
+
* @property {Integer} [paddedIndent]
|
|
67
|
+
* @property {boolean} [checkDefaults]
|
|
68
|
+
* @property {boolean} [checkParams]
|
|
69
|
+
* @property {boolean} [checkExamples]
|
|
70
|
+
* @property {boolean} [checkProperties]
|
|
71
|
+
* @property {string} [matchingFileName]
|
|
72
|
+
* @property {string} [matchingFileNameDefaults]
|
|
73
|
+
* @property {string} [matchingFileNameParams]
|
|
74
|
+
* @property {string} [matchingFileNameProperties]
|
|
75
|
+
* @property {string} [exampleCodeRegex]
|
|
76
|
+
* @property {string} [rejectExampleCodeRegex]
|
|
77
|
+
* @property {"script"|"module"} [sourceType]
|
|
78
|
+
* @property {import('eslint').Linter.FlatConfigParserModule} [parser]
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* We use a function for the ability of the user to pass in a config, but
|
|
83
|
+
* without requiring all users of the plugin to do so.
|
|
84
|
+
* @param {JsdocProcessorOptions} [options]
|
|
85
|
+
*/
|
|
86
|
+
const getJsdocProcessorPlugin = (options = {}) => {
|
|
87
|
+
const {
|
|
88
|
+
exampleCodeRegex = null,
|
|
89
|
+
rejectExampleCodeRegex = null,
|
|
90
|
+
checkExamples = true,
|
|
91
|
+
checkDefaults = false,
|
|
92
|
+
checkParams = false,
|
|
93
|
+
checkProperties = false,
|
|
94
|
+
matchingFileName = null,
|
|
95
|
+
matchingFileNameDefaults = null,
|
|
96
|
+
matchingFileNameParams = null,
|
|
97
|
+
matchingFileNameProperties = null,
|
|
98
|
+
paddedIndent = 0,
|
|
99
|
+
captionRequired = false,
|
|
100
|
+
sourceType = 'module',
|
|
101
|
+
parser = undefined
|
|
102
|
+
} = options;
|
|
103
|
+
|
|
104
|
+
/** @type {RegExp} */
|
|
105
|
+
let exampleCodeRegExp;
|
|
106
|
+
/** @type {RegExp} */
|
|
107
|
+
let rejectExampleCodeRegExp;
|
|
108
|
+
if (exampleCodeRegex) {
|
|
109
|
+
exampleCodeRegExp = (0, _jsdocUtils.getRegexFromString)(exampleCodeRegex);
|
|
110
|
+
}
|
|
111
|
+
if (rejectExampleCodeRegex) {
|
|
112
|
+
rejectExampleCodeRegExp = (0, _jsdocUtils.getRegexFromString)(rejectExampleCodeRegex);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @type {{
|
|
117
|
+
* targetTagName: string,
|
|
118
|
+
* ext: string,
|
|
119
|
+
* codeStartLine: number,
|
|
120
|
+
* codeStartCol: number,
|
|
121
|
+
* nonJSPrefacingCols: number,
|
|
122
|
+
* commentLineCols: [number, number]
|
|
123
|
+
* }[]}
|
|
124
|
+
*/
|
|
125
|
+
const otherInfo = [];
|
|
126
|
+
|
|
127
|
+
/** @type {import('eslint').Linter.LintMessage[]} */
|
|
128
|
+
let extraMessages = [];
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* @param {import('./iterateJsdoc.js').JsdocBlockWithInline} jsdoc
|
|
132
|
+
* @param {string} jsFileName
|
|
133
|
+
* @param {[number, number]} commentLineCols
|
|
134
|
+
*/
|
|
135
|
+
const getTextsAndFileNames = (jsdoc, jsFileName, commentLineCols) => {
|
|
136
|
+
/**
|
|
137
|
+
* @type {{
|
|
138
|
+
* text: string,
|
|
139
|
+
* filename: string|null|undefined
|
|
140
|
+
* }[]}
|
|
141
|
+
*/
|
|
142
|
+
const textsAndFileNames = [];
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* @param {{
|
|
146
|
+
* filename: string|null,
|
|
147
|
+
* defaultFileName: string|undefined,
|
|
148
|
+
* source: string,
|
|
149
|
+
* targetTagName: string,
|
|
150
|
+
* rules?: import('eslint').Linter.RulesRecord|undefined,
|
|
151
|
+
* lines?: import('./iterateJsdoc.js').Integer,
|
|
152
|
+
* cols?: import('./iterateJsdoc.js').Integer,
|
|
153
|
+
* skipInit?: boolean,
|
|
154
|
+
* ext: string,
|
|
155
|
+
* sources?: {
|
|
156
|
+
* nonJSPrefacingCols: import('./iterateJsdoc.js').Integer,
|
|
157
|
+
* nonJSPrefacingLines: import('./iterateJsdoc.js').Integer,
|
|
158
|
+
* string: string,
|
|
159
|
+
* }[],
|
|
160
|
+
* tag?: import('comment-parser').Spec & {
|
|
161
|
+
* line?: import('./iterateJsdoc.js').Integer,
|
|
162
|
+
* }|{
|
|
163
|
+
* line: import('./iterateJsdoc.js').Integer,
|
|
164
|
+
* }
|
|
165
|
+
* }} cfg
|
|
166
|
+
*/
|
|
167
|
+
const checkSource = ({
|
|
168
|
+
filename,
|
|
169
|
+
ext,
|
|
170
|
+
defaultFileName,
|
|
171
|
+
lines = 0,
|
|
172
|
+
cols = 0,
|
|
173
|
+
skipInit,
|
|
174
|
+
source,
|
|
175
|
+
targetTagName,
|
|
176
|
+
sources = [],
|
|
177
|
+
tag = {
|
|
178
|
+
line: 0
|
|
179
|
+
}
|
|
180
|
+
}) => {
|
|
181
|
+
if (!skipInit) {
|
|
182
|
+
sources.push({
|
|
183
|
+
nonJSPrefacingCols: cols,
|
|
184
|
+
nonJSPrefacingLines: lines,
|
|
185
|
+
string: source
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* @param {{
|
|
191
|
+
* nonJSPrefacingCols: import('./iterateJsdoc.js').Integer,
|
|
192
|
+
* nonJSPrefacingLines: import('./iterateJsdoc.js').Integer,
|
|
193
|
+
* string: string
|
|
194
|
+
* }} cfg
|
|
195
|
+
*/
|
|
196
|
+
const addSourceInfo = function ({
|
|
197
|
+
nonJSPrefacingCols,
|
|
198
|
+
nonJSPrefacingLines,
|
|
199
|
+
string
|
|
200
|
+
}) {
|
|
201
|
+
const src = paddedIndent ? string.replaceAll(new RegExp(`(^|\n) {${paddedIndent}}(?!$)`, 'gu'), '\n') : string;
|
|
202
|
+
|
|
203
|
+
// Programmatic ESLint API: https://eslint.org/docs/developer-guide/nodejs-api
|
|
204
|
+
const file = filename || defaultFileName;
|
|
205
|
+
if (!('line' in tag)) {
|
|
206
|
+
tag.line = tag.source[0].number;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// NOTE: `tag.line` can be 0 if of form `/** @tag ... */`
|
|
210
|
+
const codeStartLine =
|
|
211
|
+
/**
|
|
212
|
+
* @type {import('comment-parser').Spec & {
|
|
213
|
+
* line: import('./iterateJsdoc.js').Integer,
|
|
214
|
+
* }}
|
|
215
|
+
*/
|
|
216
|
+
tag.line + nonJSPrefacingLines;
|
|
217
|
+
const codeStartCol = likelyNestedJSDocIndentSpace;
|
|
218
|
+
textsAndFileNames.push({
|
|
219
|
+
text: src,
|
|
220
|
+
filename: file
|
|
221
|
+
});
|
|
222
|
+
otherInfo.push({
|
|
223
|
+
targetTagName,
|
|
224
|
+
ext,
|
|
225
|
+
codeStartLine,
|
|
226
|
+
codeStartCol,
|
|
227
|
+
nonJSPrefacingCols,
|
|
228
|
+
commentLineCols
|
|
229
|
+
});
|
|
230
|
+
};
|
|
231
|
+
for (const targetSource of sources) {
|
|
232
|
+
addSourceInfo(targetSource);
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
*
|
|
238
|
+
* @param {string|null} filename
|
|
239
|
+
* @param {string} [ext] Since `eslint-plugin-markdown` v2, and
|
|
240
|
+
* ESLint 7, this is the default which other JS-fenced rules will used.
|
|
241
|
+
* Formerly "md" was the default.
|
|
242
|
+
* @returns {{
|
|
243
|
+
* defaultFileName: string|undefined,
|
|
244
|
+
* filename: string|null,
|
|
245
|
+
* ext: string
|
|
246
|
+
* }}
|
|
247
|
+
*/
|
|
248
|
+
const getFilenameInfo = (filename, ext = 'md/*.js') => {
|
|
249
|
+
let defaultFileName;
|
|
250
|
+
if (!filename) {
|
|
251
|
+
if (typeof jsFileName === 'string' && jsFileName.includes('.')) {
|
|
252
|
+
defaultFileName = jsFileName.replace(/\.[^.]*$/u, `.${ext}`);
|
|
253
|
+
} else {
|
|
254
|
+
defaultFileName = `dummy.${ext}`;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return {
|
|
258
|
+
ext,
|
|
259
|
+
defaultFileName,
|
|
260
|
+
filename
|
|
261
|
+
};
|
|
262
|
+
};
|
|
263
|
+
if (checkDefaults) {
|
|
264
|
+
const filenameInfo = getFilenameInfo(matchingFileNameDefaults, 'jsdoc-defaults');
|
|
265
|
+
(0, _jsdocUtils.forEachPreferredTag)(jsdoc, 'default', (tag, targetTagName) => {
|
|
266
|
+
if (!tag.description.trim()) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
checkSource({
|
|
270
|
+
source: `(${(0, _jsdocUtils.getTagDescription)(tag)})`,
|
|
271
|
+
targetTagName,
|
|
272
|
+
...filenameInfo
|
|
273
|
+
});
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
if (checkParams) {
|
|
277
|
+
const filenameInfo = getFilenameInfo(matchingFileNameParams, 'jsdoc-params');
|
|
278
|
+
(0, _jsdocUtils.forEachPreferredTag)(jsdoc, 'param', (tag, targetTagName) => {
|
|
279
|
+
if (!tag.default || !tag.default.trim()) {
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
checkSource({
|
|
283
|
+
source: `(${tag.default})`,
|
|
284
|
+
targetTagName,
|
|
285
|
+
...filenameInfo
|
|
286
|
+
});
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
if (checkProperties) {
|
|
290
|
+
const filenameInfo = getFilenameInfo(matchingFileNameProperties, 'jsdoc-properties');
|
|
291
|
+
(0, _jsdocUtils.forEachPreferredTag)(jsdoc, 'property', (tag, targetTagName) => {
|
|
292
|
+
if (!tag.default || !tag.default.trim()) {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
checkSource({
|
|
296
|
+
source: `(${tag.default})`,
|
|
297
|
+
targetTagName,
|
|
298
|
+
...filenameInfo
|
|
299
|
+
});
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
if (!checkExamples) {
|
|
303
|
+
return textsAndFileNames;
|
|
304
|
+
}
|
|
305
|
+
const tagName = /** @type {string} */(0, _jsdocUtils.getPreferredTagName)(jsdoc, {
|
|
306
|
+
tagName: 'example'
|
|
307
|
+
});
|
|
308
|
+
if (!(0, _jsdocUtils.hasTag)(jsdoc, tagName)) {
|
|
309
|
+
return textsAndFileNames;
|
|
310
|
+
}
|
|
311
|
+
const matchingFilenameInfo = getFilenameInfo(matchingFileName);
|
|
312
|
+
(0, _jsdocUtils.forEachPreferredTag)(jsdoc, 'example', (tag, targetTagName) => {
|
|
313
|
+
let source = /** @type {string} */(0, _jsdocUtils.getTagDescription)(tag);
|
|
314
|
+
const match = source.match(hasCaptionRegex);
|
|
315
|
+
if (captionRequired && (!match || !match[1].trim())) {
|
|
316
|
+
extraMessages.push({
|
|
317
|
+
line: 1 + commentLineCols[0] + (tag.line ?? tag.source[0].number),
|
|
318
|
+
column: commentLineCols[1] + 1,
|
|
319
|
+
severity: 2,
|
|
320
|
+
message: `@${targetTagName} error - Caption is expected for examples.`,
|
|
321
|
+
ruleId: 'jsdoc/example-missing-caption'
|
|
322
|
+
});
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
source = source.replace(hasCaptionRegex, '');
|
|
326
|
+
const [lines, cols] = match ? getLinesCols(match[0]) : [0, 0];
|
|
327
|
+
if (exampleCodeRegex && !exampleCodeRegExp.test(source) || rejectExampleCodeRegex && rejectExampleCodeRegExp.test(source)) {
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
const sources = [];
|
|
331
|
+
let skipInit = false;
|
|
332
|
+
if (exampleCodeRegex) {
|
|
333
|
+
let nonJSPrefacingCols = 0;
|
|
334
|
+
let nonJSPrefacingLines = 0;
|
|
335
|
+
let startingIndex = 0;
|
|
336
|
+
let lastStringCount = 0;
|
|
337
|
+
let exampleCode;
|
|
338
|
+
exampleCodeRegExp.lastIndex = 0;
|
|
339
|
+
while ((exampleCode = exampleCodeRegExp.exec(source)) !== null) {
|
|
340
|
+
const {
|
|
341
|
+
index,
|
|
342
|
+
'0': n0,
|
|
343
|
+
'1': n1
|
|
344
|
+
} = exampleCode;
|
|
345
|
+
|
|
346
|
+
// Count anything preceding user regex match (can affect line numbering)
|
|
347
|
+
const preMatch = source.slice(startingIndex, index);
|
|
348
|
+
const [preMatchLines, colDelta] = getLinesCols(preMatch);
|
|
349
|
+
let nonJSPreface;
|
|
350
|
+
let nonJSPrefaceLineCount;
|
|
351
|
+
if (n1) {
|
|
352
|
+
const idx = n0.indexOf(n1);
|
|
353
|
+
nonJSPreface = n0.slice(0, idx);
|
|
354
|
+
nonJSPrefaceLineCount = countChars(nonJSPreface, '\n');
|
|
355
|
+
} else {
|
|
356
|
+
nonJSPreface = '';
|
|
357
|
+
nonJSPrefaceLineCount = 0;
|
|
358
|
+
}
|
|
359
|
+
nonJSPrefacingLines += lastStringCount + preMatchLines + nonJSPrefaceLineCount;
|
|
360
|
+
|
|
361
|
+
// Ignore `preMatch` delta if newlines here
|
|
362
|
+
if (nonJSPrefaceLineCount) {
|
|
363
|
+
const charsInLastLine = nonJSPreface.slice(nonJSPreface.lastIndexOf('\n') + 1).length;
|
|
364
|
+
nonJSPrefacingCols += charsInLastLine;
|
|
365
|
+
} else {
|
|
366
|
+
nonJSPrefacingCols += colDelta + nonJSPreface.length;
|
|
367
|
+
}
|
|
368
|
+
const string = n1 || n0;
|
|
369
|
+
sources.push({
|
|
370
|
+
nonJSPrefacingCols,
|
|
371
|
+
nonJSPrefacingLines,
|
|
372
|
+
string
|
|
373
|
+
});
|
|
374
|
+
startingIndex = exampleCodeRegExp.lastIndex;
|
|
375
|
+
lastStringCount = countChars(string, '\n');
|
|
376
|
+
if (!exampleCodeRegExp.global) {
|
|
377
|
+
break;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
skipInit = true;
|
|
381
|
+
}
|
|
382
|
+
checkSource({
|
|
383
|
+
cols,
|
|
384
|
+
lines,
|
|
385
|
+
skipInit,
|
|
386
|
+
source,
|
|
387
|
+
sources,
|
|
388
|
+
tag,
|
|
389
|
+
targetTagName,
|
|
390
|
+
...matchingFilenameInfo
|
|
391
|
+
});
|
|
392
|
+
});
|
|
393
|
+
return textsAndFileNames;
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
// See https://eslint.org/docs/latest/extend/plugins#processors-in-plugins
|
|
397
|
+
// See https://eslint.org/docs/latest/extend/custom-processors
|
|
398
|
+
// From https://github.com/eslint/eslint/issues/14745#issuecomment-869457265
|
|
399
|
+
/*
|
|
400
|
+
{
|
|
401
|
+
"files": ["*.js", "*.ts"],
|
|
402
|
+
"processor": "jsdoc/example" // a pretended value here
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
"files": [
|
|
406
|
+
"*.js/*_jsdoc-example.js",
|
|
407
|
+
"*.ts/*_jsdoc-example.js",
|
|
408
|
+
"*.js/*_jsdoc-example.ts"
|
|
409
|
+
],
|
|
410
|
+
"rules": {
|
|
411
|
+
// specific rules for examples in jsdoc only here
|
|
412
|
+
// And other rules for `.js` and `.ts` will also be enabled for them
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
*/
|
|
416
|
+
return {
|
|
417
|
+
meta: {
|
|
418
|
+
name: 'eslint-plugin-jsdoc/processor',
|
|
419
|
+
version
|
|
420
|
+
},
|
|
421
|
+
processors: {
|
|
422
|
+
examples: {
|
|
423
|
+
meta: {
|
|
424
|
+
name: 'eslint-plugin-jsdoc/preprocessor',
|
|
425
|
+
version
|
|
426
|
+
},
|
|
427
|
+
/**
|
|
428
|
+
* @param {string} text
|
|
429
|
+
* @param {string} filename
|
|
430
|
+
*/
|
|
431
|
+
preprocess(text, filename) {
|
|
432
|
+
try {
|
|
433
|
+
let ast;
|
|
434
|
+
|
|
435
|
+
// May be running a second time so catch and ignore
|
|
436
|
+
try {
|
|
437
|
+
ast = parser
|
|
438
|
+
// @ts-expect-error Ok
|
|
439
|
+
? parser.parseForESLint(text, {
|
|
440
|
+
ecmaVersion: 'latest',
|
|
441
|
+
sourceType,
|
|
442
|
+
comment: true
|
|
443
|
+
}).ast : espree.parse(text, {
|
|
444
|
+
ecmaVersion: 'latest',
|
|
445
|
+
sourceType,
|
|
446
|
+
comment: true
|
|
447
|
+
});
|
|
448
|
+
} catch (err) {
|
|
449
|
+
return [text];
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/** @type {[number, number][]} */
|
|
453
|
+
const commentLineCols = [];
|
|
454
|
+
const jsdocComments = /** @type {import('estree').Comment[]} */(
|
|
455
|
+
/**
|
|
456
|
+
* @type {import('estree').Program & {
|
|
457
|
+
* comments?: import('estree').Comment[]
|
|
458
|
+
* }}
|
|
459
|
+
*/
|
|
460
|
+
ast.comments).filter(comment => {
|
|
461
|
+
return /^\*\s/u.test(comment.value);
|
|
462
|
+
}).map(comment => {
|
|
463
|
+
/* c8 ignore next -- Unsupporting processors only? */
|
|
464
|
+
const [start] = comment.range ?? [];
|
|
465
|
+
const textToStart = text.slice(0, start);
|
|
466
|
+
const [lines, cols] = getLinesCols(textToStart);
|
|
467
|
+
|
|
468
|
+
// const lines = [...textToStart.matchAll(/\n/gu)].length
|
|
469
|
+
// const lastLinePos = textToStart.lastIndexOf('\n');
|
|
470
|
+
// const cols = lastLinePos === -1
|
|
471
|
+
// ? 0
|
|
472
|
+
// : textToStart.slice(lastLinePos).length;
|
|
473
|
+
commentLineCols.push([lines, cols]);
|
|
474
|
+
return (0, _jsdoccomment.parseComment)(comment);
|
|
475
|
+
});
|
|
476
|
+
return [text, ...jsdocComments.flatMap((jsdoc, idx) => {
|
|
477
|
+
return getTextsAndFileNames(jsdoc, filename, commentLineCols[idx]);
|
|
478
|
+
}).filter(Boolean)];
|
|
479
|
+
/* c8 ignore next 3 */
|
|
480
|
+
} catch (err) {
|
|
481
|
+
console.log('err', filename, err);
|
|
482
|
+
}
|
|
483
|
+
},
|
|
484
|
+
/**
|
|
485
|
+
* @param {import('eslint').Linter.LintMessage[][]} messages
|
|
486
|
+
* @param {string} filename
|
|
487
|
+
*/
|
|
488
|
+
postprocess([jsMessages, ...messages], filename) {
|
|
489
|
+
messages.forEach((message, idx) => {
|
|
490
|
+
const {
|
|
491
|
+
targetTagName,
|
|
492
|
+
codeStartLine,
|
|
493
|
+
codeStartCol,
|
|
494
|
+
nonJSPrefacingCols,
|
|
495
|
+
commentLineCols
|
|
496
|
+
} = otherInfo[idx];
|
|
497
|
+
message.forEach(msg => {
|
|
498
|
+
const {
|
|
499
|
+
message,
|
|
500
|
+
ruleId,
|
|
501
|
+
severity,
|
|
502
|
+
fatal,
|
|
503
|
+
line,
|
|
504
|
+
column,
|
|
505
|
+
endColumn,
|
|
506
|
+
endLine
|
|
507
|
+
|
|
508
|
+
// Todo: Make fixable
|
|
509
|
+
// fix
|
|
510
|
+
// fix: {range: [number, number], text: string}
|
|
511
|
+
// suggestions: {desc: , messageId:, fix: }[],
|
|
512
|
+
} = msg;
|
|
513
|
+
const [codeCtxLine, codeCtxColumn] = commentLineCols;
|
|
514
|
+
const startLine = codeCtxLine + codeStartLine + line;
|
|
515
|
+
const startCol = 1 +
|
|
516
|
+
// Seems to need one more now
|
|
517
|
+
codeCtxColumn + codeStartCol + (
|
|
518
|
+
// This might not work for line 0, but line 0 is unlikely for examples
|
|
519
|
+
line <= 1 ? nonJSPrefacingCols + firstLinePrefixLength : preTagSpaceLength) + column;
|
|
520
|
+
msg.message = '@' + targetTagName + ' ' + (severity === 2 ? 'error' : 'warning') + (ruleId ? ' (' + ruleId + ')' : '') + ': ' + (fatal ? 'Fatal: ' : '') + message;
|
|
521
|
+
msg.line = startLine;
|
|
522
|
+
msg.column = startCol;
|
|
523
|
+
msg.endLine = endLine ? startLine + endLine : startLine;
|
|
524
|
+
// added `- column` to offset what `endColumn` already seemed to include
|
|
525
|
+
msg.endColumn = endColumn ? startCol - column + endColumn : startCol;
|
|
526
|
+
});
|
|
527
|
+
});
|
|
528
|
+
const ret = [...jsMessages].concat(...messages, ...extraMessages);
|
|
529
|
+
extraMessages = [];
|
|
530
|
+
return ret;
|
|
531
|
+
},
|
|
532
|
+
supportsAutofix: true
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
};
|
|
536
|
+
};
|
|
537
|
+
exports.getJsdocProcessorPlugin = getJsdocProcessorPlugin;
|
|
538
|
+
//# sourceMappingURL=getJsdocProcessorPlugin.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getJsdocProcessorPlugin.cjs","names":["_fs","require","espree","_interopRequireWildcard","_jsdocUtils","_jsdoccomment","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","version","JSON","parse","readFileSync","likelyNestedJSDocIndentSpace","preTagSpaceLength","firstLinePrefixLength","hasCaptionRegex","escapeStringRegexp","str","replaceAll","countChars","ch","match","RegExp","length","getLinesCols","text","matchLines","colDelta","slice","lastIndexOf","getJsdocProcessorPlugin","options","exampleCodeRegex","rejectExampleCodeRegex","checkExamples","checkDefaults","checkParams","checkProperties","matchingFileName","matchingFileNameDefaults","matchingFileNameParams","matchingFileNameProperties","paddedIndent","captionRequired","sourceType","parser","undefined","exampleCodeRegExp","rejectExampleCodeRegExp","getRegexFromString","otherInfo","extraMessages","getTextsAndFileNames","jsdoc","jsFileName","commentLineCols","textsAndFileNames","checkSource","filename","ext","defaultFileName","lines","cols","skipInit","source","targetTagName","sources","tag","line","push","nonJSPrefacingCols","nonJSPrefacingLines","string","addSourceInfo","src","file","number","codeStartLine","codeStartCol","targetSource","getFilenameInfo","includes","replace","filenameInfo","forEachPreferredTag","description","trim","getTagDescription","tagName","getPreferredTagName","hasTag","matchingFilenameInfo","column","severity","message","ruleId","test","startingIndex","lastStringCount","exampleCode","lastIndex","exec","index","n0","n1","preMatch","preMatchLines","nonJSPreface","nonJSPrefaceLineCount","idx","indexOf","charsInLastLine","global","meta","name","processors","examples","preprocess","ast","parseForESLint","ecmaVersion","comment","err","jsdocComments","comments","filter","value","map","start","range","textToStart","parseComment","flatMap","Boolean","console","log","postprocess","jsMessages","messages","forEach","msg","fatal","endColumn","endLine","codeCtxLine","codeCtxColumn","startLine","startCol","ret","concat","supportsAutofix","exports"],"sources":["../src/getJsdocProcessorPlugin.js"],"sourcesContent":["// Todo: Support TS by fenced block type\n\nimport {readFileSync} from 'fs';\nimport * as espree from 'espree';\nimport {\n getRegexFromString,\n forEachPreferredTag,\n getTagDescription,\n getPreferredTagName,\n hasTag,\n} from './jsdocUtils.js';\nimport {\n parseComment,\n} from '@es-joy/jsdoccomment';\n\nconst {version} = JSON.parse(\n // @ts-expect-error `Buffer` is ok for `JSON.parse`\n readFileSync('./package.json')\n);\n\n// const zeroBasedLineIndexAdjust = -1;\nconst likelyNestedJSDocIndentSpace = 1;\nconst preTagSpaceLength = 1;\n\n// If a space is present, we should ignore it\nconst firstLinePrefixLength = preTagSpaceLength;\n\nconst hasCaptionRegex = /^\\s*<caption>([\\s\\S]*?)<\\/caption>/u;\n\n/**\n * @param {string} str\n * @returns {string}\n */\nconst escapeStringRegexp = (str) => {\n return str.replaceAll(/[.*+?^${}()|[\\]\\\\]/gu, '\\\\$&');\n};\n\n/**\n * @param {string} str\n * @param {string} ch\n * @returns {import('./iterateJsdoc.js').Integer}\n */\nconst countChars = (str, ch) => {\n return (str.match(new RegExp(escapeStringRegexp(ch), 'gu')) || []).length;\n};\n\n/**\n * @param {string} text\n * @returns {[\n* import('./iterateJsdoc.js').Integer,\n* import('./iterateJsdoc.js').Integer\n* ]}\n*/\nconst getLinesCols = (text) => {\n const matchLines = countChars(text, '\\n');\n\n const colDelta = matchLines ?\n text.slice(text.lastIndexOf('\\n') + 1).length :\n text.length;\n\n return [\n matchLines, colDelta,\n ];\n};\n\n/**\n * @typedef {number} Integer\n */\n\n/**\n * @typedef {object} JsdocProcessorOptions\n * @property {boolean} [captionRequired]\n * @property {Integer} [paddedIndent]\n * @property {boolean} [checkDefaults]\n * @property {boolean} [checkParams]\n * @property {boolean} [checkExamples]\n * @property {boolean} [checkProperties]\n * @property {string} [matchingFileName]\n * @property {string} [matchingFileNameDefaults]\n * @property {string} [matchingFileNameParams]\n * @property {string} [matchingFileNameProperties]\n * @property {string} [exampleCodeRegex]\n * @property {string} [rejectExampleCodeRegex]\n * @property {\"script\"|\"module\"} [sourceType]\n * @property {import('eslint').Linter.FlatConfigParserModule} [parser]\n */\n\n/**\n * We use a function for the ability of the user to pass in a config, but\n * without requiring all users of the plugin to do so.\n * @param {JsdocProcessorOptions} [options]\n */\nexport const getJsdocProcessorPlugin = (options = {}) => {\n const {\n exampleCodeRegex = null,\n rejectExampleCodeRegex = null,\n checkExamples = true,\n checkDefaults = false,\n checkParams = false,\n checkProperties = false,\n matchingFileName = null,\n matchingFileNameDefaults = null,\n matchingFileNameParams = null,\n matchingFileNameProperties = null,\n paddedIndent = 0,\n captionRequired = false,\n sourceType = 'module',\n parser = undefined\n } = options;\n\n /** @type {RegExp} */\n let exampleCodeRegExp;\n /** @type {RegExp} */\n let rejectExampleCodeRegExp;\n\n if (exampleCodeRegex) {\n exampleCodeRegExp = getRegexFromString(exampleCodeRegex);\n }\n\n if (rejectExampleCodeRegex) {\n rejectExampleCodeRegExp = getRegexFromString(rejectExampleCodeRegex);\n }\n\n /**\n * @type {{\n * targetTagName: string,\n * ext: string,\n * codeStartLine: number,\n * codeStartCol: number,\n * nonJSPrefacingCols: number,\n * commentLineCols: [number, number]\n * }[]}\n */\n const otherInfo = [];\n\n /** @type {import('eslint').Linter.LintMessage[]} */\n let extraMessages = [];\n\n /**\n * @param {import('./iterateJsdoc.js').JsdocBlockWithInline} jsdoc\n * @param {string} jsFileName\n * @param {[number, number]} commentLineCols\n */\n const getTextsAndFileNames = (jsdoc, jsFileName, commentLineCols) => {\n /**\n * @type {{\n * text: string,\n * filename: string|null|undefined\n * }[]}\n */\n const textsAndFileNames = [];\n\n /**\n * @param {{\n * filename: string|null,\n * defaultFileName: string|undefined,\n * source: string,\n * targetTagName: string,\n * rules?: import('eslint').Linter.RulesRecord|undefined,\n * lines?: import('./iterateJsdoc.js').Integer,\n * cols?: import('./iterateJsdoc.js').Integer,\n * skipInit?: boolean,\n * ext: string,\n * sources?: {\n * nonJSPrefacingCols: import('./iterateJsdoc.js').Integer,\n * nonJSPrefacingLines: import('./iterateJsdoc.js').Integer,\n * string: string,\n * }[],\n * tag?: import('comment-parser').Spec & {\n * line?: import('./iterateJsdoc.js').Integer,\n * }|{\n * line: import('./iterateJsdoc.js').Integer,\n * }\n * }} cfg\n */\n const checkSource = ({\n filename,\n ext,\n defaultFileName,\n lines = 0,\n cols = 0,\n skipInit,\n source,\n targetTagName,\n sources = [],\n tag = {\n line: 0,\n },\n }) => {\n if (!skipInit) {\n sources.push({\n nonJSPrefacingCols: cols,\n nonJSPrefacingLines: lines,\n string: source,\n });\n }\n\n /**\n * @param {{\n * nonJSPrefacingCols: import('./iterateJsdoc.js').Integer,\n * nonJSPrefacingLines: import('./iterateJsdoc.js').Integer,\n * string: string\n * }} cfg\n */\n const addSourceInfo = function ({\n nonJSPrefacingCols,\n nonJSPrefacingLines,\n string,\n }) {\n const src = paddedIndent ?\n string.replaceAll(new RegExp(`(^|\\n) {${paddedIndent}}(?!$)`, 'gu'), '\\n') :\n string;\n\n // Programmatic ESLint API: https://eslint.org/docs/developer-guide/nodejs-api\n const file = filename || defaultFileName;\n\n if (!('line' in tag)) {\n tag.line = tag.source[0].number;\n }\n\n // NOTE: `tag.line` can be 0 if of form `/** @tag ... */`\n const codeStartLine = /**\n * @type {import('comment-parser').Spec & {\n * line: import('./iterateJsdoc.js').Integer,\n * }}\n */ (tag).line + nonJSPrefacingLines;\n const codeStartCol = likelyNestedJSDocIndentSpace;\n\n textsAndFileNames.push({\n text: src,\n filename: file,\n });\n otherInfo.push({\n targetTagName,\n ext,\n codeStartLine,\n codeStartCol,\n nonJSPrefacingCols,\n commentLineCols\n });\n };\n\n for (const targetSource of sources) {\n addSourceInfo(targetSource);\n }\n };\n\n /**\n *\n * @param {string|null} filename\n * @param {string} [ext] Since `eslint-plugin-markdown` v2, and\n * ESLint 7, this is the default which other JS-fenced rules will used.\n * Formerly \"md\" was the default.\n * @returns {{\n * defaultFileName: string|undefined,\n * filename: string|null,\n * ext: string\n * }}\n */\n const getFilenameInfo = (filename, ext = 'md/*.js') => {\n let defaultFileName;\n if (!filename) {\n if (typeof jsFileName === 'string' && jsFileName.includes('.')) {\n defaultFileName = jsFileName.replace(/\\.[^.]*$/u, `.${ext}`);\n } else {\n defaultFileName = `dummy.${ext}`;\n }\n }\n\n return {\n ext,\n defaultFileName,\n filename,\n };\n };\n\n if (checkDefaults) {\n const filenameInfo = getFilenameInfo(matchingFileNameDefaults, 'jsdoc-defaults');\n forEachPreferredTag(jsdoc, 'default', (tag, targetTagName) => {\n if (!tag.description.trim()) {\n return;\n }\n\n checkSource({\n source: `(${getTagDescription(tag)})`,\n targetTagName,\n ...filenameInfo,\n });\n });\n }\n\n if (checkParams) {\n const filenameInfo = getFilenameInfo(matchingFileNameParams, 'jsdoc-params');\n forEachPreferredTag(jsdoc, 'param', (tag, targetTagName) => {\n if (!tag.default || !tag.default.trim()) {\n return;\n }\n\n checkSource({\n source: `(${tag.default})`,\n targetTagName,\n ...filenameInfo,\n });\n });\n }\n\n if (checkProperties) {\n const filenameInfo = getFilenameInfo(matchingFileNameProperties, 'jsdoc-properties');\n forEachPreferredTag(jsdoc, 'property', (tag, targetTagName) => {\n if (!tag.default || !tag.default.trim()) {\n return;\n }\n\n checkSource({\n source: `(${tag.default})`,\n targetTagName,\n ...filenameInfo,\n });\n });\n }\n\n if (!checkExamples) {\n return textsAndFileNames;\n }\n\n const tagName = /** @type {string} */ (getPreferredTagName(jsdoc, {\n tagName: 'example',\n }));\n if (!hasTag(jsdoc, tagName)) {\n return textsAndFileNames;\n }\n\n const matchingFilenameInfo = getFilenameInfo(matchingFileName);\n\n forEachPreferredTag(jsdoc, 'example', (tag, targetTagName) => {\n let source = /** @type {string} */ (getTagDescription(tag));\n const match = source.match(hasCaptionRegex);\n\n if (captionRequired && (!match || !match[1].trim())) {\n extraMessages.push({\n line: 1 + commentLineCols[0] + (tag.line ?? tag.source[0].number),\n column: commentLineCols[1] + 1,\n severity: 2,\n message: `@${targetTagName} error - Caption is expected for examples.`,\n ruleId: 'jsdoc/example-missing-caption'\n });\n return;\n }\n\n source = source.replace(hasCaptionRegex, '');\n const [\n lines,\n cols,\n ] = match ? getLinesCols(match[0]) : [\n 0, 0,\n ];\n\n if (exampleCodeRegex && !exampleCodeRegExp.test(source) ||\n rejectExampleCodeRegex && rejectExampleCodeRegExp.test(source)\n ) {\n return;\n }\n\n const sources = [];\n let skipInit = false;\n if (exampleCodeRegex) {\n let nonJSPrefacingCols = 0;\n let nonJSPrefacingLines = 0;\n\n let startingIndex = 0;\n let lastStringCount = 0;\n\n let exampleCode;\n exampleCodeRegExp.lastIndex = 0;\n while ((exampleCode = exampleCodeRegExp.exec(source)) !== null) {\n const {\n index,\n '0': n0,\n '1': n1,\n } = exampleCode;\n\n // Count anything preceding user regex match (can affect line numbering)\n const preMatch = source.slice(startingIndex, index);\n\n const [\n preMatchLines,\n colDelta,\n ] = getLinesCols(preMatch);\n\n let nonJSPreface;\n let nonJSPrefaceLineCount;\n if (n1) {\n const idx = n0.indexOf(n1);\n nonJSPreface = n0.slice(0, idx);\n nonJSPrefaceLineCount = countChars(nonJSPreface, '\\n');\n } else {\n nonJSPreface = '';\n nonJSPrefaceLineCount = 0;\n }\n\n nonJSPrefacingLines += lastStringCount + preMatchLines + nonJSPrefaceLineCount;\n\n // Ignore `preMatch` delta if newlines here\n if (nonJSPrefaceLineCount) {\n const charsInLastLine = nonJSPreface.slice(nonJSPreface.lastIndexOf('\\n') + 1).length;\n\n nonJSPrefacingCols += charsInLastLine;\n } else {\n nonJSPrefacingCols += colDelta + nonJSPreface.length;\n }\n\n const string = n1 || n0;\n sources.push({\n nonJSPrefacingCols,\n nonJSPrefacingLines,\n string,\n });\n startingIndex = exampleCodeRegExp.lastIndex;\n lastStringCount = countChars(string, '\\n');\n if (!exampleCodeRegExp.global) {\n break;\n }\n }\n\n skipInit = true;\n }\n\n checkSource({\n cols,\n lines,\n skipInit,\n source,\n sources,\n tag,\n targetTagName,\n ...matchingFilenameInfo,\n });\n });\n\n return textsAndFileNames;\n };\n\n // See https://eslint.org/docs/latest/extend/plugins#processors-in-plugins\n // See https://eslint.org/docs/latest/extend/custom-processors\n // From https://github.com/eslint/eslint/issues/14745#issuecomment-869457265\n /*\n {\n \"files\": [\"*.js\", \"*.ts\"],\n \"processor\": \"jsdoc/example\" // a pretended value here\n },\n {\n \"files\": [\n \"*.js/*_jsdoc-example.js\",\n \"*.ts/*_jsdoc-example.js\",\n \"*.js/*_jsdoc-example.ts\"\n ],\n \"rules\": {\n // specific rules for examples in jsdoc only here\n // And other rules for `.js` and `.ts` will also be enabled for them\n }\n }\n */\n return {\n meta: {\n name: 'eslint-plugin-jsdoc/processor',\n version,\n },\n processors: {\n examples: {\n meta: {\n name: 'eslint-plugin-jsdoc/preprocessor',\n version,\n },\n /**\n * @param {string} text\n * @param {string} filename\n */\n preprocess (text, filename) {\n try {\n let ast;\n\n // May be running a second time so catch and ignore\n try {\n ast = parser\n // @ts-expect-error Ok\n ? parser.parseForESLint(text, {\n ecmaVersion: 'latest',\n sourceType,\n comment: true\n }).ast\n : espree.parse(text, {\n ecmaVersion: 'latest',\n sourceType,\n comment: true\n });\n } catch (err) {\n return [text];\n }\n\n /** @type {[number, number][]} */\n const commentLineCols = [];\n const jsdocComments = /** @type {import('estree').Comment[]} */ (\n /**\n * @type {import('estree').Program & {\n * comments?: import('estree').Comment[]\n * }}\n */\n (ast).comments\n ).filter((comment) => {\n return (/^\\*\\s/u).test(comment.value);\n }).map((comment) => {\n /* c8 ignore next -- Unsupporting processors only? */\n const [start] = comment.range ?? [];\n const textToStart = text.slice(0, start);\n\n const [lines, cols] = getLinesCols(textToStart);\n\n // const lines = [...textToStart.matchAll(/\\n/gu)].length\n // const lastLinePos = textToStart.lastIndexOf('\\n');\n // const cols = lastLinePos === -1\n // ? 0\n // : textToStart.slice(lastLinePos).length;\n commentLineCols.push([lines, cols]);\n return parseComment(comment);\n });\n\n return [\n text,\n ...jsdocComments.flatMap((jsdoc, idx) => {\n return getTextsAndFileNames(\n jsdoc,\n filename,\n commentLineCols[idx]\n );\n }).filter(Boolean)\n ];\n /* c8 ignore next 3 */\n } catch (err) {\n console.log('err', filename, err);\n }\n },\n\n /**\n * @param {import('eslint').Linter.LintMessage[][]} messages\n * @param {string} filename\n */\n postprocess ([jsMessages, ...messages], filename) {\n messages.forEach((message, idx) => {\n const {\n targetTagName,\n codeStartLine,\n codeStartCol,\n nonJSPrefacingCols,\n commentLineCols\n } = otherInfo[idx];\n\n message.forEach((msg) => {\n const {\n message,\n ruleId,\n severity,\n fatal,\n line,\n column,\n endColumn,\n endLine,\n\n // Todo: Make fixable\n // fix\n // fix: {range: [number, number], text: string}\n // suggestions: {desc: , messageId:, fix: }[],\n } = msg;\n\n const [codeCtxLine, codeCtxColumn] = commentLineCols;\n const startLine = codeCtxLine + codeStartLine + line;\n const startCol = 1 + // Seems to need one more now\n codeCtxColumn + codeStartCol + (\n // This might not work for line 0, but line 0 is unlikely for examples\n line <= 1 ? nonJSPrefacingCols + firstLinePrefixLength : preTagSpaceLength\n ) + column;\n\n msg.message = '@' + targetTagName + ' ' + (severity === 2 ? 'error' : 'warning') +\n (ruleId ? ' (' + ruleId + ')' : '') + ': ' +\n (fatal ? 'Fatal: ' : '') +\n message;\n msg.line = startLine;\n msg.column = startCol;\n msg.endLine = endLine ? startLine + endLine : startLine;\n // added `- column` to offset what `endColumn` already seemed to include\n msg.endColumn = endColumn ? startCol - column + endColumn : startCol;\n });\n });\n\n const ret = [...jsMessages].concat(...messages, ...extraMessages);\n extraMessages = [];\n return ret;\n },\n supportsAutofix: true\n },\n },\n };\n};\n"],"mappings":";;;;;;AAEA,IAAAA,GAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAOA,IAAAI,aAAA,GAAAJ,OAAA;AAE8B,SAAAK,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,C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