.eslintrc files are not additive

linting

#1

eslint is designed so that .eslintrc files are additive as it goes down the directory structure. This is very useful so that one can add the following in an .eslintrc file in a test folder

{
  "env": {
    "mocha": true
  }
}

This has the effect of adding all the mocha globals (it, describe, before, after, etc) and this would only apply to files in the test folder and its subfolders.


#2

I’m not exactly sure what you’re asking, but as far as I can tell you’re asking why it isn’t adding it, describe, before, and after. I believe the reason for that is that you’re simply saying the “mocha” global exists (which Cloud9 I don’t think expects by default). It’s basically equivalent to /* global mocha */, so instead of adding all of mocha’s functions, it’s simply adding the mocha global. I’m not too familiar with importing those all at once, but if you add them all individually to the file just like you added mocha (for instance: “it”: true), then it will stop linting that.


#3

@dannytech http://eslint.org/docs/user-guide/configuring#specifying-environments


#4

The default linter in Cloud9 IDE uses a browser copy of eslint that does not support all of the same features as the cli tool, I wrote this plugin to fix the issues I had been having personally and it supports eslint properly like if you were using the eslint cli.