From 510dbdccb78bf9e1fca82fd69bdfb2235d1faf5d Mon Sep 17 00:00:00 2001 From: Jeff Reiner Date: Thu, 7 Feb 2019 17:54:00 +0100 Subject: [PATCH 1/3] :heavy_plus_sign: adding prettier and format npm command --- package-lock.json | 41 +++++++++++------------------------------ package.json | 3 ++- 2 files changed, 13 insertions(+), 31 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9fd93e2..11b5ecf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6888,8 +6888,7 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -6910,14 +6909,12 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -6932,20 +6929,17 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -7062,8 +7056,7 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -7075,7 +7068,6 @@ "version": "1.0.0", "bundled": true, "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -7090,7 +7082,6 @@ "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -7098,14 +7089,12 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -7124,7 +7113,6 @@ "version": "0.5.1", "bundled": true, "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -7205,8 +7193,7 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -7218,7 +7205,6 @@ "version": "1.4.0", "bundled": true, "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -7304,8 +7290,7 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -7341,7 +7326,6 @@ "version": "1.0.2", "bundled": true, "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -7361,7 +7345,6 @@ "version": "3.0.1", "bundled": true, "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -7405,14 +7388,12 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true } } }, diff --git a/package.json b/package.json index 41bfb34..cdb7108 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,8 @@ "build-storybook": "build-storybook", "publish": "lerna publish --skip-git --skip-npm", "precommit": "npm test", - "postinstall": "npm run bootstrap" + "postinstall": "npm run bootstrap", + "format": "prettier --write \"./**/*.js\"" }, "devDependencies": { "@babel/cli": "^7.2.3", From 7e313230bb6f0c84b61ff521c99826f504634ea8 Mon Sep 17 00:00:00 2001 From: Jeff Reiner Date: Thu, 7 Feb 2019 17:54:31 +0100 Subject: [PATCH 2/3] :art: running prettier --- .storybook/addons.js | 6 +- .storybook/config.js | 40 +- .storybook/webpack.config.js | 60 +-- packages/modal/__tests__/modal.test.js | 6 +- packages/modal/src/Modal.js | 59 ++- packages/modal/src/index.stories.js | 101 ++--- packages/theme/__tests__/theme.test.js | 6 +- packages/theme/src/AxisTheme.js | 25 +- packages/theme/src/grommet.stories.js | 473 +++++++++++------------ packages/theme/src/index.js | 4 +- packages/theme/src/superset.stories.js | 32 +- packages/theme/src/theme.js | 369 +++++++++--------- packages/theme/src/typography.stories.js | 183 +++++---- 13 files changed, 682 insertions(+), 682 deletions(-) diff --git a/.storybook/addons.js b/.storybook/addons.js index 4b70c11..c56e8a3 100644 --- a/.storybook/addons.js +++ b/.storybook/addons.js @@ -1,3 +1,3 @@ -import '@storybook/addon-options/register'; -import '@storybook/addon-storysource/register'; -import '@storybook/addon-viewport/register'; +import "@storybook/addon-options/register"; +import "@storybook/addon-storysource/register"; +import "@storybook/addon-viewport/register"; diff --git a/.storybook/config.js b/.storybook/config.js index c2e7f50..51674a1 100644 --- a/.storybook/config.js +++ b/.storybook/config.js @@ -1,31 +1,33 @@ -import React from 'react' -import {addDecorator, configure} from '@storybook/react' -import {withOptions} from '@storybook/addon-options'; -import {configureViewport, INITIAL_VIEWPORTS,withViewport} from '@storybook/addon-viewport'; +import React from "react"; +import { addDecorator, configure } from "@storybook/react"; +import { withOptions } from "@storybook/addon-options"; +import { + configureViewport, + INITIAL_VIEWPORTS, + withViewport +} from "@storybook/addon-viewport"; -const req = require.context('../packages', true, /.stories.js$/); +const req = require.context("../packages", true, /.stories.js$/); function loadStories() { - console.log('Load Stories', req.keys()) - req.keys().forEach(filename => req(filename)); + console.log("Load Stories", req.keys()); + req.keys().forEach(filename => req(filename)); } configureViewport({ - ...INITIAL_VIEWPORTS -}) - + ...INITIAL_VIEWPORTS +}); addDecorator( - withOptions({ - name: 'Centrifuge Axis', - url: 'https://axis.centrifuge.io', - sortStoriesByKind: true, - hierarchySeparator: /\//, - hierarchyRootSeparator: /\|/ - }) + withOptions({ + name: "Centrifuge Axis", + url: "https://axis.centrifuge.io", + sortStoriesByKind: true, + hierarchySeparator: /\//, + hierarchyRootSeparator: /\|/ + }) ); - -addDecorator(withViewport()) +addDecorator(withViewport()); configure(loadStories, module); diff --git a/.storybook/webpack.config.js b/.storybook/webpack.config.js index a6a8d90..5abd53a 100644 --- a/.storybook/webpack.config.js +++ b/.storybook/webpack.config.js @@ -1,39 +1,39 @@ module.exports = (baseConfig, env, config) => { - // Find Babel Loader - const babelRules = config.module.rules.filter(rule => { - let isBabelLoader = false; + // Find Babel Loader + const babelRules = config.module.rules.filter(rule => { + let isBabelLoader = false; - if (rule.loader && rule.loader.includes('babel-loader')) { - isBabelLoader = true; - } + if (rule.loader && rule.loader.includes("babel-loader")) { + isBabelLoader = true; + } - if (rule.use) { - rule.use.forEach(use => { - if (typeof use === 'string' && use.includes('babel-loader')) { - isBabelLoader = true; - } else if ( - typeof use === 'object' && - use.loader && - use.loader.includes('babel-loader') - ) { - isBabelLoader = true; - } - }); + if (rule.use) { + rule.use.forEach(use => { + if (typeof use === "string" && use.includes("babel-loader")) { + isBabelLoader = true; + } else if ( + typeof use === "object" && + use.loader && + use.loader.includes("babel-loader") + ) { + isBabelLoader = true; } + }); + } - return isBabelLoader; - }); + return isBabelLoader; + }); - babelRules.forEach(rule => { - rule.include = /../; - rule.exclude = /node_modules/; - }); + babelRules.forEach(rule => { + rule.include = /../; + rule.exclude = /node_modules/; + }); - config.module.rules.push({ - test: /\.stories\.js?$/, - loaders: [require.resolve('@storybook/addon-storysource/loader')], - enforce: 'pre', - }); + config.module.rules.push({ + test: /\.stories\.js?$/, + loaders: [require.resolve("@storybook/addon-storysource/loader")], + enforce: "pre" + }); - return config; + return config; }; diff --git a/packages/modal/__tests__/modal.test.js b/packages/modal/__tests__/modal.test.js index 2ea088d..84b8197 100644 --- a/packages/modal/__tests__/modal.test.js +++ b/packages/modal/__tests__/modal.test.js @@ -1,5 +1,5 @@ -import modal from '../src/modal'; +import modal from "../src/modal"; -describe('modal', () => { - it('needs tests'); +describe("modal", () => { + it("needs tests"); }); diff --git a/packages/modal/src/Modal.js b/packages/modal/src/Modal.js index fb22469..c170a8c 100644 --- a/packages/modal/src/Modal.js +++ b/packages/modal/src/Modal.js @@ -1,34 +1,31 @@ -import React from 'react'; -import {Box, Button, Heading, Layer} from "grommet"; -import {Close} from "styled-icons/material"; +import React from "react"; +import { Box, Button, Heading, Layer } from "grommet"; +import { Close } from "styled-icons/material"; -export const Modal = (props) => { +export const Modal = props => { + return ( + + + + {props.title && ( + + {props.title} + + )} + {props.onClose &&