Skip to content

Commit

Permalink
add some documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
me4502 committed Aug 21, 2023
1 parent a432342 commit bd74353
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions docs/src/integrate/nodejs-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ The `ESLint` constructor takes an `options` object. If you omit the `options` ob
Default is `[]`. An array of paths to directories to load custom rules from.
* `options.useEslintrc` (`boolean`)<br>
Default is `true`. If `false` is present, ESLint doesn't load configuration files (`.eslintrc.*` files). Only the configuration of the constructor options is valid.
* `options.ruleFilter` (`Function`)<br>
Default is `() => true`. A predicate function that filters rules to be run. This function is called with an object containing `ruleId` and `severity`, and returns `true` if the rule should be run.

##### Autofix

Expand Down Expand Up @@ -538,6 +540,7 @@ The most important method on `Linter` is `verify()`, which initiates linting of
* `disableFixes` - (optional) when set to `true`, the linter doesn't make either the `fix` or `suggestions` property of the lint result.
* `allowInlineConfig` - (optional) set to `false` to disable inline comments from changing ESLint rules.
* `reportUnusedDisableDirectives` - (optional) when set to `true`, adds reported errors for unused `eslint-disable` directives when no problems would be reported in the disabled area anyway.
* `ruleFilter` - (optional) A function predicate that decides which rules should run. It receives an object containing `ruleId` and `severity`, and returns `true` if the rule should be run.

If the third argument is a string, it is interpreted as the `filename`.

Expand Down
6 changes: 4 additions & 2 deletions docs/src/use/command-line-interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Use stdin:
--stdin-filename String Specify filename to process STDIN as
Handle warnings:
--quiet Report errors only - default: false
--quiet Report and check errors only - default: false
--max-warnings Int Number of warnings to trigger nonzero exit code - default: -1
Output:
Expand Down Expand Up @@ -446,7 +446,7 @@ cat myfile.js | npx eslint --stdin --stdin-filename myfile.js

#### `--quiet`

This option allows you to disable reporting on warnings. If you enable this option, only errors are reported by ESLint.
This option allows you to disable reporting on warnings and running of rules set to warn. If you enable this option, only errors are reported by ESLint and only rules set to error will be run.

* **Argument Type**: No argument.

Expand All @@ -465,6 +465,8 @@ This option allows you to specify a warning threshold, which can be used to forc

Normally, if ESLint runs and finds no errors (only warnings), it exits with a success exit status. However, if `--max-warnings` is specified and the total warning count is greater than the specified threshold, ESLint exits with an error status.

When used alongside `--quiet`, this will cause rules marked as warn to still be run, but not reported.

##### `--max-warnings` example

```shell
Expand Down
2 changes: 1 addition & 1 deletion lib/eslint/eslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const { version } = require("../../package.json");
* @property {string} [resolvePluginsRelativeTo] The folder where plugins should be resolved from, defaulting to the CWD.
* @property {string[]} [rulePaths] An array of directories to load custom rules from.
* @property {boolean} [useEslintrc] False disables looking for .eslintrc.* files.
* @property {Function} [ruleFilter] A function to filter out rules that should not be fun.
* @property {Function} [ruleFilter] A function to filter out rules that should not be run.
*/

/**
Expand Down

0 comments on commit bd74353

Please sign in to comment.