deseretdigital / dayzed

Primitives to build simple, flexible, WAI-ARIA compliant React date-picker components.
https://dayzed.netlify.app
MIT License
663 stars 27 forks source link

Add Prettier and ESLint #5

Closed mkartchner994 closed 6 years ago

mkartchner994 commented 6 years ago

Would be nice to add Prettier and ESLint to the project. https://prettier.io/ https://eslint.org/

arthurdenner commented 6 years ago

I was missing this while doing #17. Since we're using kcd-scripts, could we only extend its configuration and change what we want? I've used it once and the only thing I changed was the Prettier configuration because I only like to override "singleQuote": true and "trailingComma": "es5". The default overrides are:

semi: false,
singleQuote: true,
trailingComma: 'all',
bracketSpacing: false,
mkartchner994 commented 6 years ago

I like this idea. This is the only thing I have used kcd-scripts for so I am not as familiar on how to get it set up. I am open to any suggestions for how to do so. Thanks!

arthurdenner commented 6 years ago

I think the main point is to decide which Prettier options to follow. kcd-scripts has some overrides that we can use or create our own.

About ESLint, you can add the following on package.json and be good to go:

"eslintConfig": {
    "extends": "./node_modules/kcd-scripts/eslint.js",
    "rules": {
    // overrides rules if you want
    }
  },
  "eslintIgnore": [
    "node_modules",
    // ignore whatever you want
],

I'd suggest to add two scripts on package.json too:

"lint": "kcd-scripts lint", // checks for ESLint errors
"precommit": "kcd-scripts precommit", // format the code accordingly to the rules you setup before commiting
mkartchner994 commented 6 years ago

This has been merged to master in this PR - https://github.com/deseretdigital/dayzed/pull/19. I will look at releasing a new version to npm soon, as this updated some of the internals for some date calculations.

Thanks again @arthurdenner!