Skip to content
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

Optional configuration file #10

Closed
guilhermehn opened this issue Dec 9, 2019 · 2 comments · Fixed by #40
Closed

Optional configuration file #10

guilhermehn opened this issue Dec 9, 2019 · 2 comments · Fixed by #40

Comments

@guilhermehn
Copy link

At the current state, svglint requires a configuration file.

https://github.com/birjolaxew/svglint/blob/8f5b0a2f6c7bc283ae46366dd2fea2e83618a862/src/cli/config.js#L5-L6

Even if it's an empty module, like:

// .svglintrc.js
module.exports = {};

I think it would be better to use an empty object as the default configuration if the configuration file is not found. I've found myself creating empty files the example above for multiple projects. I can work on this if you agree with the change.

@ericcornelissen
Copy link
Contributor

ericcornelissen commented Jun 27, 2021

Thanks for the suggestion @guilhermehn, and apologies for the late reply. I think we can support this, are you still interested in working on this? (I understand if you're not, just let us know here so I or someone else can work on this)

Regarding the implementation, it should be pretty straightforward to change the behaviour to what you requested by, indeed, removing the error behaviour you described. On top of that I think we should make the config parameter in the JavaScript API explicitly optional as well (even though I'm pretty sure everything works fine if you omit the config parameter already).

There is just one question left open from my perspective: which is if we should add a native way to be able to tell that SVGLint is reading your config file if it's there, or that it wasn't found if it's not there. For example, if I accidentally create a file called .svglintr.js, the current behaviour will tell me that there's something wrong. But with your suggestion SVGLint will just run and you may not realize there's a typo in the config file name. I'm thinking we could do either (or both) of the following:

  1. Add a --strict flag which, if used, will ensure an error is produced if no config file was found.
  2. Add a (debug) log if no config file was found.

EDIT: rather then going with option 1 here, in the initial implementation of this feature I opted to error if a specified (with --config) configuration file isn't found and no --strict flag. I would support a --strict flag that works as described here being added nonetheless.

@github-actions
Copy link

🎉 This issue has been resolved in version 1.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants