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

feat: autodiscover ESM and CJS configuration files #64

Merged
merged 8 commits into from
Oct 22, 2022

Conversation

mondeja
Copy link
Member

@mondeja mondeja commented Oct 11, 2022

This PR implements the autodiscovering of .svglintrc.cjs and .svglintrc.mjs files. The logic is simple:

  • If a file is passed in the --config CLI argument, it will be loaded or exits with code 1
  • Else if a .svglintrc.js exists in the current working directory, load it
  • Else if the current working directory has a package.json file with type="module" and a .svglintrc.cjs file exists, load it
  • Else if the current working directory has a .svglintrc.mjs file, load it
  • Else, traverse the tree of directories looking in the parents. Apply the same logic for each directory.

I've not included the autodiscovering of .svglintrc.cjs and .svglintrc.mjs files for parent directories, let me know if it would be the desired behaviour.

@ericcornelissen
Copy link
Collaborator

Haven't had time to look at this yet, but ...

I've not included the autodiscovering of .svglintrc.cjs and .svglintrc.mjs files for parent directories, let me know if it would be the desired behaviour.

On the face of it, I'd expect that to be the behaviour 🤔 Any particular reason you didn't implement it? If not, please feel free to add it 🙂

@mondeja mondeja marked this pull request as draft October 16, 2022 22:33
@mondeja mondeja marked this pull request as ready for review October 20, 2022 17:53
@mondeja
Copy link
Member Author

mondeja commented Oct 20, 2022

Any particular reason you didn't implement it? If not, please feel free to add it

Added. Note that this implementation requires the configuration file to be placed at the same level than the package.json when loading .mjs and .cjs files.

src/cli/config.js Outdated Show resolved Hide resolved
src/cli/config.js Outdated Show resolved Hide resolved
src/cli/config.js Outdated Show resolved Hide resolved
src/cli/config.js Outdated Show resolved Hide resolved
src/cli/config.js Outdated Show resolved Hide resolved
src/cli/config.js Outdated Show resolved Hide resolved
Copy link
Collaborator

@ericcornelissen ericcornelissen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, this looks great! Nice work @mondeja

Most of my comments are rather specific but straightforward requests. A couple topics might spark a discussion.

test/cli.spec.js Outdated Show resolved Hide resolved
test/cli.spec.js Outdated Show resolved Hide resolved
test/cli.spec.js Outdated Show resolved Hide resolved
test/cli.spec.js Outdated Show resolved Hide resolved
@ericcornelissen ericcornelissen changed the title Autodiscover ESM and CJS configuration files feat: autodiscover ESM and CJS configuration files Oct 22, 2022
@ericcornelissen ericcornelissen merged commit 2cceb34 into simple-icons:master Oct 22, 2022
@github-actions
Copy link

🎉 This PR is included in version 2.2.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 this pull request may close these issues.

None yet

2 participants