-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
[RFC] Rule whish list #211
Comments
Hi, thanks for the feedback. A way to know how hard the rule would be to implement is to look at the way the Tokenizer tokenize your strings.
is tokenized
It should be possible to introduce a rule which say that every STRING_TYPE starting/ending with Something like
is tokenized
So we shouldn't have issue with interpolation. |
For
it's (without the whitespace type)
We could look at STRING_TYPE which is just before a PUNCTUATION_TYPE
because in such syntax I tokenize NB
would be tokenized |
So I assume that both of these rule are possible and not so hard. |
I would like to contribute to this project, But I fear I'll lake time! We'll see :) |
How would you handle keys that do need quotes ? Keep the quotes only for them ? (seems legit)
|
- {{ include("hello.html.twig") }}
+ {{ include('hello.html.twig') }} Would love to have this rule! 👍 |
Yeah it seems legit to keep the quote.
I think we should rely on
Why the quote is needed here ? On the contrary
is a valid key but is different from
So i think only number with the format |
Well obviously if i forget to type the most important char.....
So i think you're right: using the Tokenizer::REGEX_NAME should be a perfect check |
Oh, I see. So we could do Tokenizer::REGEX_NAME and |
On it ! |
Any feedback @smnandre ? I was thinking about merging/releasing the feature in the next days. |
Oh sorry! It's perfect and really usefull to normalize code styles! Tested on a personal project + ux website: all works as expected. 👏 |
Thanks for the feedback, I released. I will try to work on
unless you already started @lyrixx ? |
No, Sorry, I didn't find time to work on it |
The HashQuoteRule is ready for beta-test By default, it require to use quote for hash (opinionated choice, it gives consistency and avoid mistake). An option exist to remove quote when possible, it will remove quote
|
LGTM 👍🏼 |
Thanks. @smnandre did you find any false positive ? |
I only tested quickly on a personal project to be honest 🤷 ... |
No problem. I merged the PR to test more easily. I'll also maybe change the default value |
It's not impossible there is no common ground here 🤷 |
Released in 2.9.0 |
Hello,
I have a wish list 🎁 :) Feel free to close it if it's not in your scope!
Remove useless quote in hashes
Do you think it would be doable to apply this diff
Use the same quote everywhere
Note: It would depends on the configuration
The text was updated successfully, but these errors were encountered: