npm-package-json-lint icon indicating copy to clipboard operation
npm-package-json-lint copied to clipboard

Unexpected behavior with the `--noConfigFiles` flag

Open joaopalmeiro opened this issue 1 year ago • 1 comments

Hi! 👋

I was trying out the CLI and when reading the documentation, I interpreted that if I used the --noConfigFiles flag, I would be able to run the tool (with default configuration/rules) in a project where I don't yet have a configuration file. Looking at the CLI implementation, this flag appears to be ignored. What is the expected behavior for this flag? Is this a bug?

Environment

  • npm-package-json-lint: 7.1.0
  • npm: 9.8.1
  • Node: v18.18.2

Output

Default

npx npmPkgJsonLint .

Output

No npm-package-json-lint configuration found.
/Users/joaopalmeiro/Documents/GitHub/prettier-config/package.json

--noConfigFiles flag

npx npmPkgJsonLint --noConfigFiles .

or

npx npmPkgJsonLint . --noConfigFiles

Output

No npm-package-json-lint configuration found.
/Users/joaopalmeiro/Documents/GitHub/prettier-config/package.json

joaopalmeiro avatar Feb 22 '24 17:02 joaopalmeiro

After adding a configuration file with only the author rule (and removing the author from the package.json file):

{
    "rules": {
        "require-author": "error"
    }
}
npx npmPkgJsonLint .

./package.json
✖ require-author - node: author - author is required
1 error
0 warnings

and

npx npmPkgJsonLint --noConfigFiles .

./package.json
✖ require-author - node: author - author is required
1 error
0 warnings

joaopalmeiro avatar Feb 22 '24 17:02 joaopalmeiro