-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent behavior on invalid config #105
Comments
Continuation of: a1f9a15#r40919702 I also experienced - repo: local
hooks:
- id: markdownlint
name: markdownlint
description: "Lint Markdown files"
entry: markdownlint '**/*.md' --fix --ignore node_modules --config "./.markdownlint.json"
language: node
types: [markdown] In this scenario, Expected behavior: an error is raised when the config file does not exist, ie:
|
@DavidAnson As a fix, do you prefer a custom error message or just bubble up whatever error is thrown when one of these lines fails? const userConfig = jsConfigFile ?
// Evaluate .js configuration file as code
require(path.resolve(processCwd, userConfigFile)) :
// Load JSON/YAML configuration as data
markdownlint.readConfigSync(userConfigFile, configFileParsers);
config = require('deep-extend')(config, userConfig); |
Both? ;) A general message is good for context while the specific error is good for details. Something like |
.markdownlint.json
Running
markdownlint --fix '**/*.md'
silently fails to load invalid file and goes to default config.Running
markdownlint --fix '**/*.md' --config .markdownlint.json
displays an error message thatthis-file-does-not-exist.json
is missing.In my case I was trying to load a valid file that was missing, and it took me some time to realize that the problem is me, not
markdownlint
being lazy not loading.markdownlint.json
. I think it should complain in this case, instead of straight up loading default config.The text was updated successfully, but these errors were encountered: