From e39c6318af0fd27edd5fd2aaf2b24a3e204005dd Mon Sep 17 00:00:00 2001 From: Kai Cataldo <7041728+kaicataldo@users.noreply.github.com> Date: Thu, 19 Sep 2019 20:01:43 -0400 Subject: [PATCH] Docs: add example for CLIEngine#executeOnText 3rd arg (#12286) --- docs/developer-guide/nodejs-api.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/developer-guide/nodejs-api.md b/docs/developer-guide/nodejs-api.md index e6df772228c..464d6dbd19b 100644 --- a/docs/developer-guide/nodejs-api.md +++ b/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()