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

block-scoped-var gives a false positive on function argument destructuring #1996

vasa-chi opened this issue Mar 10, 2015 · 2 comments


None yet
2 participants
Copy link

commented Mar 10, 2015

$ eslint --version


  "env": {
    "es6": true
  "rules": {
    "block-scoped-var": 2
  "ecmaFeatures": {
    "destructuring": true


'use strict';

var fun = function({x}) {
  return x;

var fun2 = function(arg) {
  var {x} = arg;
  return x;

fun({x: 2});
fun2({x: 2});


  4:9  error  "x" used outside of binding context  block-scoped-var

✖ 1 problem (1 error, 0 warnings)

As you can see, the second function is linted correctly (due to #1863), but the first one fails.


This comment has been minimized.

Copy link

commented Mar 10, 2015

Yeah, we are probably just not dealing with destructured args properly.

BerkeleyTrue pushed a commit to ThunderCatsJS/thundercats that referenced this issue Mar 11, 2015

Berkeley Martinez Berkeley Martinez
More linting
Known issue with deconstructing arguments an eslint
see: eslint/eslint#1996

This comment has been minimized.

Copy link

commented Mar 14, 2015

Working on this.

@nzakas nzakas closed this in 57523ea Mar 14, 2015

nzakas added a commit that referenced this issue Mar 14, 2015

Merge pull request #2033 from eslint/issue1996
Fix: destructured arguments should work in block-scoped-var (fixes #1996...

@eslint eslint bot locked and limited conversation to collaborators Feb 7, 2018

@eslint eslint bot added the archived due to age label Feb 7, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.