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.

no-var should not fix variables named 'let'

See original GitHub issue

Tell us about your environment

  • ESLint Version: 5.16.0
  • Node Version: 10.16.0
  • npm Version: 6.9.0

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

default

Please show your full configuration:

Configuration
module.exports = {
  parserOptions: {
    ecmaVersion: 6,
  },
  rules: {
    "no-var": "error",
  }
};

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

// this is valid code in non-strict mode

function foo() {
  var let;
}

function bar() {
  var { let } = {};
}

eslint index.js --fix

What did you expect to happen?

No autofix, because it produces SyntaxError.

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

function foo() {
  let let; // SyntaxError
}

function bar() {
  let { let } = {}; // SyntaxError
}

Off topic: ESLint parser doesn’t treat let { let } = {} as SyntaxError (probably an Acorn bug)

Are you willing to submit a pull request to fix this bug? yes

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mdjermanoviccommented, Jun 14, 2019

Sure, reported in acorn #837 now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why not letrec as fix? - scheme - Stack Overflow
I have not scrutinized the R5RS report, but I have used letrec and the equivalent "named let " in Scheme programs and the...
Read more >
4.6 Local Binding - Northwestern University PLT
That is, a named let binds a function identifier that is visible only in the function's body, and it implicitly calls the function...
Read more >
SCORE Statement - SAS Help Center
The SCORE statement applies the contents of the source item store to compute predicted values and other observation-wise statistics for a SAS data...
Read more >
sasmacros/existvar.sas at master · chris-swenson/sasmacros · GitHub
Name : ExistVar. Author: Chris Swenson. Created: 2011-04-18. Purpose: Check if a variable exists in a data set. Arguments: ds - data set....
Read more >
Eval - Neovim docs
This works like a :let command is done for each list item. Again, the types must remain the same to avoid an error....
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