Skip to content

Support for commitlint YAML file #5

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

Open
galak75 opened this issue Feb 17, 2021 · 11 comments
Open

Support for commitlint YAML file #5

galak75 opened this issue Feb 17, 2021 · 11 comments
Assignees
Labels
enhancement New feature or request

Comments

@galak75
Copy link

galak75 commented Feb 17, 2021

Hi

First of all, thank you for the amazing work on this plugin.

Would it be possible to add support for yaml file format ? Or is it already supported ?

@lppedd lppedd self-assigned this Feb 17, 2021
@lppedd lppedd added the enhancement New feature or request label Feb 17, 2021
@lppedd
Copy link
Owner

lppedd commented Feb 17, 2021

@galak75 hi! No, currently only JSON is supported, but YAML shouldn't be difficult to add.
Could you point me to an example of YAML config? So I can tell you what I can support and what I cannot.

@galak75
Copy link
Author

galak75 commented Feb 17, 2021

I will look for a reference documentation, but here is a small example:

extends:
  - '@commitlint/config-conventional'
rules:
  header-max-length: [1, 'always', 72]
  type-enum:
  - 2
  - always
  - - ci
    - feat
    - fix
    - docs
    - style
    - refactor
    - perf
    - test
    - revert
help: |
  **Possible types**:
  `ci`:       Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
  `feat`:     Adds a new feature.
  `fix`:      Solves a bug.
  `docs`:     Adds or alters documentation.
  `style`:    Improves formatting, white-space.
  `refactor`: Rewrites code without feature, performance or bug changes.
  `perf`:     Improves performance.
  `test`:     Adds or modifies tests.
  `revert`:   Changes that reverting other changes

@galak75
Copy link
Author

galak75 commented Feb 17, 2021

I couldn't find any yaml-specific documentation, but I hope the official configuration reference (and the link about rules at the bottom) combined with the example above should help?

@lppedd
Copy link
Owner

lppedd commented Feb 17, 2021

@galak75 thanks! I cannot support extends as of now unfortunately. Is it ok anyway?

@galak75
Copy link
Author

galak75 commented Feb 17, 2021

It may be great to support all available configuration formats (javascript, json and yaml) with the current supported features.

The day extends is supported, it would probably be for all formats :-)

@lppedd
Copy link
Owner

lppedd commented Feb 18, 2021

@galak75 the issue is how to read a JavaScript file. I can read YAML and JSON because the document format is fixed, but I cannot read a JavaScript file as a user could throw everything inside of it: functions, variables, imports.

@ParkerM
Copy link

ParkerM commented Feb 27, 2021

Prettier and commitlint both use cosmiconfig for loading/merging config files, so JetBrains' Prettier plugin might have some useful config-loader recipes that would (presumably) work the same for other tools using cosmiconfig.

@lppedd
Copy link
Owner

lppedd commented Feb 27, 2021

@ParkerM I had already explored the Prettier plugin some time ago. They interface with NodeJs directly, which means they have their own plugin and process to load the configuration file. It's not really straightforward and requires Node to be always present.

@lppedd
Copy link
Owner

lppedd commented Feb 27, 2021

@ParkerM A good alternative is JCEF https://plugins.jetbrains.com/docs/intellij/jcef.html?from=jetbrains.org
Although I never tried it.

@lppedd
Copy link
Owner

lppedd commented Feb 27, 2021

@ParkerM what I could do is try to bundle cosmiconfig and execute it inside the JCEF environment.
Thanks for mentioning the tool!

@ParkerM
Copy link

ParkerM commented Feb 27, 2021

@lppedd Interesting, thanks for the explanation. And sure thing! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants