question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`quotes` not working with backticks and function string arguments

See original GitHub issue

What version of ESLint are you using? eslint@2.5.3

What parser (default, Babel-ESLint, etc.) are you using? default

Please show your full configuration:

{
    "env": {
        "browser": true,
        "es6": true,
        "node": true
    },
    "extends": "eslint:recommended",
    "rules": {
        "quotes": [
            "error",
            "backtick",
            "avoid-escape"
        ]
    }
}

What did you do? Please include the actual source code causing the issue.

const foo = `Lorem`;
const bar = `Ipsum ${foo.replace("L", "l")}`;

What did you expect to happen? For the double quotes in the replace function to be valid because of the avoid-escape option.

What actually happened? Please include the actual, raw output from ESLint.

 /home/whitneyit/Code/test.js
  2:7   error  'bar' is defined but never used  no-unused-vars
  2:34  error  Strings must use backtick        quotes
  2:39  error  Strings must use backtick        quotes

Is this the intended behaviour? If not, would you welcome a PR?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
IanVScommented, Apr 14, 2016

I agree this isn’t a bug, and I’m not really a fan of changing the error message. Going down that rabbit hole can get very complicated very quickly, for little (if any) gain. Even if there are some unexpected situations like this that cause some research or an issue to check whether it’s a bug, in the end it all worked out and now there’s a github issue that others can learn from as well. So, personally I’m 👎 on any changes here.

0reactions
IanVScommented, Apr 14, 2016

Closing this, but feel free to speak up if you think we should reopen.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Single Quote, Double Quote, and Backticks in MySQL Queries
Inserting two double quotes in the middle of the string will cancel out one of them. Single Quotes. Using single quotes here is...
Read more >
Quotes are being treated differently in backtick output [duplicate]
The way it works, is that somecmd gets as argument the string contained in the variable a , regardless of what it contains....
Read more >
Back-ticks within double quotes - Stack Overflow
I want to add an argument with back-ticks within the query string. However when I execute it in the terminal the back-ticks get...
Read more >
Template literals (Template strings) - JavaScript | MDN
Template literals are enclosed by backtick ( ` ) characters instead of double or single quotes. Along with having normal strings, template ...
Read more >
SQL – Single quotes and backticks for query - WordPress.org
In PHP, vars in double quoted strings are automatically replaced with their assigned values. So the single quotes within are just characters, they...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found