Skip to content

Commit 895c60f

Browse files
authored
docs: add missing messageId property and suggestion properties (#19122)
* docs: add missing messageId property and suggestion properties to Node.js integration * fix: consistent casing of ID
1 parent cceccc7 commit 895c60f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

docs/src/integrate/nodejs-api.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,8 @@ The `LintMessage` value is the information of each linting error. The `messages`
421421
`true` if this is a fatal error unrelated to a rule, like a parsing error.
422422
* `message` (`string`)<br>
423423
The error message.
424+
* `messageId` (`string | undefined`)<br>
425+
The message ID of the lint error. This property is undefined if the rule does not use message IDs.
424426
* `line` (`number | undefined`)<br>
425427
The 1-based line number of the begin point of this message.
426428
* `column` (`number | undefined`)<br>
@@ -431,7 +433,7 @@ The `LintMessage` value is the information of each linting error. The `messages`
431433
The 1-based column number of the end point of this message. This property is undefined if this message is not a range.
432434
* `fix` (`EditInfo | undefined`)<br>
433435
The [EditInfo] object of autofix. This property is undefined if this message is not fixable.
434-
* `suggestions` (`{ desc: string; fix: EditInfo }[] | undefined`)<br>
436+
* `suggestions` (`{ desc: string; fix: EditInfo; messageId?: string; data?: object }[] | undefined`)<br>
435437
The list of suggestions. Each suggestion is the pair of a description and an [EditInfo] object to fix code. API users such as editor integrations can choose one of them to fix the problem of this message. This property is undefined if this message doesn't have any suggestions.
436438

437439
### ◆ SuppressedLintMessage type
@@ -446,6 +448,8 @@ The `SuppressedLintMessage` value is the information of each suppressed linting
446448
Same as `fatal` in [LintMessage] type.
447449
* `message` (`string`)<br>
448450
Same as `message` in [LintMessage] type.
451+
* `messageId` (`string | undefined`)<br>
452+
Same as `messageId` in [LintMessage] type.
449453
* `line` (`number | undefined`)<br>
450454
Same as `line` in [LintMessage] type.
451455
* `column` (`number | undefined`)<br>
@@ -456,7 +460,7 @@ The `SuppressedLintMessage` value is the information of each suppressed linting
456460
Same as `endColumn` in [LintMessage] type.
457461
* `fix` (`EditInfo | undefined`)<br>
458462
Same as `fix` in [LintMessage] type.
459-
* `suggestions` (`{ desc: string; fix: EditInfo }[] | undefined`)<br>
463+
* `suggestions` (`{ desc: string; fix: EditInfo; messageId?: string; data?: object }[] | undefined`)<br>
460464
Same as `suggestions` in [LintMessage] type.
461465
* `suppressions` (`{ kind: string; justification: string}[]`)<br>
462466
The list of suppressions. Each suppression is the pair of a kind and a justification.
@@ -658,6 +662,7 @@ The information available for each linting message is:
658662
* `fatal` - usually omitted, but will be set to true if there's a parsing error (not related to a rule).
659663
* `line` - the line on which the error occurred.
660664
* `message` - the message that should be output.
665+
* `messageId` - the ID of the message used to generate the message (this property is omitted if the rule does not use message IDs).
661666
* `nodeType` - (**Deprecated:** This property will be removed in a future version of ESLint.) the node or token type that was reported with the problem.
662667
* `ruleId` - the ID of the rule that triggered the messages (or null if `fatal` is true).
663668
* `severity` - either 1 or 2, depending on your configuration.
@@ -837,7 +842,7 @@ In addition to the properties above, invalid test cases can also have the follow
837842

838843
* `errors` (number or array, required): Asserts some properties of the errors that the rule is expected to produce when run on this code. If this is a number, asserts the number of errors produced. Otherwise, this should be a list of objects, each containing information about a single reported error. The following properties can be used for an error (all are optional unless otherwise noted):
839844
* `message` (string/regexp): The message for the error. Must provide this or `messageId`
840-
* `messageId` (string): The Id for the error. Must provide this or `message`. See [testing errors with messageId](#testing-errors-with-messageid) for details
845+
* `messageId` (string): The ID for the error. Must provide this or `message`. See [testing errors with messageId](#testing-errors-with-messageid) for details
841846
* `data` (object): Placeholder data which can be used in combination with `messageId`
842847
* `type` (string): (**Deprecated:** This property will be removed in a future version of ESLint.) The type of the reported AST node
843848
* `line` (number): The 1-based line number of the reported location

0 commit comments

Comments
 (0)