From 0208e76b60e8c86d294720819220e052fd439c67 Mon Sep 17 00:00:00 2001 From: "Kent C. Dodds" Date: Sat, 7 Apr 2018 07:28:07 -0600 Subject: [PATCH] chore: add prettier config for editors to be happy --- .prettierignore | 4 ++++ .prettierrc | 10 ++++++++++ CONTRIBUTING.md | 8 ++++---- src/scripts/build/babel.js | 2 +- src/scripts/build/rollup.js | 12 +++++------- 5 files changed, 24 insertions(+), 12 deletions(-) create mode 100644 .prettierignore create mode 100644 .prettierrc diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..30117ea2 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,4 @@ +package.json +node_modules +dist +coverage diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..fb31ee19 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,10 @@ +{ + "printWidth": 80, + "tabWidth": 2, + "useTabs": false, + "semi": false, + "singleQuote": true, + "trailingComma": "all", + "bracketSpacing": false, + "jsxBracketSameLine": false +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 30ea497f..a552a524 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,10 +7,10 @@ Thanks for being willing to contribute! ## Project setup -1. Fork and clone the repo -2. `$ npm install` to install dependencies -3. `$ npm run validate` to validate you've got it working -4. Create a branch for your PR +1. Fork and clone the repo +2. `$ npm install` to install dependencies +3. `$ npm run validate` to validate you've got it working +4. Create a branch for your PR > Tip: Keep your `master` branch pointing at the original repository and make > pull requests from branches on your fork. To do this, run: diff --git a/src/scripts/build/babel.js b/src/scripts/build/babel.js index 81e6d82b..d4486b63 100644 --- a/src/scripts/build/babel.js +++ b/src/scripts/build/babel.js @@ -28,7 +28,7 @@ if (!useSpecifiedOutDir && !args.includes('--no-clean')) { const result = spawn.sync( resolveBin('babel-cli', {executable: 'babel'}), [...outDir, ...copyFiles, ...ignore, ...config, 'src'].concat(args), - {stdio: 'inherit'} + {stdio: 'inherit'}, ) process.exit(result.status) diff --git a/src/scripts/build/rollup.js b/src/scripts/build/rollup.js index 21e4fcc3..7b718747 100644 --- a/src/scripts/build/rollup.js +++ b/src/scripts/build/rollup.js @@ -79,14 +79,14 @@ if (result.status === 0 && buildPreact && !args.includes('--no-package-json')) { module: path.relative(preactDir, esmFile), }, null, - 2 - ) + 2, + ), ) } function getPReactScripts() { const reactCommands = prefixKeys('react.', getCommands()) - const preactCommands = prefixKeys('preact.', getCommands({ preact: true })) + const preactCommands = prefixKeys('preact.', getCommands({preact: true})) return getConcurrentlyArgs(Object.assign(reactCommands, preactCommands)) } @@ -97,9 +97,7 @@ function prefixKeys(prefix, object) { }, {}) } -function getCommands({ - preact = false, -} = {}) { +function getCommands({preact = false} = {}) { return formats.reduce((cmds, format) => { const [formatName, minify = false] = format.split('.') const nodeEnv = minify ? 'production' : 'development' @@ -115,7 +113,7 @@ function getCommands({ `BUILD_NODE=${process.env.BUILD_NODE || false}`, `BUILD_REACT_NATIVE=${process.env.BUILD_REACT_NATIVE || false}`, ].join(' '), - sourceMap + sourceMap, ) return cmds }, {})