Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Docs: add example for CLIEngine#executeOnText 3rd arg (#12286)
  • Loading branch information
kaicataldo committed Sep 20, 2019
1 parent d4f9a16 commit e39c631
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions docs/developer-guide/nodejs-api.md
Expand Up @@ -617,14 +617,16 @@ const cli = new CLIEngine({
}
});

// lint the supplied text and optionally set
// a filename that is displayed in the report
// Lint the supplied text and optionally set a filename that is displayed in the report
const report = cli.executeOnText("var foo = 'bar';", "foo.js");

// In addition to the above, warn if the resolved file name is ignored.
const reportAndWarnOnIgnoredFile = cli.executeOnText("var foo = 'bar';", "foo.js", true);
```

The `report` returned from `executeOnText()` is in the same format as from `executeOnFiles()`, but there is only ever one result in `report.results`.

If a filename in the optional second parameter matches a file that is configured to be ignored, then this function returns no errors or warnings. To return a warning instead, call the method with true as the optional third parameter.
If a filename in the optional second parameter matches a file that is configured to be ignored, then this function returns no errors or warnings. The method includes an additional optional boolean third parameter. When `true`, a resolved file name that is ignored will return a warning.

### CLIEngine#addPlugin()

Expand Down

0 comments on commit e39c631

Please sign in to comment.