Skip to content
Permalink
Browse files

Docs: add example for CLIEngine#executeOnText 3rd arg (#12286)

  • Loading branch information
kaicataldo committed Sep 20, 2019
1 parent d4f9a16 commit e39c6318af0fd27edd5fd2aaf2b24a3e204005dd
Showing with 5 additions and 3 deletions.
  1. +5 −3 docs/developer-guide/nodejs-api.md
@@ -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()

0 comments on commit e39c631

Please sign in to comment.
You can’t perform that action at this time.