Skip to content
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

'no-unused-vars' flag despite being used in a template string #6143

Closed
Shockolate opened this issue May 11, 2016 · 3 comments
Closed

'no-unused-vars' flag despite being used in a template string #6143

Shockolate opened this issue May 11, 2016 · 3 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion triage An ESLint team member will look at this issue soon

Comments

@Shockolate
Copy link

What version of ESLint are you using?
v2.9.0

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

Please show your full configuration:

extends: airbnb
env:
  node: true
  mocha: true
  es6: true
rules:
  consistent-return: off
  strict: off
  no-console: off

What did you do? Please include the actual source code causing the issue.
I'm new to Javascript, so don't judge my code too harshly...

function sqlExecute(nameAndSqlParams, callback) {
  return sql.execute(nameAndSqlParams.seriateParams).then(
    (data) => (callback(null, data)),
    (err) => (callback('Error ${nameAndSqlParams.name} : ${err}'))
  );
}

What did you expect to happen?
No error or flag should be thrown with the no-unused-vars set to on.

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

$ ./node_modules/eslint/bin/eslint.js src/Persistence.js
   10:6   error  'err' is defined but never used      no-unused-vars
✖ 4 problems (4 errors, 0 warnings)
@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label May 11, 2016
@ben-page
Copy link

The problem is that your string isn't a template string. Template strings use backticks (`). Your string uses single quotes (').

@ben-page
Copy link

function sqlExecute(nameAndSqlParams, callback) {
  return sql.execute(nameAndSqlParams.seriateParams).then(
    (data) => (callback(null, data)),
    (err) => (callback(`Error ${nameAndSqlParams.name} : ${err}`))
  );
}

@Shockolate
Copy link
Author

The flag was no longer thrown when using the Grave Accent.
I didn't think to use the Grave Accent for my application was working with the Single Quote.
Closing

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 6, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion triage An ESLint team member will look at this issue soon
Projects
None yet
Development

No branches or pull requests

3 participants