@@ -16,6 +16,17 @@ import {
16
16
join ,
17
17
} from 'node:path' ;
18
18
19
+ /**
20
+ * @import {
21
+ * Integer,
22
+ * JsdocBlockWithInline,
23
+ * } from './iterateJsdoc.js';
24
+ * @import {
25
+ * ESLint,
26
+ * Linter,
27
+ * } from 'eslint';
28
+ */
29
+
19
30
const {
20
31
version,
21
32
} = JSON . parse (
@@ -43,7 +54,7 @@ const escapeStringRegexp = (str) => {
43
54
/**
44
55
* @param {string } str
45
56
* @param {string } ch
46
- * @returns {import('./iterateJsdoc.js'). Integer }
57
+ * @returns {Integer }
47
58
*/
48
59
const countChars = ( str , ch ) => {
49
60
return ( str . match ( new RegExp ( escapeStringRegexp ( ch ) , 'gv' ) ) || [ ] ) . length ;
@@ -52,8 +63,8 @@ const countChars = (str, ch) => {
52
63
/**
53
64
* @param {string } text
54
65
* @returns {[
55
- * import('./iterateJsdoc.js'). Integer,
56
- * import('./iterateJsdoc.js'). Integer
66
+ * Integer,
67
+ * Integer
57
68
* ]}
58
69
*/
59
70
const getLinesCols = ( text ) => {
@@ -95,6 +106,7 @@ const getLinesCols = (text) => {
95
106
* We use a function for the ability of the user to pass in a config, but
96
107
* without requiring all users of the plugin to do so.
97
108
* @param {JsdocProcessorOptions } [options]
109
+ * @returns {ESLint.Plugin }
98
110
*/
99
111
export const getJsdocProcessorPlugin = ( options = { } ) => {
100
112
const {
@@ -150,7 +162,7 @@ export const getJsdocProcessorPlugin = (options = {}) => {
150
162
let extraMessages = [ ] ;
151
163
152
164
/**
153
- * @param {import('./iterateJsdoc.js'). JsdocBlockWithInline } jsdoc
165
+ * @param {JsdocBlockWithInline } jsdoc
154
166
* @param {string } jsFileName
155
167
* @param {[number, number] } commentLineCols
156
168
*/
@@ -170,19 +182,19 @@ export const getJsdocProcessorPlugin = (options = {}) => {
170
182
* source: string,
171
183
* targetTagName: string,
172
184
* rules?: import('eslint').Linter.RulesRecord|undefined,
173
- * lines?: import('./iterateJsdoc.js'). Integer,
174
- * cols?: import('./iterateJsdoc.js'). Integer,
185
+ * lines?: Integer,
186
+ * cols?: Integer,
175
187
* skipInit?: boolean,
176
188
* ext: string,
177
189
* sources?: {
178
- * nonJSPrefacingCols: import('./iterateJsdoc.js'). Integer,
179
- * nonJSPrefacingLines: import('./iterateJsdoc.js'). Integer,
190
+ * nonJSPrefacingCols: Integer,
191
+ * nonJSPrefacingLines: Integer,
180
192
* string: string,
181
193
* }[],
182
194
* tag?: import('comment-parser').Spec & {
183
- * line?: import('./iterateJsdoc.js'). Integer,
195
+ * line?: Integer,
184
196
* }|{
185
- * line: import('./iterateJsdoc.js'). Integer,
197
+ * line: Integer,
186
198
* }
187
199
* }} cfg
188
200
*/
@@ -210,8 +222,8 @@ export const getJsdocProcessorPlugin = (options = {}) => {
210
222
211
223
/**
212
224
* @param {{
213
- * nonJSPrefacingCols: import('./iterateJsdoc.js'). Integer,
214
- * nonJSPrefacingLines: import('./iterateJsdoc.js'). Integer,
225
+ * nonJSPrefacingCols: Integer,
226
+ * nonJSPrefacingLines: Integer,
215
227
* string: string
216
228
* }} cfg
217
229
*/
@@ -234,7 +246,7 @@ export const getJsdocProcessorPlugin = (options = {}) => {
234
246
// NOTE: `tag.line` can be 0 if of form `/** @tag ... */`
235
247
const codeStartLine = /**
236
248
* @type {import('comment-parser').Spec & {
237
- * line: import('./iterateJsdoc.js'). Integer,
249
+ * line: Integer,
238
250
* }}
239
251
*/ ( tag ) . line + nonJSPrefacingLines ;
240
252
const codeStartCol = likelyNestedJSDocIndentSpace ;
@@ -567,6 +579,7 @@ export const getJsdocProcessorPlugin = (options = {}) => {
567
579
/**
568
580
* @param {string } text
569
581
* @param {string } filename
582
+ * @returns {(string | Linter.ProcessorFile)[] }
570
583
*/
571
584
preprocess ( text , filename ) {
572
585
try {
@@ -634,7 +647,14 @@ export const getJsdocProcessorPlugin = (options = {}) => {
634
647
filename ,
635
648
commentLineCols [ idx ] ,
636
649
) ;
637
- } ) . filter ( Boolean ) ,
650
+ } ) . filter (
651
+ /**
652
+ * @returns {file is Linter.ProcessorFile }
653
+ */
654
+ ( file ) => {
655
+ return file !== null && file !== undefined ;
656
+ } ,
657
+ ) ,
638
658
] ;
639
659
/* c8 ignore next 6 */
640
660
} catch ( error ) {
0 commit comments