This repository has been archived by the owner on May 2, 2023. It is now read-only.
feat(twig-linter): Configuration (twigcs + grumphp) and fixes on the templates - TWIG-51 #162
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR description
Basically i could not find a proper configuration in node to be able to lint twig files.
I've tried
https://www.npmjs.com/package/eslint-config-twig
but couldn't really get much out of that.There is no plugin for prettier available yet, although this seems to be in the process,
https://github.com/Kocal/prettier-plugin-twig
So i looked at solutions in the php world and we have a couple of "valid" linters there, i've added both:
https://github.com/asm89/twig-lint
andhttps://github.com/friendsoftwig/twigcs
.I added documentation about the "sniffing" capabilities in the getting started file, you can follow that to see how this work, there's not much more than the default configuration.
Unfortunately for the time being the results are not so convincing, with one of the libraries we get no worries, with twig-cs we get 200 but most of the ones i checked were false positives.
QA Checklist
In order to ensure a safe and quick review, please check that your PR follow those guidelines:
devDependencies
devDependencies
include
orembed
) asdependencies
@ecl-twig/ec-components
'sdependencies
yarn.lock
contains changes, I have committed itpr: review needed
to indicate that I'm done and now waiting for a review ,pr: wip
to indicate that I'm actively working on it ...)