nkt/eslint-plugin-es5

const and let is still allowed

Closed this issue · 2 comments

I'm using your es5 plugin which is very nice however eslint still is not complaining about const and let.
Unfortunately our environment does not support const nor let (which come from es6)

Are you still seeing this error? What does your ESLint config contain? Does it include the es5/no-block-scoping rule?

@macklinu thank you!
With this rule it works perfectly fine.
This is my test config:

.eslintrc.json

{
    "plugins": [ "es5" ],
    "extends": [ "plugin:es5/no-es2015" ],
    "parserOptions": { "sourceType": "module" },
    "rules": { "es5/no-block-scoping": "error" }
}

and the test file:

index.js

const a = 5;
let b = 10;
$ npx eslint index.js 
index.js
  1:1  error  Unexpected const declaration  es5/no-block-scoping
  2:1  error  Unexpected let declaration    es5/no-block-scoping

✖ 2 problems (2 errors, 0 warnings)