-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP "short echo tag" not supported #4
Comments
I think I created this issue a bit too fast. The problem is more specific than that. The actual regex does SUPPORT the short echo tags. The problem I have specifically is that I have this tag INSIDE a For example, <script>
<?= 'var ok = 123;' ?>
</script> When I remove this line specifically, the whole file get properly linted even if it has numerous other "short echo tags"🤔 |
There are some other issues too, that are out of scope for this I think. e.g.
In a similar vein, you could just replace your short echo tags with regular php tags and replace it back after the run finished. |
Oh well 😞 I think I begin to see the PROs and CONs of trying to lint javascript in PHP template files. As far as it goes, the current approach doesn't seem to be very reliable. And I mean it without blaming this plugin, Maybe there is an alternative I'm not aware of in the PHP ecosystem. |
Exactly, there are too many variables in code style, inline HTML/JS,... with PHP. You just have to preprocess php/phtml files which will "fix" issues that match your project's specific code file and then you're good. The above .sh works perfectly for any WordPress files (as short echo tags are disallowed for WP) |
I was trying the plugin and was doing fine except I got the famous "Unexpected token <" error only to find out that my PHP code is using what is call "short echo tags" - i.e.
<?= ... ?>
- which is not actually supported, see https://github.com/tengattack/eslint-plugin-php-markup/blob/master/lib/index.js#L134Reference: https://www.php.net/manual/en/language.basic-syntax.phptags.php
The text was updated successfully, but these errors were encountered: