Skip to content

Instantly share code, notes, and snippets.

@alexdiliberto
Last active August 31, 2022 23:20
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save alexdiliberto/bdb0096aa63dabc1d6f389df564fc10c to your computer and use it in GitHub Desktop.
Save alexdiliberto/bdb0096aa63dabc1d6f389df564fc10c 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