Skip to content

Commit

Permalink
Merge pull request #76 from IanVS/rules-dir
Browse files Browse the repository at this point in the history
Add --rulesdir option
  • Loading branch information
IanVS authored Dec 15, 2020
2 parents 6d837a2 + bc4d2fa commit 234b6f1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ If you have so many failing rules that navigating the list is cumbersome, use th
the rules that are displayed. Multiple rules can be included as comma-separated strings (e.g. `--rule semi,quotes`),
or by using multiple `--rule` flags (e.g. `--rule semi --rule quotes`).

### `--rulesdir`
This corresponds to the eslint `--rulesdir` [option](https://eslint.org/docs/user-guide/command-line-interface#-rulesdir). Use it to specify a path to custom eslint rules.

### `--no-interactive`
Potentially useful in CI, or any other situation where you would like to run ESLint using your standard project config (`.eslintrc`), but only on a subset of rules (using the `--rule` flag). Using `--no-interactive` will prevent eslint-nibble from displaying a menu, but will instead print out any warnings/errors and return an exit code of 1 if there are errors, or 0 otherwise, just like ESLint itself does.

Expand Down
5 changes: 5 additions & 0 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const cli = {
cache,
cacheLocation,
allowedRules,
rulesDir,
includeWarnings,
isInteractive,
isMulti,
Expand All @@ -32,6 +33,7 @@ const cli = {
cache = currentOptions.cache;
cacheLocation = currentOptions.cacheLocation;
allowedRules = currentOptions.rule;
rulesDir = currentOptions.rulesdir;
includeWarnings = currentOptions.warnings;
isInteractive = currentOptions.interactive;
isMulti = currentOptions.multi;
Expand Down Expand Up @@ -59,6 +61,9 @@ const cli = {
if (cacheLocation) {
configuration.cacheLocation = cacheLocation;
}
if (rulesDir) {
configuration.rulePaths = rulesDir;
}

nibbler.configure(configuration);
let report = nibbler.nibbleOnFiles(files);
Expand Down
5 changes: 5 additions & 0 deletions src/config/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ export default optionator({
type : '[String]',
concatRepeatedArrays: true,
description : 'Only show results for specified rule(s)'
}, {
option : 'rulesdir',
type : '[String]',
concatRepeatedArrays: true,
description : 'Path to custom eslint rules'
}, {
option : 'warnings',
type : 'Boolean',
Expand Down

0 comments on commit 234b6f1

Please sign in to comment.