Open galak75 opened 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.
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
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?
@galak75 thanks! I cannot support extends
as of now unfortunately. Is it ok anyway?
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 :-)
@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.
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.
@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.
@ParkerM A good alternative is JCEF https://plugins.jetbrains.com/docs/intellij/jcef.html?from=jetbrains.org Although I never tried it.
@ParkerM what I could do is try to bundle cosmiconfig and execute it inside the JCEF environment. Thanks for mentioning the tool!
@lppedd Interesting, thanks for the explanation. And sure thing! 👍
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 ?