BugiDev / react-native-calendar-strip

Easy to use and visually stunning calendar component for React Native.
MIT License
936 stars 325 forks source link

Add prettier to project #274

Closed pedrobslisboa closed 3 years ago

pedrobslisboa commented 3 years ago

Problem

The project doesn't have any prettier, so the code style doesn't follow any rule letting anyone commit formatted code

Solution

Add prettier to project

PS:

Here needed to be evaluated: training comma, ; at the end, parentheses on one arg arrow function ...

peacechen commented 3 years ago

I used Prettier in the past, but it mangles JSX that has multiple props. This project heavily uses JSX and prettier will cause problems. I recommend eslint which is more configurable and less opinionated.

pedrobslisboa commented 3 years ago

Eslint and prettier have different purposes https://prettier.io/docs/en/comparison.html

In other words, use Prettier for formatting and linters for catching bugs!

I have never faced any problems with prettier, I guess a test for it should be nice.

peacechen commented 3 years ago

There may be some truth to that, but there is overlap. ESlint has built-in formatting capabilities too. That statement from prettier is more marketing gimmick than absolute truth 🤣

https://www.digitalocean.com/community/tutorials/linting-and-formatting-with-eslint-in-vs-code https://medium.com/@netczuk/even-faster-code-formatting-using-eslint-22b80d061461

Prettier undoes multi-line JSX props and smashes them all onto one long line. That's the reason prettier was removed, and they refuse to add an option to stop doing that so this project won't go back to prettier. https://github.com/prettier/prettier/issues/5501

pedrobslisboa commented 3 years ago

True

peacechen commented 3 years ago

If you have any recommendations for eslint configuration rules, please feel free to submit a PR. It is valuable to have a basic set of formatting behavior.