Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Sep 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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