Skip to content

Commit

Permalink
Docs: Clarify parameter documentation for api.verify
Browse files Browse the repository at this point in the history
(fixes #5101) (fixes #5104)
  • Loading branch information
BYK committed Feb 7, 2016
1 parent 1803f87 commit 2ca2aea
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
7 changes: 4 additions & 3 deletions docs/developer-guide/nodejs-api.md
Expand Up @@ -60,11 +60,12 @@ var linter = require("eslint").linter;
The most important method on `linter` is `verify()`, which initiates linting of the given text. This method accepts four arguments:

* `code` - the source code to lint (a string or instance of `SourceCode`).
* `config` - a configuration object.
* `options` - (optional) Additional options for this run.
* `config` - a configuration object that is equivalent to an eslintrc file.
* `optionsOrFilename` - (optional) Additional options for this run or a string representing the filename to associate with the code being linted.
* `filename` - (optional) the filename to associate with the source code.
* `saveState` - (optional) set to true to maintain the internal state of `linter` after linting (mostly used for testing purposes).
* `saveState` - (optional) see below. This will override any value passed as the fourth argument if an options object is used here instead of the filename.
* `allowInlineConfig` - (optional) set to `false` to disable inline comments from changing eslint rules.
* `saveState` - (optional) set to true to maintain the internal state of `linter` after linting (mostly used for testing purposes)

You can call `verify()` like this:

Expand Down
13 changes: 12 additions & 1 deletion lib/eslint.js
Expand Up @@ -641,10 +641,21 @@ module.exports = (function() {
sourceCode = null;
};

/**
* Configuration object for the `verify` API. A JS representation of the eslintrc files.
* @typedef {Object} ESLintConfig
* @param {Object} rules The rule configuration to verify against.
* @param {string} [parser] Parser to use when generatig the AST.
* @param {Object} [parserOptions] Options for the parsed used.
* @param {Object} [settings] Global settings passed to each rule.
* @param {Object} [env] The environment to verify in.
* @param {Object} [globals] Available globalsto the code.
*/

/**
* Verifies the text against the rules specified by the second argument.
* @param {string|SourceCode} textOrSourceCode The text to parse or a SourceCode object.
* @param {Object} config An object whose keys specify the rules to use.
* @param {ESLintConfig} config An object whose keys specify the rules to use.
* @param {(string|Object)} [filenameOrOptions] The optional filename of the file being checked.
* If this is not set, the filename will default to '<input>' in the rule context. If
* an object, then it has "filename", "saveState", and "allowInlineConfig" properties.
Expand Down

0 comments on commit 2ca2aea

Please sign in to comment.