Skip to content

Instantly share code, notes, and snippets.

@xomaczar
Forked from alexdiliberto/.eslintrc.js
Created September 25, 2019 18:34
Show Gist options
  • Save xomaczar/e52af62754aa1aea87c4d09c1a3109f0 to your computer and use it in GitHub Desktop.
Save xomaczar/e52af62754aa1aea87c4d09c1a3109f0 to your computer and use it in GitHub Desktop.
Integrate Prettier with Ember
/*
'plugin:prettier/recommended' does the following:
extends: ['prettier'],
plugins: ['prettier'],
rules: {
'prettier/prettier': 'error'
}
*/
module.exports = {
// ...
extends: [
'eslint:recommended',
'plugin:ember/recommended',
'plugin:prettier/recommended'
]
// ...
};
// This allows editors like atom-prettier to hook into these configuration options as well
{
"arrowParens": "always",
"bracketSpacing": true,
"printWidth": 100,
"proseWrap": "preserve",
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "none",
"useTabs": false
}
  • yarn add --dev prettier eslint-plugin-prettier eslint-config-prettier
  • Update .eslintrc.js and add .prettierrc if you does not yet exist (shown above)
  • Install prettier-atom or other Editor Integration plugin of your choice
  • Optional: Configure your text editor plugin to always run on "File Save"
  • Restart ember serve
{
"devDependencies": {
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-prettier": "^2.6.0",
"prettier": "^1.13.4"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment