2

I've setting up ESLint for a legacy project that uses ES5, but the shareable configs all seem to be ES6. So after pulling in eslint recommended and google I've had to start adding extra config to prevent ES6 checks like no-var. I was hoping that I wouldn't need to customize the recommended shareable configs too much so any updates can mostly come through shared configs without having to do a bunch of line-by-line comparisons.

Does anyone know where I can find recommended ES5 and Google ES5 configs for ESLint to be run over a Angular 1.x application?

This is an example of what I have so far, but it has no-var ES6 config etc included so I've had to include it myself:

{
  "env": {
    "browser": true
  },
  "extends": ["eslint:recommended", "google"],
  "parserOptions": {
    "ecmaVersion": 5
  },
  "rules": {
    "indent": ["error", 4, {"SwitchCase": 1}],
    "linebreak-style": 0,
    "padded-blocks": 0,
    "quotes": ["error", "single"],
    "semi": ["error", "always"],
    "no-unused-vars": ["off"],
    "valid-jsdoc": [
      "error",
      {
        "prefer": {
          "return": "returns"
        },
        "requireReturn": false,
        "requireParamDescription": false,
        "requireReturnDescription": false
      }
    ],

    "no-var": 0,
    "func-call-spacing": 0
  },
  "globals": {
    "angular": true,
    "node": true
  }
}
mtpultz
  • 17,267
  • 22
  • 122
  • 201
  • 1
    In config above `indent`, `quotes`... they are all a matter of taste, this is why it is important to come up with your own. Just run ESLint against your project and fix the discrepancies in config. I prefer to extend `eslint:recommended` only, multiple configs requires the one to refer to all of them to check default values. `no-var` is already off by default, the fact that you need to re-disable it means that `google` is ES6-ish and not for you. – Estus Flask Jan 31 '17 at 05:18
  • Thanks @estus, that uncomplicated the linting results. – mtpultz Jan 31 '17 at 06:09

0 Answers0