Say Media's eslint / prettier config
Goals:
- Add support for ES6 by transitioning to ESLint.
- Minimize the transition friction for developers.
- Leverage the ESLint power to reduce the number of bugs.
- Progressively improve our code style.
- Provide a common set of options for code formatting applied by Prettier.
Steps:
- Start from the "Standard" ESLint settings.
- Apply/disable rules until it matches our code style/state.
- Replace JSHint and JSCS by ESLint in the Gruntfile.
- Discuss the changes from the "Standard" and possibly move closer to the "Standard".
Install eslint and eslint-config-saymedia
:
npm install --save-dev eslint saymedia/eslint-config-saymedia
If you've installed eslint-config-saymedia
locally within your project, just set your eslint
config to:
{
"extends": "saymedia"
}
For using our Prettier defaults, you'll want to make a .prettierrc.js
file with this:
module.exports = require('eslint-config-saymedia/.prettierjs');
- eslint-config-standard: JavaScript Standard Style
- eslint-config-prettier: Turns off all rules that are unnecessary or might conflict with Prettier.
- eslint-plugin-prettier: Runs Prettier as an ESLint rule and reports differences as individual ESLint issues.
- eslint-plugin-standard: ESlint Rules for the Standard Linter.
- eslint-plugin-node: Additional ESLint's rules for Node.js.
- eslint-plugin-promise: Enforce best practices for JavaScript promises.
- eslint-plugin-import: ESLint plugin with rules that help validate proper imports.