Skip to content
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

Merged
merged 6 commits into from
Oct 4, 2019

Conversation

planctus
Copy link
Contributor

@planctus planctus commented Sep 30, 2019

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 and https://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:

  • I have put the vanilla component as devDependencies
  • I have put the specs package as devDependencies
  • I have added the components directly used in the twig file (with include or embed) as dependencies
  • My component is listed in @ecl-twig/ec-components's dependencies
  • My variables naming follow the guidelines (snake case for twig)
  • I have provided tests
  • I have provided documentation (for the "notes" tab)
  • If my local yarn.lock contains changes, I have committed it
  • I have given my PR the proper label (pr: 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 ...)

@drupol
Copy link

drupol commented Sep 30, 2019

Nice !

Some feedback:

  • I would not include composer.lock

@planctus planctus marked this pull request as ready for review October 1, 2019 12:28
docs/getting-started.md Outdated Show resolved Hide resolved
@planctus planctus changed the title feat(twig-linter): adding php libraries via composer, providing two alternatives feat(twig-linter): Configuration (twigcs + grumphp) and fixes on the templates Oct 1, 2019
@planctus planctus added the pr: review needed Use this label to show that your PR needs to be review label Oct 1, 2019
@drupol drupol mentioned this pull request Oct 1, 2019
Copy link
Contributor

@papegaill papegaill left a comment

Choose a reason for hiding this comment

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

Nice! Tested, works like a charm.

@papegaill papegaill changed the title feat(twig-linter): Configuration (twigcs + grumphp) and fixes on the templates feat(twig-linter): Configuration (twigcs + grumphp) and fixes on the templates - TWIG-51 Oct 4, 2019
@papegaill papegaill merged commit 3bbf152 into master Oct 4, 2019
@papegaill papegaill deleted the TWIG-51 branch October 4, 2019 12:39
@planctus planctus mentioned this pull request Oct 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr: review needed Use this label to show that your PR needs to be review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants