|
| 1 | +--- |
| 2 | +id: version-4.4.0-cli |
| 3 | +title: CLI |
| 4 | +original_id: cli |
| 5 | +--- |
| 6 | + |
| 7 | +Run npm-package-json-lint through the CLI with this script. |
| 8 | + |
| 9 | +```bash |
| 10 | +npmPkgJsonLint [opts] [fileGlobPatterns ...] |
| 11 | +``` |
| 12 | + |
| 13 | +npm-package-json-lint ignores files located in `node_modules` directory. |
| 14 | + |
| 15 | +### Examples |
| 16 | + |
| 17 | +```bash |
| 18 | +$ npmPkgJsonLint . |
| 19 | +``` |
| 20 | + |
| 21 | +> Looks for all `package.json` files in the project. The CLI engine automatically looks for relevant config files for each package.json file that is found. |
| 22 | +
|
| 23 | +```bash |
| 24 | +$ npmPkgJsonLint ./packages |
| 25 | +``` |
| 26 | + |
| 27 | +> Looks for all `package.json` files in the `packages` directory. The CLI engine automatically looks for relevant config files for each package.json file that is found. |
| 28 | +
|
| 29 | +```bash |
| 30 | +$ npmPkgJsonLint ./package1 ./package2 |
| 31 | +``` |
| 32 | + |
| 33 | +> Looks for all `package.json` files in the `package1` and `package2` directories. The CLI engine automatically looks for relevant config files for each package.json file that is found. |
| 34 | +
|
| 35 | +## `--configFile <file path>` (alias `-c`) |
| 36 | + |
| 37 | +File path to local config file or module name. Please see [configuration](configuration.md) for more details. |
| 38 | + |
| 39 | +### Examples |
| 40 | + |
| 41 | +```bash |
| 42 | +$ npmPkgJsonLint -c ./config/.npmpackagejsonlintrc.json . |
| 43 | +``` |
| 44 | + |
| 45 | +> Looks for all `package.json` files in the project. The CLI engine automatically looks for relevant config files for each package.json file that is found. The CLI also merges the config found in `./config/.npmpackagejsonlintrc.json` |
| 46 | +
|
| 47 | +```bash |
| 48 | +$ npmPkgJsonLint --configFile ./config/npmpackagejsonlint.config.json . |
| 49 | +``` |
| 50 | + |
| 51 | +## `--quiet` (alias `-q`) |
| 52 | + |
| 53 | +Report errors only. |
| 54 | + |
| 55 | +### Examples |
| 56 | + |
| 57 | +```bash |
| 58 | +$ npmPkgJsonLint -q . |
| 59 | +``` |
| 60 | + |
| 61 | +> Looks for all `package.json` files in the project. The CLI engine automatically looks for relevant config files for each package.json file that is found. Removes any warnings from the output. |
| 62 | +
|
| 63 | +```bash |
| 64 | +$ npmPkgJsonLint --quiet ./packages |
| 65 | +``` |
| 66 | + |
| 67 | +> Looks for all `package.json` files in the `packages` directory. The CLI engine automatically looks for relevant config files for each package.json file that is found. Removes any warnings from the output using the long form for quieting output. |
| 68 | +
|
| 69 | +## `--noConfigFiles` (alias `-ncf`) |
| 70 | + |
| 71 | +Skips loading project config files (i.e. .npmpackagejsonlintrc.json and npmpackagejsonlint.config.js). |
| 72 | + |
| 73 | +## `--ignorePath` (alias `-i`) |
| 74 | + |
| 75 | +Path to a file containing patterns that describe files to ignore. By default, npm-package-json-lint looks for `./.npmpackagejsonlintignore`. |
| 76 | + |
| 77 | +### Examples |
| 78 | + |
| 79 | +```bash |
| 80 | +$ npmPkgJsonLint . --ignorePath .gitignore |
| 81 | +``` |
| 82 | + |
| 83 | +> Looks for all `package.json` files in the project and exclude ignored paths. The CLI engine automatically looks for relevant config files for each package.json file that is found. |
| 84 | +
|
| 85 | +## `--maxWarnings` (alias `-mw`) |
| 86 | + |
| 87 | +Max number of warnings that are allowed before an error is thrown. By default, npm-package-json-lint allows `10000000`. |
| 88 | + |
| 89 | +## `--allowEmptyTargets` |
| 90 | + |
| 91 | +Do not throw an error when a list of targets is empty. |
0 commit comments