-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
use strict
surrounded by backticks not correctly recognized by the strict rules being valid when quote backticks rule is also enforced
#3132
Comments
Thanks for the issue! We get a lot of issues, so this message is automatically posted to each one to help you check that you've included all of the information we need to help you. Reporting a bug? Please be sure to include:
Requesting a new rule? Please be sure to include:
Requesting a feature? Please be sure to include:
Including this information in your issue helps us to triage it and get you a response as quickly as possible. Thanks! |
use strict
not correctly recognized by the strict rules being valid when quote backticks is enforceduse strict
surrounded by backticks not correctly recognized by the strict rules being valid when quote backticks is enforced
use strict
surrounded by backticks not correctly recognized by the strict rules being valid when quote backticks is enforceduse strict
surrounded by backticks not correctly recognized by the strict rules being valid when quote backticks rule is also enforced
What warnings are you getting? |
Templates cannot be directives. See 14.1.1
|
Yes, Templates cannot be directives. So I guessed: test.js/* eslint quotes: [2, "backtick"] */
"use strict";
var foo = `test`; Command & Actual
ExpectedNo errors. |
Thanks to you both for enlightening me about this, making me much more informed about ES6 template tags than I thought possible from an issue! Should the It seems that individuals or teams who want to explore enforcing backticks within their JavaScript scripts wouldn't want lint errors in sections of code where it's not possible to be applied? Assuming people, like me would want to use |
I thought this is a bug. I have a question, should |
@mysticatea That's a good question. That should be an option, IMO. The naming for that may be tricky. Being purposely wildly imaginative, perhaps something like |
Just add a |
This is getting complicated. To keep matters simple, I think the rule should not check for directives if |
Agree with @IanVS. Let's keep it simple. |
OK, I will try to fix. |
Detailed information about the problem
For some reason,
use strict
surrounded by backticks seems to be incorrectly flagged as not adhering to rules regardingstrict
being used ("strict
, deprecated"global-strict"
) when strings are also enforce being backticks"quotes": [2, "backticks" ]
.From all the JS environments I've used w/ the support of ES6 template strings (Chrome, Firefox, Babel, & I think Microsoft Edge as well),
use strict
with backticks is correctly recognized as "use strict".If I'm misunderstood about the implication of these rules, feel free to let me know!
Relevant rules
Here's the rules I'm using to get this behavior:
Other Relevant Information
v0.24.1
Entire Config Object
The text was updated successfully, but these errors were encountered: