eslint: Can't disable an env in a single file
I’ve got a project all written in ES6, except for a single file that is in ES5.
In my .eslintrc:
env:
es6: true
node: true
browser: true
In the single ES5 file:
/*eslint-env es6:false*/
const fn = () => {};
I expected to get an eslint error for the fat arrow, but there’s no error.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 3
- Comments: 22 (14 by maintainers)
So in the end there is no plan to add this feature (disabling an env in a comment)? It’s quite useful when you are gradually migrating your app from ES5 and ES6 and have a mix of both in the same folder, and it’s always better to remove comments disabling es6 as you migrate rather than adding them to enable it.
Looks like this is now availabe, at least in v3.3.1 I am using:
More here: http://eslint.org/docs/user-guide/configuring
@callumlocke Having another .eslintrc file in subdirectory will work. ESLint cascades all config files, so you can just turn off unneeded environments or add new ones for subdirectories.