@cffnpwr/textlint-rule-no-chained-continuative 0.0.0 → 1.0.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.
@@ -0,0 +1,692 @@
1
+ /**
2
+ * ASTNodeTypes is a list of ASTNode type.
3
+ */
4
+ declare enum ASTNodeTypes {
5
+ Document = "Document",
6
+ DocumentExit = "Document:exit",
7
+ Paragraph = "Paragraph",
8
+ ParagraphExit = "Paragraph:exit",
9
+ BlockQuote = "BlockQuote",
10
+ BlockQuoteExit = "BlockQuote:exit",
11
+ ListItem = "ListItem",
12
+ ListItemExit = "ListItem:exit",
13
+ List = "List",
14
+ ListExit = "List:exit",
15
+ Header = "Header",
16
+ HeaderExit = "Header:exit",
17
+ CodeBlock = "CodeBlock",
18
+ CodeBlockExit = "CodeBlock:exit",
19
+ /**
20
+ * @deprecated use Html instead of it
21
+ */
22
+ HtmlBlock = "HtmlBlock",
23
+ HtmlBlockExit = "HtmlBlock:exit",
24
+ HorizontalRule = "HorizontalRule",
25
+ HorizontalRuleExit = "HorizontalRule:exit",
26
+ Comment = "Comment",
27
+ CommentExit = "Comment:exit",
28
+ /**
29
+ * @deprecated
30
+ */
31
+ ReferenceDef = "ReferenceDef",
32
+ /**
33
+ * @deprecated
34
+ */
35
+ ReferenceDefExit = "ReferenceDef:exit",
36
+ Str = "Str",
37
+ StrExit = "Str:exit",
38
+ Break = "Break", // well-known Hard Break
39
+ BreakExit = "Break:exit", // well-known Hard Break
40
+ Emphasis = "Emphasis",
41
+ EmphasisExit = "Emphasis:exit",
42
+ Strong = "Strong",
43
+ StrongExit = "Strong:exit",
44
+ Html = "Html",
45
+ HtmlExit = "Html:exit",
46
+ Link = "Link",
47
+ LinkExit = "Link:exit",
48
+ LinkReference = "LinkReference",
49
+ LinkReferenceExit = "LinkReference:exit",
50
+ Image = "Image",
51
+ ImageExit = "Image:exit",
52
+ ImageReference = "ImageReference",
53
+ ImageReferenceExit = "ImageReference:exit",
54
+ Definition = "Definition",
55
+ DefinitionExit = "Definition:exit",
56
+ Code = "Code",
57
+ CodeExit = "Code:exit",
58
+ Delete = "Delete",
59
+ DeleteExit = "Delete:exit",
60
+ Table = "Table",
61
+ TableExit = "Table:exit",
62
+ TableRow = "TableRow",
63
+ TableRowExit = "TableRow:exit",
64
+ TableCell = "TableCell",
65
+ TableCellExit = "TableCell:exit"
66
+ }
67
+ /**
68
+ * Key of ASTNodeTypes or any string
69
+ * For example, TxtNodeType is "Document".
70
+ */
71
+ type TxtNodeType = keyof typeof ASTNodeTypes;
72
+ /**
73
+ * Any TxtNode types
74
+ */
75
+ type AnyTxtNode = TxtNode | TxtTextNode | TxtParentNode;
76
+ /**
77
+ * Position's line start with 1.
78
+ * Position's column start with 0.
79
+ * This is for compatibility with JavaScript AST.
80
+ * https://gist.github.com/azu/8866b2cb9b7a933e01fe
81
+ */
82
+ type TxtNodePosition = {
83
+ readonly line: number;
84
+ readonly column: number;
85
+ };
86
+ /**
87
+ * Location
88
+ */
89
+ type TxtNodeLocation = {
90
+ readonly start: TxtNodePosition;
91
+ readonly end: TxtNodePosition;
92
+ };
93
+ /**
94
+ * Range starts with 0
95
+ */
96
+ type TxtNodeRange = readonly [startIndex: number, endIndex: number];
97
+ /**
98
+ * TxtNode is abstract interface of AST Node.
99
+ * Probably, Real TxtNode implementation has more properties.
100
+ */
101
+ interface TxtNode {
102
+ readonly type: TxtNodeType;
103
+ readonly raw: string;
104
+ readonly range: TxtNodeRange;
105
+ readonly loc: TxtNodeLocation;
106
+ readonly parent?: TxtParentNode;
107
+ }
108
+ /**
109
+ * Text Node.
110
+ * Text Node has inline value.
111
+ * For example, `Str` Node is an TxtTextNode.
112
+ */
113
+ interface TxtTextNode extends TxtNode {
114
+ readonly value: string;
115
+ }
116
+ /**
117
+ * Parent Node.
118
+ * Parent Node has children that are consist of TxtParentNode or TxtTextNode
119
+ */
120
+ interface TxtParentNode extends TxtNode {
121
+ readonly children: readonly Content[];
122
+ }
123
+ type AlignType = "left" | "right" | "center" | null;
124
+ type ReferenceType = "shortcut" | "collapsed" | "full";
125
+ type Content = TopLevelContent | ListContent | TableContent | RowContent | PhrasingContent;
126
+ /**
127
+ * All node definition types.
128
+ */
129
+ type TopLevelContent = BlockContent;
130
+ /**
131
+ * All node types that may be used where markdown block content is accepted.
132
+ * These types are accepted inside block quotes, list items, and roots.
133
+ */
134
+ type BlockContent = TxtParagraphNode | TxtHeaderNode | TxtHorizontalRuleNode | TxtBlockQuoteNode | TxtListNode | TxtTableNode | TxtHtmlNode | TxtCodeBlockNode;
135
+ /**
136
+ * All node types that are acceptable inside lists.
137
+ */
138
+ type ListContent = TxtListItemNode;
139
+ /**
140
+ * All node types that are acceptable inside tables (not table cells).
141
+ */
142
+ type TableContent = TxtTableRowNode;
143
+ /**
144
+ * All node types that are acceptable inside tables rows (not table cells)
145
+ */
146
+ type RowContent = TxtTableCellNode;
147
+ /**
148
+ * All node types that are acceptable in a (interactive) phrasing context (so not in links).
149
+ */
150
+ type PhrasingContent = TxtLinkNode | StaticPhrasingContent;
151
+ /**
152
+ * All node types that are acceptable in a static phrasing context.
153
+ */
154
+ type StaticPhrasingContent = TxtStrNode | TxtEmphasisNode | TxtStrongNode | TxtDeleteNode | TxtHtmlNode | TxtCodeNode | TxtBreakNode | TxtImageNode | TxtCommentNode;
155
+ interface TxtDocumentNode extends TxtParentNode {
156
+ readonly type: "Document";
157
+ }
158
+ interface TxtParagraphNode extends TxtParentNode {
159
+ readonly type: "Paragraph";
160
+ readonly children: readonly PhrasingContent[];
161
+ }
162
+ interface TxtHeaderNode extends TxtParentNode {
163
+ readonly type: "Header";
164
+ readonly depth: 1 | 2 | 3 | 4 | 5 | 6;
165
+ readonly children: readonly PhrasingContent[];
166
+ }
167
+ interface TxtHorizontalRuleNode extends TxtNode {
168
+ readonly type: "HorizontalRule";
169
+ }
170
+ interface TxtBlockQuoteNode extends TxtParentNode {
171
+ readonly type: "BlockQuote";
172
+ readonly children: readonly BlockContent[];
173
+ }
174
+ interface TxtListNode extends TxtParentNode {
175
+ readonly type: "List";
176
+ readonly ordered?: boolean | null | undefined;
177
+ readonly start?: number | null | undefined;
178
+ readonly spread?: boolean | null | undefined;
179
+ readonly children: readonly ListContent[];
180
+ }
181
+ interface TxtListItemNode extends TxtParentNode {
182
+ readonly type: "ListItem";
183
+ readonly checked?: boolean | null | undefined;
184
+ readonly spread?: boolean | null | undefined;
185
+ readonly children: readonly BlockContent[];
186
+ }
187
+ interface TxtTableNode extends TxtParentNode {
188
+ readonly type: "Table";
189
+ readonly align?: readonly AlignType[] | null | undefined;
190
+ readonly children: readonly TableContent[];
191
+ }
192
+ interface TxtTableRowNode extends TxtParentNode {
193
+ readonly type: "TableRow";
194
+ readonly children: readonly RowContent[];
195
+ }
196
+ interface TxtTableCellNode extends TxtParentNode {
197
+ readonly type: "TableCell";
198
+ readonly children: readonly PhrasingContent[];
199
+ }
200
+ interface TxtHtmlNode extends TxtTextNode {
201
+ readonly type: "Html";
202
+ }
203
+ interface TxtCommentNode extends TxtTextNode {
204
+ readonly type: "Comment";
205
+ }
206
+ interface TxtCodeBlockNode extends TxtTextNode {
207
+ readonly type: "CodeBlock";
208
+ readonly lang?: string | null | undefined;
209
+ readonly meta?: string | null | undefined;
210
+ }
211
+ interface TxtStrNode extends TxtTextNode {
212
+ readonly type: "Str";
213
+ }
214
+ interface TxtEmphasisNode extends TxtParentNode {
215
+ readonly type: "Emphasis";
216
+ readonly children: readonly PhrasingContent[];
217
+ }
218
+ interface TxtStrongNode extends TxtParentNode {
219
+ readonly type: "Strong";
220
+ readonly children: readonly PhrasingContent[];
221
+ }
222
+ interface TxtDeleteNode extends TxtParentNode {
223
+ readonly type: "Delete";
224
+ readonly children: readonly PhrasingContent[];
225
+ }
226
+ interface TxtCodeNode extends TxtTextNode {
227
+ readonly type: "Code";
228
+ }
229
+ interface TxtBreakNode extends TxtNode {
230
+ readonly type: "Break";
231
+ }
232
+ interface TxtLinkNode extends TxtParentNode, TxtResource {
233
+ readonly type: "Link";
234
+ readonly children: readonly StaticPhrasingContent[];
235
+ }
236
+ interface TxtLinkReferenceNode extends TxtParentNode, TxtReference {
237
+ readonly type: "LinkReference";
238
+ readonly children: readonly StaticPhrasingContent[];
239
+ readonly referenceType: ReferenceType;
240
+ }
241
+ interface TxtImageNode extends TxtNode, TxtResource, TxtAlternative {
242
+ readonly type: "Image";
243
+ }
244
+ interface TxtImageReferenceNode extends TxtNode, TxtAlternative, TxtReference {
245
+ readonly type: "ImageReference";
246
+ readonly referenceType: ReferenceType;
247
+ }
248
+ interface TxtDefinitionNode extends TxtNode, TxtResource, TxtReference {
249
+ readonly type: "Definition";
250
+ }
251
+ interface TxtResource {
252
+ readonly url: string;
253
+ readonly title?: string | null | undefined;
254
+ }
255
+ interface TxtAlternative {
256
+ readonly alt?: string | null | undefined;
257
+ }
258
+ interface TxtReference {
259
+ readonly identifier: string;
260
+ readonly label: string;
261
+ }
262
+ /**
263
+ * Mapping from ASTNodeTypes (enter/exit) to the corresponding TxtNode interface.
264
+ */
265
+ interface TxtNodeTypeMap {
266
+ [ASTNodeTypes.Document]: TxtDocumentNode;
267
+ [ASTNodeTypes.DocumentExit]: TxtDocumentNode;
268
+ [ASTNodeTypes.Paragraph]: TxtParagraphNode;
269
+ [ASTNodeTypes.ParagraphExit]: TxtParagraphNode;
270
+ [ASTNodeTypes.BlockQuote]: TxtBlockQuoteNode;
271
+ [ASTNodeTypes.BlockQuoteExit]: TxtBlockQuoteNode;
272
+ [ASTNodeTypes.List]: TxtListNode;
273
+ [ASTNodeTypes.ListExit]: TxtListNode;
274
+ [ASTNodeTypes.ListItem]: TxtListItemNode;
275
+ [ASTNodeTypes.ListItemExit]: TxtListItemNode;
276
+ [ASTNodeTypes.Header]: TxtHeaderNode;
277
+ [ASTNodeTypes.HeaderExit]: TxtHeaderNode;
278
+ [ASTNodeTypes.CodeBlock]: TxtCodeBlockNode;
279
+ [ASTNodeTypes.CodeBlockExit]: TxtCodeBlockNode;
280
+ [ASTNodeTypes.HtmlBlock]: TxtHtmlNode;
281
+ [ASTNodeTypes.HtmlBlockExit]: TxtHtmlNode;
282
+ [ASTNodeTypes.Link]: TxtLinkNode;
283
+ [ASTNodeTypes.LinkExit]: TxtLinkNode;
284
+ [ASTNodeTypes.LinkReference]: TxtLinkReferenceNode;
285
+ [ASTNodeTypes.LinkReferenceExit]: TxtLinkReferenceNode;
286
+ [ASTNodeTypes.Delete]: TxtDeleteNode;
287
+ [ASTNodeTypes.DeleteExit]: TxtDeleteNode;
288
+ [ASTNodeTypes.Emphasis]: TxtEmphasisNode;
289
+ [ASTNodeTypes.EmphasisExit]: TxtEmphasisNode;
290
+ [ASTNodeTypes.Strong]: TxtStrongNode;
291
+ [ASTNodeTypes.StrongExit]: TxtStrongNode;
292
+ [ASTNodeTypes.Break]: TxtBreakNode;
293
+ [ASTNodeTypes.BreakExit]: TxtBreakNode;
294
+ [ASTNodeTypes.Image]: TxtImageNode;
295
+ [ASTNodeTypes.ImageExit]: TxtImageNode;
296
+ [ASTNodeTypes.ImageReference]: TxtImageReferenceNode;
297
+ [ASTNodeTypes.ImageReferenceExit]: TxtImageReferenceNode;
298
+ [ASTNodeTypes.Definition]: TxtDefinitionNode;
299
+ [ASTNodeTypes.DefinitionExit]: TxtDefinitionNode;
300
+ [ASTNodeTypes.HorizontalRule]: TxtHorizontalRuleNode;
301
+ [ASTNodeTypes.HorizontalRuleExit]: TxtHorizontalRuleNode;
302
+ [ASTNodeTypes.Comment]: TxtCommentNode;
303
+ [ASTNodeTypes.CommentExit]: TxtCommentNode;
304
+ [ASTNodeTypes.Str]: TxtStrNode;
305
+ [ASTNodeTypes.StrExit]: TxtStrNode;
306
+ [ASTNodeTypes.Code]: TxtCodeNode;
307
+ [ASTNodeTypes.CodeExit]: TxtCodeNode;
308
+ [ASTNodeTypes.Html]: TxtHtmlNode;
309
+ [ASTNodeTypes.HtmlExit]: TxtHtmlNode;
310
+ [ASTNodeTypes.Table]: TxtTableNode;
311
+ [ASTNodeTypes.TableExit]: TxtTableNode;
312
+ [ASTNodeTypes.TableRow]: TxtTableRowNode;
313
+ [ASTNodeTypes.TableRowExit]: TxtTableRowNode;
314
+ [ASTNodeTypes.TableCell]: TxtTableCellNode;
315
+ [ASTNodeTypes.TableCellExit]: TxtTableCellNode;
316
+ }
317
+ /**
318
+ * Type utility for TxtNodeType
319
+ * Return TxtNode interface for the TxtNodeType
320
+ *
321
+ * @example
322
+ * ```ts
323
+ * type NodeType = TypeofTxtNode<ASTNodeTypes.Document>;
324
+ * ```
325
+ */
326
+ type TypeofTxtNode<T extends ASTNodeTypes | string> = T extends keyof TxtNodeTypeMap ? TxtNodeTypeMap[T] : AnyTxtNode;
327
+ type TextlintSourceCodeRange = readonly [startIndex: number, endIndex: number];
328
+ /**
329
+ * `RuleReporterFixCommand` is intermediate object between Rule report and Kernel.
330
+ * `IntermediateFixCommand` has also `isAbsolute` flag value.
331
+ */
332
+ interface TextlintRuleContextFixCommand {
333
+ text: string;
334
+ range: readonly [startIndex: number, endIndex: number];
335
+ isAbsolute: boolean;
336
+ }
337
+ interface TextlintRuleSuggestion {
338
+ id: string;
339
+ message: string;
340
+ fix: TextlintRuleContextFixCommand;
341
+ }
342
+ type TextlintRuleErrorPaddingLocationLoc = {
343
+ start: {
344
+ line: number;
345
+ column: number;
346
+ };
347
+ end: {
348
+ line: number;
349
+ column: number;
350
+ };
351
+ };
352
+ type TextlintRuleErrorPaddingLocationRange = readonly [startIndex: number, endIndex: number];
353
+ type TextlintRuleErrorPaddingLocation = {
354
+ type: "TextlintRuleErrorPaddingLocation";
355
+ isAbsolute: boolean;
356
+ range: TextlintRuleErrorPaddingLocationRange;
357
+ } | {
358
+ type: "TextlintRuleErrorPaddingLocation";
359
+ isAbsolute: boolean;
360
+ loc: TextlintRuleErrorPaddingLocationLoc;
361
+ };
362
+ type TextlintRuleErrorDetails = {
363
+ /**
364
+ * @deprecated use `padding` property
365
+ * ```
366
+ * report(node, new RuleError(message, {
367
+ * padding: locator.loc({
368
+ * start: {
369
+ * line: 1,
370
+ * column: 1
371
+ * },
372
+ * end: {
373
+ * line: 1,
374
+ * column: 2
375
+ * }
376
+ * })
377
+ * }));
378
+ * ```
379
+ */
380
+ line?: number;
381
+ /**
382
+ * @deprecated use `padding` property
383
+ * ```
384
+ * report(node, new RuleError(message, {
385
+ * padding: locator.loc({
386
+ * start: {
387
+ * line: 1,
388
+ * column: 1
389
+ * },
390
+ * end: {
391
+ * line: 1,
392
+ * column: 2
393
+ * }
394
+ * })
395
+ * }));
396
+ * ```
397
+ */
398
+ column?: number;
399
+ /**
400
+ * @deprecated use `padding` property
401
+ * ```
402
+ * report(node, new RuleError(message, {
403
+ * padding: locator.range([index, index + 1])
404
+ * }))
405
+ * ```
406
+ */
407
+ index?: number;
408
+ /**
409
+ * Pass the range for start and end of the reported error.
410
+ * textlint rule's context provide `locator` object as helper.
411
+ *
412
+ * ```
413
+ * const { report, RuleError, locator } = context;
414
+ * // at = range([index, index + 1]);
415
+ * report(node, new RuleError(message, {
416
+ * padding: locator.at(index)
417
+ * }));
418
+ * // range
419
+ * report(node, new RuleError(message, {
420
+ * padding: locator.range([startIndex, endIndex])
421
+ * });
422
+ * // loc = line and column
423
+ * report(node, new RuleError(message, {
424
+ * padding: locator.loc({
425
+ * start: {
426
+ * line: 1,
427
+ * column: 1
428
+ * },
429
+ * end: {
430
+ * line: 1,
431
+ * column: 2
432
+ * }
433
+ * })
434
+ * }));
435
+ */
436
+ padding?: TextlintRuleErrorPaddingLocation;
437
+ fix?: TextlintRuleContextFixCommand;
438
+ suggestions?: TextlintRuleSuggestion[];
439
+ };
440
+ /**
441
+ * Object version of RuleError
442
+ * It is undocumented way. Please don't use it.
443
+ *
444
+ * report(node, {
445
+ * message: ""
446
+ * })
447
+ */
448
+ type TextlintRuleReportedObject = TextlintRuleErrorDetails & {
449
+ message: string;
450
+ [index: string]: any;
451
+ };
452
+ interface TextlintRuleErrorConstructor {
453
+ new (message: string, paddingLocation?: number | TextlintRuleErrorDetails): TextlintRuleError;
454
+ }
455
+ interface TextlintRuleError {
456
+ readonly message: string;
457
+ /**
458
+ * @deprecated use `padding` property
459
+ */
460
+ readonly line?: number;
461
+ /**
462
+ * @deprecated use `padding` property
463
+ */
464
+ readonly column?: number;
465
+ /**
466
+ * @deprecated use `padding` property
467
+ */
468
+ readonly index?: number;
469
+ readonly padding?: TextlintRuleErrorPaddingLocation;
470
+ readonly fix?: TextlintRuleContextFixCommand;
471
+ readonly suggestions?: TextlintRuleSuggestion[];
472
+ }
473
+ type TextlintRulePaddingLocator = {
474
+ /**
475
+ * at's index is 0-based value.
476
+ * It is alias to `range([index, index + 1])`
477
+ * @param index relative index from node's start position
478
+ */
479
+ at(index: number): TextlintRuleErrorPaddingLocation;
480
+ /**
481
+ * range's index is 0-based value
482
+ * @param range relative range from node's start position
483
+ */
484
+ range(range: readonly [startIndex: number, endIndex: number]): TextlintRuleErrorPaddingLocation;
485
+ /**
486
+ * line is relative padding value from node's start position
487
+ * column is relative padding value from node's start position
488
+ * @param location relative location from node's start position
489
+ */
490
+ loc(location: {
491
+ start: {
492
+ line: number;
493
+ column: number;
494
+ };
495
+ end: {
496
+ line: number;
497
+ column: number;
498
+ };
499
+ }): TextlintRuleErrorPaddingLocation;
500
+ };
501
+ /**
502
+ * Creates code fixing commands for rules.
503
+ * It create command for fixing texts.
504
+ * The `range` arguments of these command is should be **relative** value from reported node.
505
+ * See {@link SourceLocation} class for more detail.
506
+ * @constructor
507
+ */
508
+ interface TextlintRuleContextFixCommandGenerator {
509
+ /**
510
+ * Creates a fix command that inserts text after the given node or token.
511
+ * The fix is not applied until applyFixes() is called.
512
+ * @param {TxtNode} node The node or token to insert after.
513
+ * @param {string} text The text to insert.
514
+ * @returns {IntermediateFixCommand} The fix command.
515
+ */
516
+ insertTextAfter(node: TxtNode, text: string): TextlintRuleContextFixCommand;
517
+ /**
518
+ * Creates a fix command that inserts text after the specified range in the source text.
519
+ * The fix is not applied until applyFixes() is called.
520
+ * @param {number[]} range The range to replace, first item is start of range, second
521
+ * is end of range.
522
+ * The `range` should be **relative** value from reported node.
523
+ * @param {string} text The text to insert.
524
+ * @returns {IntermediateFixCommand} The fix command.
525
+ */
526
+ insertTextAfterRange(range: TextlintSourceCodeRange, text: string): TextlintRuleContextFixCommand;
527
+ /**
528
+ * Creates a fix command that inserts text before the given node or token.
529
+ * The fix is not applied until applyFixes() is called.
530
+ * @param {TxtNode} node The node or token to insert before.
531
+ * @param {string} text The text to insert.
532
+ * @returns {IntermediateFixCommand} The fix command.
533
+ */
534
+ insertTextBefore(node: TxtNode, text: string): TextlintRuleContextFixCommand;
535
+ /**
536
+ * Creates a fix command that inserts text before the specified range in the source text.
537
+ * The fix is not applied until applyFixes() is called.
538
+ * @param {number[]} range The range to replace, first item is start of range, second
539
+ * is end of range.
540
+ * The `range` should be **relative** value from reported node.
541
+ * @param {string} text The text to insert.
542
+ * @returns {IntermediateFixCommand} The fix command.
543
+ */
544
+ insertTextBeforeRange(range: TextlintSourceCodeRange, text: string): TextlintRuleContextFixCommand;
545
+ /**
546
+ * Creates a fix command that replaces text at the node or token.
547
+ * The fix is not applied until applyFixes() is called.
548
+ * @param {TxtNode} node The node or token to remove.
549
+ * @param {string} text The text to insert.
550
+ * @returns {IntermediateFixCommand} The fix command.
551
+ */
552
+ replaceText(node: TxtNode, text: string): TextlintRuleContextFixCommand;
553
+ /**
554
+ * Creates a fix command that replaces text at the specified range in the source text.
555
+ * The fix is not applied until applyFixes() is called.
556
+ * @param {number[]} range The range to replace, first item is start of range, second
557
+ * is end of range.
558
+ * The `range` should be **relative** value from reported node.
559
+ * @param {string} text The text to insert.
560
+ * @returns {IntermediateFixCommand} The fix command.
561
+ */
562
+ replaceTextRange(range: TextlintSourceCodeRange, text: string): TextlintRuleContextFixCommand;
563
+ /**
564
+ * Creates a fix command that removes the node or token from the source.
565
+ * The fix is not applied until applyFixes() is called.
566
+ * @param {TxtNode} node The node or token to remove.
567
+ * @returns {IntermediateFixCommand} The fix command.
568
+ */
569
+ remove(node: TxtNode): TextlintRuleContextFixCommand;
570
+ /**
571
+ * Creates a fix command that removes the specified range of text from the source.
572
+ * The fix is not applied until applyFixes() is called.
573
+ * @param {number[]} range The range to remove, first item is start of range, second
574
+ * is end of range.
575
+ * The `range` should be **relative** value from reported node.
576
+ * @returns {IntermediateFixCommand} The fix command.
577
+ */
578
+ removeRange(range: TextlintSourceCodeRange): TextlintRuleContextFixCommand;
579
+ }
580
+ /**
581
+ * Severity Level list
582
+ * It is used in configuration and message
583
+ */
584
+ type none = 0;
585
+ type warning = 1;
586
+ type error = 2;
587
+ type info = 3;
588
+ type TextlintRuleSeverityLevel = none | warning | error | info;
589
+ type TextlintRuleSeverityLevelKey = "none" | "info" | "warning" | "error";
590
+ /**
591
+ * This Base class is internal.
592
+ * @internal
593
+ */
594
+ interface TextlintBaseRuleContext {
595
+ /**
596
+ * Return rule id
597
+ */
598
+ id: string;
599
+ /**
600
+ * Node's type values
601
+ * @type {TextLintNodeType}
602
+ */
603
+ Syntax: typeof ASTNodeTypes;
604
+ /**
605
+ * Return rule "severity" level
606
+ */
607
+ severity: TextlintRuleSeverityLevel;
608
+ /**
609
+ * CustomError object
610
+ * @type {RuleError}
611
+ */
612
+ RuleError: TextlintRuleErrorConstructor;
613
+ /**
614
+ * get file path current processing.
615
+ * if process text like stdin, return undefined
616
+ */
617
+ getFilePath(): string | undefined;
618
+ /**
619
+ * Gets the source code for the given node.
620
+ * @param {TxtNode=} node The AST node to get the text for.
621
+ * @param {int=} beforeCount The number of characters before the node to retrieve.
622
+ * @param {int=} afterCount The number of characters after the node to retrieve.
623
+ * @returns {string|null} The text representing the AST node.
624
+ */
625
+ getSource(node?: TxtNode, beforeCount?: number, afterCount?: number): string;
626
+ /**
627
+ * get config base directory path
628
+ * config base directory path often is the place of .textlintrc
629
+ *
630
+ * e.g.) /path/to/dir/.textlintrc
631
+ * `getConfigBaseDir()` return `"/path/to/dir/"`.
632
+ *
633
+ * When using textlint as module, it is specified by `configBaseDir`
634
+ * If not found the value, return undefined.
635
+ *
636
+ * You can use it for resolving relative path from config dir.
637
+ * @returns {string|undefined}
638
+ */
639
+ getConfigBaseDir(): string | undefined;
640
+ /**
641
+ * locator provide utility methods for calculating error location.
642
+ * pass the return value of `locator.*` to `loc` option in RuleError.
643
+ *
644
+ * ```
645
+ * report(node, new RuleError(message, {
646
+ * padding: locator.range([startIndex, endIndex])
647
+ * });
648
+ * ```
649
+ */
650
+ locator: TextlintRulePaddingLocator;
651
+ }
652
+ interface TextlintRuleContext extends TextlintBaseRuleContext {
653
+ fixer: TextlintRuleContextFixCommandGenerator;
654
+ report: (node: TxtNode, ruleError: TextlintRuleReportedObject | TextlintRuleError, _shouldNotUsed?: never) => void;
655
+ }
656
+ type TextlintRuleOptions<T extends object = object> = {
657
+ [index: string]: any;
658
+ severity?: TextlintRuleSeverityLevelKey;
659
+ } & T;
660
+ /**
661
+ * Rule Reporter Handler object define handler for each TxtNode type.
662
+ *
663
+ * Note: *Handler* naming is come from ES Proxy.
664
+ * `new Proxy(target, handler)`
665
+ *
666
+ * Each comment is example value of Markdown
667
+ */
668
+ type TextlintRuleReportHandler = { [P in ASTNodeTypes]?: (node: TypeofTxtNode<P>) => void | Promise<void>; } & {
669
+ [index: string]: (node: any) => void | Promise<void>;
670
+ };
671
+ /**
672
+ * Textlint rule reporter function
673
+ */
674
+ type TextlintRuleReporter<T extends object = object> = (context: Readonly<TextlintRuleContext>, options?: TextlintRuleOptions<T>) => TextlintRuleReportHandler;
675
+ /**
676
+ * If Textlint rule has fixer, it should both of { linter, fixer }.
677
+ */
678
+ type TextlintFixableRuleModule<T extends object = object> = {
679
+ linter: TextlintRuleReporter<T>;
680
+ fixer: TextlintRuleReporter<T>;
681
+ };
682
+ /**
683
+ * module.export = reporter | { linter, fixer }
684
+ */
685
+ type TextlintRuleModule<T extends object = object> = TextlintRuleReporter<T> | TextlintFixableRuleModule<T>;
686
+ export type Options = {
687
+ max?: number;
688
+ skipBlockQuote?: boolean;
689
+ };
690
+ declare const rule: TextlintRuleModule<Options>;
691
+ export { rule as default };
692
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../../node_modules/.bun/@textlint+ast-node-types@15.8.0/node_modules/@textlint/ast-node-types/lib/src/ASTNodeTypes.d.ts","../../../node_modules/.bun/@textlint+ast-node-types@15.8.0/node_modules/@textlint/ast-node-types/lib/src/NodeType.d.ts","../../../node_modules/.bun/@textlint+ast-node-types@15.8.0/node_modules/@textlint/ast-node-types/lib/src/TypeofTxtNode.d.ts","../../../node_modules/.bun/@textlint+types@15.8.0/node_modules/@textlint/types/lib/src/Source/TextlintSourceCode.d.ts","../../../node_modules/.bun/@textlint+types@15.8.0/node_modules/@textlint/types/lib/src/Rule/TextlintRuleContextFixCommand.d.ts","../../../node_modules/.bun/@textlint+types@15.8.0/node_modules/@textlint/types/lib/src/Rule/TextlintRuleSuggestion.d.ts","../../../node_modules/.bun/@textlint+types@15.8.0/node_modules/@textlint/types/lib/src/Rule/TextlintRuleError.d.ts","../../../node_modules/.bun/@textlint+types@15.8.0/node_modules/@textlint/types/lib/src/Rule/TextlintRulePaddingLocator.d.ts","../../../node_modules/.bun/@textlint+types@15.8.0/node_modules/@textlint/types/lib/src/Rule/TextlintRuleContextFixCommandGenerator.d.ts","../../../node_modules/.bun/@textlint+types@15.8.0/node_modules/@textlint/types/lib/src/Rule/TextlintRuleSeverityLevel.d.ts","../../../node_modules/.bun/@textlint+types@15.8.0/node_modules/@textlint/types/lib/src/Rule/TextlintRuleSeverityLevelKey.d.ts","../../../node_modules/.bun/@textlint+types@15.8.0/node_modules/@textlint/types/lib/src/Rule/TextlintBaseRuleContext.d.ts","../../../node_modules/.bun/@textlint+types@15.8.0/node_modules/@textlint/types/lib/src/Rule/TextlintRuleContext.d.ts","../../../node_modules/.bun/@textlint+types@15.8.0/node_modules/@textlint/types/lib/src/Rule/TextlintRuleOptions.d.ts","../../../node_modules/.bun/@textlint+types@15.8.0/node_modules/@textlint/types/lib/src/Rule/TextlintRuleModule.d.ts","../src/index.ts"],"ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],"mappings":";;;aAGoB;EAChB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;;EAIA;EACA;EACA;EACA;EACA;EACA;;;;EAIA;;;;EAIA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;KCtDQ,2BAA2B;;;;KAI3B,aAAa,UAAU,cAAc;;;;;;;KAOrC;WACC;WACA;;;;;KAKD;WACC,OAAO;WACP,KAAK;;;;;KAKN,yBAAyB,oBAAoB;;;;;UAKxC;WACJ,MAAM;WACN;WACA,OAAO;WACP,KAAK;WACL,SAAS;;;;;;;UAOL,oBAAoB;WACxB;;;;;;UAMI,sBAAsB;WAC1B,mBAAmB;;KAEpB;KACA;KACA,UAAU,kBAAkB,cAAc,eAAe,aAAa;;;;KAItE,kBAAkB;;;;;KAKlB,eAAe,mBAAmB,gBAAgB,wBAAwB,oBAAoB,cAAc,eAAe,cAAc;;;;KAIzI,cAAc;;;;KAId,eAAe;;;;KAIf,aAAa;;;;KAIb,kBAAkB,cAAc;;;;KAIhC,wBAAwB,aAAa,kBAAkB,gBAAgB,gBAAgB,cAAc,cAAc,eAAe,eAAe;UAC5I,wBAAwB;WAC5B;;UAEI,yBAAyB;WAC7B;WACA,mBAAmB;;UAEf,sBAAsB;WAC1B;WACA;WACA,mBAAmB;;UAEf,8BAA8B;WAClC;;UAEI,0BAA0B;WAC9B;WACA,mBAAmB;;UAEf,oBAAoB;WACxB;WACA;WACA;WACA;WACA,mBAAmB;;UAEf,wBAAwB;WAC5B;WACA;WACA;WACA,mBAAmB;;UAEf,qBAAqB;WACzB;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