motleyagency / eslint-config-motley

Motley (https://motley.fi) JavaScript/Typescript guidelines as ESLint rules with Prettier autoformatting
https://motley.fi
MIT License
6 stars 0 forks source link

Use Prettier along with ESLint for maximum :dark_sunglasses: #35

Closed petetnt closed 7 years ago

petetnt commented 7 years ago

This PR revamps the eslint-config-motley to use prettier alongside eslint-config-motley, to make coding ever faster while keeping the 🕶 styles.

Prettier is

an opinionated JavaScript formatter inspired by refmt with advanced support for language features from ES2017, JSX, and Flow. It removes all original styling* and ensures that all outputted JavaScript conforms to a consistent style.

Basically it modifies the code you wrote and makes it look even more pretty. It focuses on style, which has never been eslints strong part: for example eslint can never fix overly long lines automatically, but it can warn about them.

Because eslint-config-airbnb also does some things with the styles, we also enable https://github.com/prettier/eslint-config-prettier which disables all the style related rules. Instead the style errors are automatically fixed by lint-staged and husky when you are committing code in. Very nice!

With this PR, the script also configures .eslintrc.js and package.json for you, so it's pretty much zero configuration.

Installation is done by a simple script similar to eslint-config-airbnb, and this version is released as @next at the moment. If you want to try it, run

(
  export PKG=eslint-config-motley
  npm info "$PKG@latest" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs 
  npm install --save-dev "$PKG@latest"
)

on your project folder containing package.json

petetnt commented 7 years ago

Fixes #31, #33 and maybe #34 too.