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

const inside switch case statement is a syntax error #54

Closed
dmnd opened this issue Feb 8, 2015 · 3 comments
Closed

const inside switch case statement is a syntax error #54

dmnd opened this issue Feb 8, 2015 · 3 comments

Comments

@dmnd
Copy link

dmnd commented Feb 8, 2015

From eslint/eslint#1805

Maybe a bug with ES 6 block bindings?

$ eslint -v
v0.14.1


$ eslint -c .eslintrc test.js 

test.js
  4:7  error  Unexpected token const

✖ 1 problem (1 error, 0 warnings)


$ cat test.js 
function fn(foo) {
  switch (foo) {
    case "foo":
      const bar = "bar";
      break;
  }
}


$ cat .eslintrc 
env:
  browser: true,
  node: true

ecmaFeatures:
  blockBindings: true

Want to back this issue? Place a bounty on it! We accept bounties via Bountysource.

@nzakas
Copy link
Member

nzakas commented Feb 19, 2015

Related: jquery/esprima#1070

@nzakas
Copy link
Member

nzakas commented Feb 21, 2015

Working on this.

@nzakas nzakas closed this as completed in 457de85 Feb 21, 2015
nzakas added a commit that referenced this issue Feb 21, 2015
Fix: Allow let/const in switchcase (fixes #54)
@dmnd
Copy link
Author

dmnd commented Feb 21, 2015

🎸

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants