Skip to content

Commit 000251f

Browse files
committed
feat(lint-package-json): ignore option
1 parent 103e649 commit 000251f

3 files changed

Lines changed: 16 additions & 2 deletions

File tree

packages/lint-package-json/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
},
3434
"dependencies": {
3535
"@trigen/npm-package-json-lint-config": "^8.0.0-alpha.5",
36+
"argue-cli": "^2.0.0",
3637
"npm-package-json-lint": "^5.4.2"
3738
},
3839
"readme": ""

packages/lint-package-json/src/index.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
#!/usr/bin/env node
2+
import {
3+
readOptions,
4+
alias,
5+
option
6+
} from 'argue-cli'
27
import NpmPackageJsonLint from 'npm-package-json-lint/src/NpmPackageJsonLint.js'
38
import Reporter from 'npm-package-json-lint/src/Reporter.js'
49
import configs from './configs.cjs'
510

6-
const monorepo = process.argv.includes('--monorepo')
11+
const {
12+
monorepo,
13+
ignore
14+
} = readOptions(
15+
option(alias('monorepo', 'm'), Boolean),
16+
option(alias('ignore', 'i'), Array),
17+
)
718
const config = {
819
extends: monorepo
920
? [configs.base, configs.monorepo]
@@ -12,7 +23,7 @@ const config = {
1223
const npmPackageJsonLint = new NpmPackageJsonLint({
1324
cwd: process.cwd(),
1425
config,
15-
patterns: ['.']
26+
patterns: ['.'].concat(ignore.map(_ => `!${_}`))
1627
})
1728
const linterOutput = npmPackageJsonLint.lint()
1829

pnpm-lock.yaml

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)