From bfb67994e894b9377669c1a4ea5dc99f1176f556 Mon Sep 17 00:00:00 2001 From: Alexander Fedyashov Date: Mon, 10 Sep 2018 14:13:30 +0300 Subject: [PATCH] chore(build): fix prettier imports (#3142) --- config.js | 1 - .../ComponentExample/ComponentExampleRenderEditor.js | 2 +- .../ComponentExample/ComponentExampleRenderHtml.js | 2 +- docs/src/utils/formatCode.js | 4 ++++ docs/src/utils/index.js | 1 - webpack.config.babel.js | 1 - 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/config.js b/config.js index 0c553d2654..86db5a6784 100644 --- a/config.js +++ b/config.js @@ -86,7 +86,6 @@ const config = { 'classnames', 'copy-to-clipboard', 'faker', - 'prettier/standalone', 'react', 'react-ace', 'react-dom', diff --git a/docs/src/components/ComponentDoc/ComponentExample/ComponentExampleRenderEditor.js b/docs/src/components/ComponentDoc/ComponentExample/ComponentExampleRenderEditor.js index 2d1832af1a..4d1c7036a3 100644 --- a/docs/src/components/ComponentDoc/ComponentExample/ComponentExampleRenderEditor.js +++ b/docs/src/components/ComponentDoc/ComponentExample/ComponentExampleRenderEditor.js @@ -5,7 +5,7 @@ import { Button, Popup, Segment, Menu } from 'semantic-ui-react' import Editor, { EDITOR_BACKGROUND_COLOR } from 'docs/src/components/Editor/Editor' import { updateForKeys } from 'docs/src/hoc' -import { formatCode } from 'docs/src/utils' +import formatCode from 'docs/src/utils/formatCode' const rootStyle = { position: 'relative', diff --git a/docs/src/components/ComponentDoc/ComponentExample/ComponentExampleRenderHtml.js b/docs/src/components/ComponentDoc/ComponentExample/ComponentExampleRenderHtml.js index f365ecab58..a1177ad5f4 100644 --- a/docs/src/components/ComponentDoc/ComponentExample/ComponentExampleRenderHtml.js +++ b/docs/src/components/ComponentDoc/ComponentExample/ComponentExampleRenderHtml.js @@ -3,7 +3,7 @@ import React, { PureComponent } from 'react' import { Divider } from 'semantic-ui-react' import Editor, { EDITOR_BACKGROUND_COLOR } from 'docs/src/components/Editor/Editor' -import { formatCode } from 'docs/src/utils' +import formatCode from 'docs/src/utils/formatCode' const rootStyle = { padding: '1rem', diff --git a/docs/src/utils/formatCode.js b/docs/src/utils/formatCode.js index 8b0164f084..8823b40a2d 100644 --- a/docs/src/utils/formatCode.js +++ b/docs/src/utils/formatCode.js @@ -4,6 +4,10 @@ import prettierConfig from '../../../.prettierrc.json' delete prettierConfig.$schema delete prettierConfig.overrides +// Heads up! +// Please use this function directly and don't reexport it in utils. +// https://github.com/prettier/prettier/issues/4959 + const formatCode = (code) => { if (!code) return '' diff --git a/docs/src/utils/index.js b/docs/src/utils/index.js index 80c5406191..62c21d1b45 100644 --- a/docs/src/utils/index.js +++ b/docs/src/utils/index.js @@ -4,7 +4,6 @@ export btoa from './btoa' export * from './constants' export componentInfoContext from './componentInfoContext' export examplePathToHash from './examplePathToHash' -export formatCode from './formatCode' export getComponentPathname from './getComponentPathname' export getFormattedHash from './getFormattedHash' export parseExamplePath from './parseExamplePath' diff --git a/webpack.config.babel.js b/webpack.config.babel.js index fd572207af..fe0fac3271 100644 --- a/webpack.config.babel.js +++ b/webpack.config.babel.js @@ -81,7 +81,6 @@ if (!__TEST__) { '@babel/standalone': 'Babel', faker: 'faker', 'prop-types': 'PropTypes', - 'prettier/standalone': 'prettier', react: 'React', 'react-dom': 'ReactDOM', 'react-dom/server': 'ReactDOMServer',