-
Notifications
You must be signed in to change notification settings - Fork 169
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
Drop requirement of double quotes in string literals #316
Comments
JS has backtick but solidity don't. I have to escape every double quote or |
I understand the problem. If you are using both types of quotes, chose the most useful for you, config that type of quote in If there's no 'most useful' and you need both, just disable the rule Sorry for the late response. Thanks for posting |
Thanks for the tip, it may be a good solution for many users! I still think that the defaults could be improved, and that making the rule "smarter" would prevent a lot of frustration. What you're suggesting doesn't make the linter more elastic, the users still need to wrestle with it in some cases, it's just an inverses of when the struggle will happen. Choosing neither Making the rule look at the content of the string, and automatically disabling errors coming from using quotes in the other flavor, would be the sane default. It would push users to using one flavor consistently (double is a fine choice), and would promote the usage of the other flavor when it makes the code cleaner. Full disclaimer: I don't use Solhint now. |
@CodeSandwich thanks for the feedback Skip the warning for cases like this: On the other hand. If you're still doing solidity, check the new version !! It has a lot of improvements! Hey! Thanks a lot for posting and sorry the late response |
Yes, that would be it! WDYT, do you like this idea? It wouldn't be triggered by the existing code, the linter would only become more forgiving. Thank you for maintaining Solhint, you're doing an invaluable work! It's a solid tool used all over the ecosystem, and you've effectively revived it. |
It is a good one... and I understand your point... it is a bummer to disable rules on some lines because of it Thanks for your input and your kind words!!! |
Solidity allows double or single quotes in string literals. It's useful in cases where the string itself contains quotes, it removes the need for escaping them. Banning one flavor upfront doesn't seem reasonable, it fights usage of a genuine readability improvement tool. Single quotes aren't confusing for the readers and AFAIK don't pose any threat of introducing bugs.
If avoiding single quotes is important, maybe they could be allowed only if the string contains double quotes?
The text was updated successfully, but these errors were encountered: