lppedd / idea-conventional-commit-commitlint

Provides additional commit types and scopes via Commitlint rules.
https://plugins.jetbrains.com/plugin/14046-commitlint-conventional-commit
MIT License
27 stars 1 forks source link

Support for commitlint YAML file #5

Open galak75 opened 3 years ago

galak75 commented 3 years ago

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 commented 3 years ago

@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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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

galak75 commented 3 years ago

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 commented 3 years ago

@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 commented 3 years ago

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 commented 3 years ago

@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 commented 3 years ago

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

lppedd commented 3 years ago

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

ParkerM commented 3 years ago

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