Using ESLint within an EmberJS app

Mar 22, 2016 using tags emberjs, eslint

Here’s what you’ll need in your Ember app:

npm install --save-dev babel-eslint eslint estraverse estraverse-fb eslint-config-google

This is a basic .eslintrc you can use to get going. Tweak the rules to your liking – this particular one starts with the very reasonable Google Style Guide.

  "extends": "google",
  "parser": "babel-eslint",
  "rules": {
    "require-jsdoc": 0

You now have the option of either invoking eslint directly:

$(npm bin)/eslint app/
$(npm bin)/eslint tests/

Or via npm:

npm run eslint-app
npm run eslint-tests

Note that you’ll need to update the scripts section of your package.json file in order for the latter to work:

"scripts": {
   // ...
   "eslint-app": "eslint app/",
   "eslint-tests": "eslint tests/"

Happy Linting!