Coder Social home page Coder Social logo

twig-linter's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar hsegnitz avatar jdolba avatar sserbin avatar xvilo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

twig-linter's Issues

PHP 8.0 compatibility issue

I'm using this package in a package of my own and I'm running into issues with installing on PHP 8.0.

This package requires ocramius/package-versions ^1.3, which resolves to at most an 1.11 version with maximum PHP 7.4 support.

But because this package also requires for dev psalm, which in turn requires composer/package-versions-deprecated, the testsuite runs OK. composer/package-versions-deprecated is compatible fork that defines a replace for ocramius/package-versions and it's 1.11 versions do support PHP 8.0.

Hacktoberfest

Hi @sserbin,

I know this might be a spam issue, however, I would like to contribute some more changes to this project for my hacktoberfest goal. However, this year the rules are changed and maintainers must enlist their repositories manually.

Would you be so kind doing so before Oct 30th? The repository should have a hacktoberfest topic as per the instructions on https://hacktoberfest.digitalocean.com/hacktoberfest-update

Sorry again, and thanks in advance!

Unknown "trans" tag

When linting the following code (Twig 2), the linter complains with the message Unknown "trans" tag.

{% trans %}
Hello!
{% endtrans %}

Thanks!

custom functions are evaluated

With the release of V1.0.3 customs functions are now validated. We get the following output:

      8                  'someObjectKey': 'sometext',
      9                  'icon': svg('pictogram', 'test'),
  >>  10                 'label': t('test'),
  >> Unknown "t" function. Did you mean "date", "constant"? 

while the svg() function is skipped correctly, it doesn't get happy with t

Linting issues

We tried running your twig linter over our twig 2 codebase, there where some peculiar things and would like to discuss why this happens and the possibility to change this.

The first thing is that these notations are not supported:

  • same as(SOMEVAR) -> should be sameas(SOMEVAR). We would like to keep this with space.
  • divisible by(2) -> should be divisibleby(2). Again, we would like to keep this with a space.

Also we have some custom funcitons in our environment, it is okay that these wont be linted, but after adjusting the codebase to the above "issues" we still have 2 errors left:


  ERROR  in {SOMEFILE}.twig (line 49)
      47                                         {HTML HERE}
      48                                              {HTML HERE}
  >>  49                                                 {{ getCurrencySymbol() }}
  >> Value for argument "_" is required for function "getCurrencySymbol". 
      50                                                 {{  {HTML CUSTOM FUNCTIONS WITH ARGS HERE} }}
      51                                                 {HTML HERE}

Not sure why the linter gets confused on this

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.