bulletproof-react icon indicating copy to clipboard operation
bulletproof-react copied to clipboard

Create prettier.config.js instead of .prettierrc

Open DoctorDerek opened this issue 4 years ago • 1 comments
trafficstars

Rationale

1️⃣ I find it a waste of everyone's time to expect people to memorize the Prettier defaults. 2️⃣ If you want to use Airbnb's line length default (printWidth: 100), that's fine, but let's note that choice in a comment.

Code changes

✅ chore: rename .prettierrc to prettier.config.js and add comments with Prettier defaults to indicate that a non-default value is being used for only printWidth ✅ chore: remove explicit "usePrettierrc: true" from .eslintrc.js (as this is the default setting, so just ["error"] is fine)

Testing

✅ manually tested with npm run lint ✅ manually tested using VS Code extensions (Prettier, ESLint)

Note

1️⃣ There is a line ending bug on Windows associated with erroring on ESLint; I'll submit a .gitattributes file to fix this in a separate PR. 2️⃣ I'm not 100% sure that eslint --fix . has the same behavior of prettier --write . because Prettier explicitly has different rules for line length that ESLint does. I always use Prettier then ESLint for linting, personally. That would need to be another PR.

DoctorDerek avatar Jul 26 '21 22:07 DoctorDerek

per https://github.com/prettier/prettier-eslint#this-solution the answer is yes that eslint --fix will run Prettier first. That was the whole idea of the plugin, apparently.

DoctorDerek avatar Jul 26 '21 22:07 DoctorDerek