-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Tagged template string considered an expression, not a function call #822
Comments
Thanks for the issue, @yoshuawuyts. This sounds like a bug in ESLint's |
Thank you :D
…On Fri, Mar 17, 2017, 01:28 Feross Aboukhadijeh ***@***.***> wrote:
Thanks for the issue, @yoshuawuyts <https://github.com/yoshuawuyts>. This
sounds like a bug in ESLint's no-unused-expressions
<http://eslint.org/docs/rules/no-unused-expressions> rule. I'll open an
issue with them.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#822 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACWleuW4Kz7xzeDtLmEPlVyQ_a9AFqneks5rmdOcgaJpZM4Mf-lN>
.
|
Issue filed here: eslint/eslint#8268 |
They actually already have a PR out that adds an option to ignore tagged template literals: eslint/eslint#8253 When that makes it into a release, I'll add the option and publish a new version on the v9 and v10 lines. |
@feross FYI, today's release will most likely contain this fix! |
@vitorbal Excellent! Just saw that. I'll do a |
…ssions) Fixes: standard/standard#822 Fixes "Expected an assignment or function call and instead saw an expression." error when using a standalone tagged template string like: ```js var css = require('sheetify') css` .js-yellow { color: #f7df1e } .bg-js-yellow { background-color: #f7df1e } ` ```
Fix published as 9.0.2. (Also, for users of the v10 beta, published as 10.0.0-beta.2.) |
Intro
Template strings are a way to interpolate variables with strings. It's nice, and often more readable than traditional string concatenation
Tagged template strings take this behavior a bit further, and allow functions to be called as if they were strings - but instead the functions receive multiple strings, and a trailing array of positional arguments that the have been used for interpolation. This allows operating on the string and adding all sorts of interesting behavior.
Example
Bug
It appears that
standard@9
has introduced a regression where tagged template strings are now considered static expressions - even though they're functions. I think we should probably look into this.Thanks!
The text was updated successfully, but these errors were encountered: