Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Prettier along with ESLint for maximum 🕶️ #35

Merged
merged 14 commits into from
May 24, 2017

Conversation

petetnt
Copy link
Member

@petetnt petetnt commented May 24, 2017

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 added 12 commits May 24, 2017 18:03
Signed-off-by: petetnt <pete.a.nykanen@gmail.com>
Signed-off-by: petetnt <pete.a.nykanen@gmail.com>
Signed-off-by: petetnt <pete.a.nykanen@gmail.com>
Signed-off-by: petetnt <pete.a.nykanen@gmail.com>
Signed-off-by: petetnt <pete.a.nykanen@gmail.com>
Signed-off-by: petetnt <pete.a.nykanen@gmail.com>
Signed-off-by: petetnt <pete.a.nykanen@gmail.com>
Signed-off-by: petetnt <pete.a.nykanen@gmail.com>
Signed-off-by: petetnt <pete.a.nykanen@gmail.com>
Signed-off-by: petetnt <pete.a.nykanen@gmail.com>
Signed-off-by: petetnt <pete.a.nykanen@gmail.com>
Signed-off-by: petetnt <pete.a.nykanen@gmail.com>
@petetnt petetnt requested a review from bostrom May 24, 2017 16:38
Signed-off-by: petetnt <pete.a.nykanen@gmail.com>
@petetnt
Copy link
Member Author

petetnt commented May 24, 2017

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

Copy link
Member

@bostrom bostrom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not exactly sure how it works, but it sounds darn cool! 😎

@petetnt petetnt merged commit 23c861a into master May 24, 2017
@petetnt petetnt deleted the config-with-prettier branch May 24, 2017 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants