I haven’t posted anything for months, and I want to change that soon. But, as my time is limited recently I want to start small. Just a quick tip for today. I have been struggling with some obstacles when switching from jshint to eslint in my Ember projects, whether due to updated Ember library, cli, or some other not so well documented changes. However, now it seems to be a really easy job to do.

Just a few quick steps

Which are:

  • uninstall ember-cli-jshint
  • install eslint npm install eslint --save-dev
  • ember install ember-cli-eslint
  • that’s it. You can start configuring
  • if you want to use plugins npm install eslint-plugin-import --save-dev

My configuration

My go for configuration for ember projects is based on airbnb-base style guides. You will also need to install a couple more things.

  npm install eslint-config-airbnb-base --save-dev
  npm install eslint-plugin-import --save-dev

And my entire .eslintrc file

{
  "extends": "airbnb-base",

  "env": {
    "browser": true,
    "es6": true,
    "node": true
  },

  "rules": {
    "quotes": [2, "double", "avoid-escape"],
    "indent": [2, 4],
    "func-names": 0,
    "no-use-before-define": [2, "nofunc"],
    "prefer-arrow-callback": 0,
    "prefer-rest-params": 0,
    "import/no-unresolved": 0,
    "no-underscore-dangle": 0
  }
}

I hope some of you find this post helpful.