Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default pragma #229

Merged
merged 3 commits into from
Sep 26, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
357 changes: 237 additions & 120 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"watch:venia-dev-server": "cd packages/venia-concept && nodemon --watch ../pwa-buildpack/dist --watch webpack.config.js --delay 1 --ext js,json --exec npm run-script watch; cd - >/dev/null"
},
"devDependencies": {
"@magento/eslint-config": "^1.0.0",
"@magento/eslint-config": "^1.2.3",
"@storybook/addon-actions": "^3.4.2",
"@storybook/addons": "^3.4.6",
"@storybook/react": "^3.4.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/peregrine/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"plugins": [
"transform-object-rest-spread",
"transform-class-properties",
["transform-react-jsx", { "pragma": "createElement" }],
["transform-react-jsx"],
["transform-runtime", {
"helpers": true,
"polyfill": false, // polyfills will be handled by preset-env
Expand All @@ -23,7 +23,7 @@
"transform-es2015-modules-commonjs",
"transform-object-rest-spread",
"transform-class-properties",
["transform-react-jsx", { "pragma": "createElement" }]
["transform-react-jsx"]
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/peregrine/src/ContainerChild/ContainerChild.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createElement, Component } from 'react';
import { Component } from 'react';
import { func, string } from 'prop-types';

export default class ContainerChild extends Component {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createElement } from 'react';
import React from 'react';
import { storiesOf } from '@storybook/react';
import ContainerChild from '..';
import docs from '../__docs__/ContainerChild.md';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createElement } from 'react';
import React from 'react';
import ContainerChild from '..';
import { configure, shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
Expand Down
2 changes: 1 addition & 1 deletion packages/peregrine/src/List/__stories__/item.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createElement } from 'react';
import React from 'react';
import { storiesOf } from '@storybook/react';
import { withReadme } from 'storybook-readme';

Expand Down
2 changes: 1 addition & 1 deletion packages/peregrine/src/List/__stories__/items.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createElement } from 'react';
import React from 'react';
import { storiesOf } from '@storybook/react';
import { withReadme } from 'storybook-readme';

Expand Down
2 changes: 1 addition & 1 deletion packages/peregrine/src/List/__stories__/list.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createElement } from 'react';
import React from 'react';
import { storiesOf } from '@storybook/react';
import { withReadme } from 'storybook-readme';

Expand Down
2 changes: 1 addition & 1 deletion packages/peregrine/src/List/__tests__/item.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createElement } from 'react';
import React from 'react';
import { configure, shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';

Expand Down
2 changes: 1 addition & 1 deletion packages/peregrine/src/List/__tests__/items.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Fragment, createElement } from 'react';
import React, { Fragment } from 'react';
import { configure, shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';

Expand Down
2 changes: 1 addition & 1 deletion packages/peregrine/src/List/__tests__/list.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Fragment, createElement } from 'react';
import React, { Fragment } from 'react';
import { configure, shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';

Expand Down
2 changes: 1 addition & 1 deletion packages/peregrine/src/List/item.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, createElement } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';

import fromRenderProp from '../util/fromRenderProp';
Expand Down
2 changes: 1 addition & 1 deletion packages/peregrine/src/List/items.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Fragment, createElement } from 'react';
import React, { Component, Fragment } from 'react';
import PropTypes from 'prop-types';

import memoize from '../util/unaryMemoize';
Expand Down
2 changes: 1 addition & 1 deletion packages/peregrine/src/List/list.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, createElement } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';

import fromRenderProp from '../util/fromRenderProp';
Expand Down
2 changes: 1 addition & 1 deletion packages/peregrine/src/Peregrine/Peregrine.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createElement } from 'react';
import React from 'react';
import { Provider as ReduxProvider } from 'react-redux';
import createStore from '../store';
import MagentoRouter from '../Router';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createElement } from 'react';
import React from 'react';
import { configure, shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import { Provider as ReduxProvider } from 'react-redux';
Expand Down
2 changes: 1 addition & 1 deletion packages/peregrine/src/Price/Price.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createElement, PureComponent, Fragment } from 'react';
import React, { PureComponent, Fragment } from 'react';
import { number, string, shape } from 'prop-types';

export default class Price extends PureComponent {
Expand Down
2 changes: 1 addition & 1 deletion packages/peregrine/src/Price/__stories__/Price.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createElement } from 'react';
import React from 'react';
import { storiesOf } from '@storybook/react';
import { withReadme } from 'storybook-readme';
import Price from '../Price';
Expand Down
2 changes: 1 addition & 1 deletion packages/peregrine/src/Price/__tests__/Price.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createElement, Fragment } from 'react';
import React, { Fragment } from 'react';
import { configure, shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import Price from '../Price';
Expand Down
2 changes: 1 addition & 1 deletion packages/peregrine/src/Router/MagentoRouteHandler.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createElement, Component } from 'react';
import React, { Component } from 'react';
import { string, shape } from 'prop-types';
import resolveUnknownRoute from './resolveUnknownRoute';
import fetchRootComponent from './fetchRootComponent';
Expand Down
2 changes: 1 addition & 1 deletion packages/peregrine/src/Router/Router.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createElement, Component } from 'react';
import React, { Component } from 'react';
import { BrowserRouter, Route } from 'react-router-dom';
import { string, func, object } from 'prop-types';
import MagentoRouteHandler from './MagentoRouteHandler';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createElement } from 'react';
import React from 'react';
import MagentoRouteHandler from '../MagentoRouteHandler';
import { configure, shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
Expand Down
2 changes: 1 addition & 1 deletion packages/peregrine/src/Router/__tests__/Router.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import MagentoRouter from '../Router';
import { createElement } from 'react';
import React from 'react';
import { configure, mount, shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import { MemoryRouter } from 'react-router-dom';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createElement } from 'react';
import React from 'react';
import { configure, shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';

Expand Down
7 changes: 5 additions & 2 deletions packages/peregrine/src/util/fromRenderProp.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createElement } from 'react';
import React from 'react';

// memoization cache
const cache = new Map();
Expand Down Expand Up @@ -31,7 +31,10 @@ const fromRenderProp = (elementType, customProps = []) => {
// create an SFC that renders a node of type `elementType`
// and filter any props that shouldn't be written to the DOM
const Component = props =>
createElement(elementType, filterProps(props, uniqueCustomProps));
React.createElement(
elementType,
filterProps(props, uniqueCustomProps)
);

Component.displayName = `fromRenderProp(${elementType})`;
cache.set(key, Component);
Expand Down
7 changes: 1 addition & 6 deletions packages/venia-concept/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@
"transform-class-properties",
"transform-es2015-modules-commonjs",
"transform-object-rest-spread",
[
"transform-react-jsx",
{
"pragma": "createElement"
}
]
"transform-react-jsx"
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/venia-concept/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const plugins = [
'syntax-jsx',
'transform-class-properties',
'transform-object-rest-spread',
['transform-react-jsx', { pragma: 'createElement' }],
['transform-react-jsx'],
'graphql-tag'
];

Expand Down
2 changes: 1 addition & 1 deletion packages/venia-concept/src/RootComponents/CMS/CMS.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createElement, Component } from 'react';
import React, { Component } from 'react';
import Page from 'src/components/Page';
import CategoryList from 'src/components/CategoryList';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, createElement } from 'react';
import React, { Component } from 'react';
import { string, number, shape } from 'prop-types';
import { Query } from 'react-apollo';
import gql from 'graphql-tag';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, createElement } from 'react';
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Query } from 'react-apollo';
import gql from 'graphql-tag';
Expand Down
2 changes: 1 addition & 1 deletion packages/venia-concept/src/__mocks__/@magento/peregrine.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createElement } from 'react';
import React from 'react';

/**
* the Price component from @magento/peregrine
Expand Down
2 changes: 1 addition & 1 deletion packages/venia-concept/src/classify.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createElement } from 'react';
import React from 'react';

const merge = (...args) => Object.assign({}, ...args);

Expand Down
2 changes: 1 addition & 1 deletion packages/venia-concept/src/components/Button/button.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, createElement } from 'react';
import React, { Component } from 'react';
import { oneOf, shape, string } from 'prop-types';

import classify from 'src/classify';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, createElement } from 'react';
import React, { Component } from 'react';
import { string, number, shape } from 'prop-types';
import { Link } from 'react-router-dom';
import { Query } from 'react-apollo';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, createElement } from 'react';
import React, { Component } from 'react';
import { func, string } from 'prop-types';

import Button from 'src/components/Button';
Expand Down
2 changes: 1 addition & 1 deletion packages/venia-concept/src/components/Checkout/entrance.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, createElement } from 'react';
import React, { Component } from 'react';
import { func, shape, string } from 'prop-types';

import classify from 'src/classify';
Expand Down
2 changes: 1 addition & 1 deletion packages/venia-concept/src/components/Checkout/exit.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, createElement } from 'react';
import React, { Component } from 'react';
import { func, shape, string } from 'prop-types';

import classify from 'src/classify';
Expand Down
2 changes: 1 addition & 1 deletion packages/venia-concept/src/components/Checkout/flow.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, createElement } from 'react';
import React, { Component } from 'react';
import { bool, func, oneOf, shape, string } from 'prop-types';

import classify from 'src/classify';
Expand Down
2 changes: 1 addition & 1 deletion packages/venia-concept/src/components/Checkout/form.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, createElement } from 'react';
import React, { Component } from 'react';
import { bool, func, shape, string } from 'prop-types';

import classify from 'src/classify';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, createElement } from 'react';
import React, { Component } from 'react';
import { func } from 'prop-types';

import Button from 'src/components/Button';
Expand Down
2 changes: 1 addition & 1 deletion packages/venia-concept/src/components/Checkout/section.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, createElement } from 'react';
import React, { Component } from 'react';
import { node, shape, string } from 'prop-types';

import classify from 'src/classify';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, createElement } from 'react';
import React, { Component } from 'react';
import { bool, func, string } from 'prop-types';

import Button from 'src/components/Button';
Expand Down
2 changes: 1 addition & 1 deletion packages/venia-concept/src/components/Checkout/wrapper.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, createElement } from 'react';
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { bool, func, shape, string } from 'prop-types';

Expand Down
2 changes: 1 addition & 1 deletion packages/venia-concept/src/components/Footer/footer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, createElement } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';

import classify from 'src/classify';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createElement } from 'react';
import React from 'react';
import { configure, shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createElement } from 'react';
import React from 'react';
import { configure, mount, shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import { BrowserRouter } from 'react-router-dom';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createElement } from 'react';
import React from 'react';
import { configure, shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';

Expand Down
2 changes: 1 addition & 1 deletion packages/venia-concept/src/components/Gallery/gallery.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, createElement } from 'react';
import React, { Component } from 'react';
import { string, shape, arrayOf, number } from 'prop-types';

import classify from 'src/classify';
Expand Down
2 changes: 1 addition & 1 deletion packages/venia-concept/src/components/Gallery/item.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, createElement } from 'react';
import React, { Component } from 'react';
import { string, number, shape, func, bool } from 'prop-types';
import { Price } from '@magento/peregrine';
import { Link } from 'react-router-dom';
Expand Down
2 changes: 1 addition & 1 deletion packages/venia-concept/src/components/Gallery/items.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, createElement } from 'react';
import React, { Component } from 'react';
import { arrayOf, string, number, shape } from 'prop-types';
import fixedObserver from 'src/util/fixedObserver';
import initObserver from 'src/util/initObserver';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, createElement } from 'react';
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { compose } from 'redux';
import PropTypes from 'prop-types';
Expand Down
2 changes: 1 addition & 1 deletion packages/venia-concept/src/components/Header/header.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, createElement } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';

Expand Down
2 changes: 1 addition & 1 deletion packages/venia-concept/src/components/Header/navTrigger.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, createElement } from 'react';
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { compose } from 'redux';
import PropTypes from 'prop-types';
Expand Down
2 changes: 1 addition & 1 deletion packages/venia-concept/src/components/Home/home.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, createElement } from 'react';
import React, { Component } from 'react';

import './home.css';

Expand Down
2 changes: 1 addition & 1 deletion packages/venia-concept/src/components/Icon/icon.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, createElement } from 'react';
import React, { Component } from 'react';
import Feather from 'feather-icons';
import PropTypes from 'prop-types';

Expand Down
2 changes: 1 addition & 1 deletion packages/venia-concept/src/components/Main/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, createElement } from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';

import classify from 'src/classify';
Expand Down
2 changes: 1 addition & 1 deletion packages/venia-concept/src/components/MiniCart/miniCart.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, createElement } from 'react';
import React, { Component } from 'react';
import { compose } from 'redux';
import { connect } from 'react-redux';
import { shape, string } from 'prop-types';
Expand Down
2 changes: 1 addition & 1 deletion packages/venia-concept/src/components/MiniCart/product.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Fragment, createElement } from 'react';
import React, { Component, Fragment } from 'react';
import { number, shape, string } from 'prop-types';
import { Price } from '@magento/peregrine';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, createElement } from 'react';
import React, { Component } from 'react';
import { arrayOf, number, shape, string } from 'prop-types';
import { List } from '@magento/peregrine';

Expand Down
2 changes: 1 addition & 1 deletion packages/venia-concept/src/components/MiniCart/trigger.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, createElement } from 'react';
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { compose } from 'redux';
import PropTypes from 'prop-types';
Expand Down
Loading