-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
enhance "quotes" fixer to take "avoidEscape" into consideration #12129
Comments
Hi @wmhilton, thank you for the proposal and for the relevant link. Someone will correct me if I'm wrong, I think that this enhancement would be incompatible with #10627 and that the question should the rule report error should be resolved first. |
@mdjermanovic I don't see how the proposed change in this issue is incompatible with #10627. If I understand correctly, this issue is proposing that when the rule console.log(`'a.txt' exists`) to this console.log("'a.txt' exists") rather than to this console.log('\'a.txt\' exists') Does that make sense? |
Makes sense, but the proposed change in #10627 is no error reported. That's why this is incompatible. Or am I reading something wrong, one example is with single quotes the other with double quotes but it's the same situation with different proposals? |
I see. The reason I though this was unrelated is that we specify |
Yes, but the rule shouldn't work differently with the explicit option's value than with the implicit default value ( |
Unfortunately, it looks like there wasn't enough interest from the team Thanks for contributing to ESLint and we appreciate your understanding. |
What rule do you want to change?
eslint --fix
rewrote my template strings (containing single quotes) into single quote strings (containing escaped single quotes) despite the fact that theavoidEscape
setting was true.I'd like to enhance the fixer function for https://eslint.org/docs/rules/quotes to take the
avoidEscape
setting into account when converting quotes from backtick to single quotes.Does this change cause the rule to produce more or fewer warnings?
exactly the same
How will the change be implemented? (New option, new default behavior, etc.)?
I would modify this function to have a second argument,
avoidEscape
:eslint/lib/rules/quotes.js
Lines 48 to 69 in 4aeeeed
Please provide some example code that this change will affect:
e.g. with these rules:
and this code
running
eslint --fix
would generate the following:What does the rule currently do for this code?
currently the fixer generates this:
which is technically correct but not as nice
What will the rule do after it's changed?
rule is same, only fixer changes
Are you willing to submit a pull request to implement this change?
yup
Note: kinda related to #10627
closes standard/standard#1380
The text was updated successfully, but these errors were encountered: