7

Excerpt from my .eslintrc:

env: {
    es6: true
}

Most files use es6 because they are passed through the Babel transpiler. However, some files are not. For those few can I get eslint to allow es5 syntax only?

T.J. Crowder
  • 1,031,962
  • 187
  • 1,923
  • 1,875
danday74
  • 52,471
  • 49
  • 232
  • 283
  • possible duplicate? https://stackoverflow.com/questions/34764287/turning-off-eslint-rule-for-a-specific-file – kaushik94 Jan 25 '18 at 10:24
  • 1
    no, thats disabling a rule for a file - this is changing an "env" setting for a file. – danday74 Jan 25 '18 at 10:25
  • 2
    @kaushik94: No, `env` isn't a rule. There is [`eslint-dev`](https://eslint.org/docs/user-guide/configuring#specifying-environments), but it doesn't document turning an env *off* (`/* eslint-dev: no-es6 */` or similar), just turning an env *on*. danday74: You might try that, though, or variations on it (or read the source). And if it doesn't work, fork eslint, add the feature, and do a pull request. :-) – T.J. Crowder Jan 25 '18 at 10:26
  • Would you like to enforce only es5 rules for these files? Like a split eslint setup? – Corné Jan 17 '22 at 02:12

0 Answers0