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

Babel 7 #3746

Merged
merged 84 commits into from
Aug 23, 2018
Merged

Babel 7 #3746

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
c704d60
Initial move to babel 7
Hypnosphi Jun 9, 2018
69cc530
Merge remote-tracking branch 'origin/master' into babel-7
Hypnosphi Jun 10, 2018
cb988d0
Move lib/core to babel@7
Hypnosphi Jun 10, 2018
a4f9a2e
Move back to .babelrc
Hypnosphi Jun 10, 2018
084671c
Fix lint error
Hypnosphi Jun 10, 2018
113c182
Merge master
Hypnosphi Jun 16, 2018
73dc63b
Update dependencies
Hypnosphi Jun 20, 2018
b6153d1
Merge master
Hypnosphi Jul 4, 2018
0f93c5e
Add @babel/runtime dependency to all the packages with server-side part
Hypnosphi Jul 4, 2018
ee5c7c7
Update dependencies
Hypnosphi Jul 4, 2018
720bb23
Migration guide
Hypnosphi Jul 4, 2018
e496dfb
Update CLI
Hypnosphi Jul 4, 2018
87312a6
Fix vue build
Hypnosphi Jul 4, 2018
a050bcb
Update lockfile
Hypnosphi Jul 4, 2018
74475b9
Fix jest
Hypnosphi Jul 5, 2018
c4e468a
Fix jest
Hypnosphi Jul 5, 2018
ee6472d
Fix RN test
Hypnosphi Jul 5, 2018
170160d
Revert CLI changes for RN
Hypnosphi Jul 5, 2018
3c0e383
Add babel-loader peer dep
Hypnosphi Jul 6, 2018
6da0f7a
Commit snapshot
Hypnosphi Jul 6, 2018
4b169ab
Fix version choice logic
Hypnosphi Jul 6, 2018
ba544ef
Merge branch 'master' into babel-7
ndelangen Jul 16, 2018
d0b7972
FIX snapshots
ndelangen Jul 16, 2018
e0ad03d
Merge branch 'master' into babel-7
ndelangen Jul 20, 2018
a87d16d
FIX snapshots
ndelangen Jul 20, 2018
0ec2bc0
REMOVE smoke-tests in cli (static build examples are now all in teamc…
ndelangen Jul 20, 2018
6371e1f
Merge branch 'master' into babel-7
ndelangen Jul 20, 2018
a039c96
Merge branch 'master' into babel-7
ndelangen Aug 14, 2018
6e2d8c1
UPDATE "babel-plugin-react-docgen": "^2.0.0-babel7.0",
ndelangen Aug 14, 2018
a8e41c9
REVERT incorrect removal of package relating to angular
ndelangen Aug 14, 2018
fe86390
REMOVE unneeded tslint config
ndelangen Aug 14, 2018
e6c055c
FIX snapshots
ndelangen Aug 15, 2018
bf3c2e5
UPGRADE to babel7-rc.1
ndelangen Aug 15, 2018
b649f24
REMOVE stage presets and replace with plugins we need
ndelangen Aug 15, 2018
f7cd337
FIX eslint
ndelangen Aug 15, 2018
9a1abf2
FIX cli-tests
ndelangen Aug 15, 2018
3ae34e5
FIX cli test snapshots
ndelangen Aug 15, 2018
850b083
FIX angular example with a hack?
ndelangen Aug 15, 2018
1209703
REVERT changes to angular require-context (BROKEN)
ndelangen Aug 15, 2018
7ed57a8
FIX a warning in polymer storybook
ndelangen Aug 15, 2018
04f6ef8
Fix jest-ts-babel.js
igor-dv Aug 15, 2018
3c027a4
Try to fix CLI
igor-dv Aug 15, 2018
41d6168
CHANGE tot use babel7 everywhere (not just for our own build, but als…
ndelangen Aug 15, 2018
29e1c02
SORT package.json files
ndelangen Aug 15, 2018
107f5e0
FIX cli snapshots
ndelangen Aug 15, 2018
f627592
FIX incorrect dependency in app/html
ndelangen Aug 16, 2018
2b4f05b
FIX lockfile
ndelangen Aug 16, 2018
f36869a
TEMP FIX for hyperapp in netlify
ndelangen Aug 16, 2018
df723e0
REVERT deletion of smoke tests on cli output && REVERT babel6 cli fix…
ndelangen Aug 16, 2018
61d5c09
REVERT version-change for react in app/html
ndelangen Aug 16, 2018
224e1f9
UPDATE react & react-dom for app/svelte
ndelangen Aug 16, 2018
aadd8f0
CHANGE the installBabel to only install babel-loader & RENAME to inst…
ndelangen Aug 16, 2018
4fcf8cb
FIX snapshots
ndelangen Aug 16, 2018
3dec3ba
FIX lockfile
ndelangen Aug 16, 2018
5b9226b
CHANGE docs for migrating to babel 7
ndelangen Aug 16, 2018
c6dd3e4
REMOVE unneeded dependency
ndelangen Aug 16, 2018
773821d
CHANGE cli tests to e2e
ndelangen Aug 16, 2018
bfccae4
FIX package.json
ndelangen Aug 16, 2018
bbf7d8a
no message
ndelangen Aug 16, 2018
30fe991
FIX package.json in root version
ndelangen Aug 17, 2018
7b5dc84
FIX verdaccio.yaml
ndelangen Aug 17, 2018
40274f9
FIX cli/run_tests to install for each run individually
ndelangen Aug 17, 2018
165e996
FIX so tests are run in correct folder
ndelangen Aug 17, 2018
cb69d42
FIX so legacy packages *are* proxied
ndelangen Aug 17, 2018
305fff1
FIX webpack-react cli example
ndelangen Aug 17, 2018
f8332e7
CHANGE meteor generator babel file
ndelangen Aug 17, 2018
c0cd951
REMOVE the babel-root-slash-import module completely. It's not used b…
ndelangen Aug 17, 2018
7102951
Merge branch 'master' into babel-7
ndelangen Aug 21, 2018
451b8af
CHANGE teamcity config to test cli e2e via new script
ndelangen Aug 21, 2018
a05565b
UPGRADE to rc.2
ndelangen Aug 22, 2018
72e4b84
REVERT ci tests for ci via yarn test --cli
ndelangen Aug 22, 2018
ad78be3
CHANGE to silent installs during e2e
ndelangen Aug 22, 2018
70d9094
CHANGE to fixed version, otherwise they keep changing when testing
ndelangen Aug 22, 2018
2028cd4
Removed the added @babel/core everywhere
pksunkara Aug 22, 2018
94a049c
Revert "CHANGE the installBabel to only install babel-loader & RENAME…
pksunkara Aug 22, 2018
f1cf6d2
Remove unnecessary babel bridge installation in installBabel
pksunkara Aug 22, 2018
9c4cff4
Use installBabel for meteor cli
pksunkara Aug 22, 2018
9648d20
FIX scripts/test.js
ndelangen Aug 22, 2018
bb3e725
Pass registry url to lerna
pksunkara Aug 22, 2018
961fdef
Fixed cli test issues
pksunkara Aug 22, 2018
36a2676
Cleanup not needed anymore
Hypnosphi Aug 22, 2018
489d55d
Added babel-loader to app/svelte
pksunkara Aug 23, 2018
06d799c
Use 'babel-loader' without "require.resolve"
igor-dv Aug 23, 2018
c5f5433
Try to bring the CLI back
igor-dv Aug 23, 2018
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
41 changes: 29 additions & 12 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,16 +1,33 @@
{
"presets": ["env", "stage-0", "react"],
"env": {
"test": {
"plugins": ["require-context-hook"]
},
"plugins": [
"emotion",
"babel-plugin-macros",
["transform-runtime", {
"polyfill": false,
"presets": [
"@babel/preset-env",
"@babel/preset-react",
"@babel/preset-flow"
],
"plugins": [
"babel-plugin-emotion",
"babel-plugin-macros",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-export-default-from",
[
"@babel/plugin-transform-runtime",
{
"regenerator": true
}]
}
]
}
],
"env": {
"test": {
"plugins": ["babel-plugin-require-context-hook"]
}
},
"overrides": [
{
"test": "./examples/vue-kitchen-sink",
"presets": [
"@babel/preset-env",
"babel-preset-vue"
]
}
]
}
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ jobs:
name: "Test CLI"
command: |
yarn test --cli
no_output_timeout: 1800
cli-latest-cra:
working_directory: /tmp/storybook
docker:
Expand Down
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ lib/cli/test
*.js.map

!.remarkrc.js
!.babelrc.js
!.eslintrc.js
!.eslintrc-markdown.js
!.jest.config.js
Expand Down
19 changes: 19 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,25 @@ module.exports = {
extensions: ['.js', '.jsx'],
},
],
'react/jsx-no-bind': [
error,
{
ignoreDOMComponents: true,
ignoreRefs: true,
allowArrowFunctions: true,
allowFunctions: true,
allowBind: true,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there anything left that it still disallows?

BTW this rule is about performance so we probably shouldn't shut it up like this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we restrict this after merger and fix issues that come up then?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good

},
],
'jsx-a11y/label-has-associated-control': [
warn,
{
labelComponents: ['CustomInputLabel'],
labelAttributes: ['label'],
controlComponents: ['CustomInput'],
depth: 3,
},
],
'react/no-unescaped-entities': ignore,
'jsx-a11y/label-has-for': [
error,
Expand Down
16 changes: 16 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
- [Removed addWithInfo](#removed-add-with-info)
- [Removed RN addons](#removed-rn-addons)
- [Storyshots changes](#storyshots-changes)
- [Webpack 4](#webpack-4)
- [Babel 7](#babel-7)
- [From version 3.3.x to 3.4.x](#from-version-33x-to-34x)
- [From version 3.2.x to 3.3.x](#from-version-32x-to-33x)
- [Refactored Knobs](#refactored-knobs)
Expand Down Expand Up @@ -72,6 +74,20 @@ The `@storybook/react-native` had built-in addons (`addon-actions` and `addon-li
A possible plugin might be [babel-plugin-require-context-hook](https://github.com/smrq/babel-plugin-require-context-hook).
[README](https://github.com/storybooks/storybook/tree/master/addons/storyshots/storyshots-core#configure-jest-to-work-with-webpacks-requirecontext)

### Webpack 4

Storybook now uses webpack 4. If you have a [custom webpack config](https://storybook.js.org/configurations/custom-webpack-config/), make sure that all the loaders and plugins you use support webpack 4.

### Babel 7

Storybook now uses Babel 7. There's a couple of cases when it can break with your app:

* If you aren't using Babel yourself, and don't have .babelrc, install following dependencies:
```
npm i -D @babel/core babel-loader@next
```
* If you're using Babel 6, make sure that you have direct dependencies on `babel-core@6` and `babel-loader@7`.

## From version 3.3.x to 3.4.x

There are no expected breaking changes in the 3.4.x release, but 3.4 contains a major refactor to make it easier to support new frameworks, and we will document any breaking changes here if they arise.
Expand Down
1 change: 0 additions & 1 deletion addons/a11y/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"@storybook/components": "4.0.0-alpha.16",
"@storybook/core-events": "4.0.0-alpha.16",
"axe-core": "^3.0.3",
"babel-runtime": "^6.26.0",
"global": "^4.3.2",
"prop-types": "^15.6.2",
"react-emotion": "^9.2.6"
Expand Down
1 change: 0 additions & 1 deletion addons/actions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"@storybook/addons": "4.0.0-alpha.16",
"@storybook/components": "4.0.0-alpha.16",
"@storybook/core-events": "4.0.0-alpha.16",
"babel-runtime": "^6.26.0",
"deep-equal": "^1.0.1",
"emotion-theming": "^9.2.6",
"global": "^4.3.2",
Expand Down
1 change: 0 additions & 1 deletion addons/backgrounds/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"dependencies": {
"@storybook/addons": "4.0.0-alpha.16",
"@storybook/core-events": "4.0.0-alpha.16",
"babel-runtime": "^6.26.0",
"global": "^4.3.2",
"prop-types": "^15.6.2",
"react-emotion": "^9.2.6",
Expand Down
1 change: 0 additions & 1 deletion addons/events/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"dependencies": {
"@storybook/addons": "4.0.0-alpha.16",
"@storybook/core-events": "4.0.0-alpha.16",
"babel-runtime": "^6.26.0",
"format-json": "^1.0.3",
"prop-types": "^15.6.2",
"react-emotion": "^9.2.6",
Expand Down
1 change: 0 additions & 1 deletion addons/graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"babel-runtime": "^6.26.0",
"global": "^4.3.2",
"graphiql": "^0.11.11",
"graphql": "^0.13.2",
Expand Down
1 change: 0 additions & 1 deletion addons/info/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"@storybook/addons": "4.0.0-alpha.16",
"@storybook/client-logger": "4.0.0-alpha.16",
"@storybook/components": "4.0.0-alpha.16",
"babel-runtime": "^6.26.0",
"core-js": "2.5.7",
"global": "^4.3.2",
"marksy": "^6.0.3",
Expand Down
36 changes: 18 additions & 18 deletions addons/info/src/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`addon Info should render <Info /> and external markdown 1`] = `
.emotion-2 {
.emotion-4 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
Expand All @@ -22,7 +22,7 @@ exports[`addon Info should render <Info /> and external markdown 1`] = `
overflow-x: scroll;
}

.emotion-1 {
.emotion-2 {
overflow: hidden;
border: 1px solid #eee;
border-radius: 3px;
Expand All @@ -38,12 +38,12 @@ exports[`addon Info should render <Info /> and external markdown 1`] = `
flex-shrink: 0;
}

.emotion-1:hover {
.emotion-2:hover {
background-color: #f4f7fa;
border-color: #ddd;
}

.emotion-1:active {
.emotion-2:active {
background-color: #e9ecef;
border-color: #ccc;
}
Expand Down Expand Up @@ -124,8 +124,8 @@ exports[`addon Info should render <Info /> and external markdown 1`] = `
<div>
<h1>
function func(x) {
return x + 1;
}
return x + 1;
}
</h1>
<h2>
[object Object]
Expand Down Expand Up @@ -307,7 +307,7 @@ exports[`addon Info should render <Info /> and external markdown 1`] = `
>
<Styled(pre)>
<pre
className="emotion-2"
className="emotion-4 emotion-5"
>
<div>
<Node
Expand Down Expand Up @@ -1220,14 +1220,14 @@ exports[`addon Info should render <Info /> and external markdown 1`] = `
styles={Object {}}
>
<button
className="emotion-1"
className="emotion-2 emotion-3"
onClick={[Function]}
>
<Styled(div)
toggled={false}
>
<div
className="emotion-0"
className="emotion-0 emotion-1"
>
<div
style={
Expand Down Expand Up @@ -1259,7 +1259,7 @@ exports[`addon Info should render <Info /> and external markdown 1`] = `
`;

exports[`addon Info should render <Info /> and markdown 1`] = `
.emotion-2 {
.emotion-4 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
Expand All @@ -1280,7 +1280,7 @@ exports[`addon Info should render <Info /> and markdown 1`] = `
overflow-x: scroll;
}

.emotion-1 {
.emotion-2 {
overflow: hidden;
border: 1px solid #eee;
border-radius: 3px;
Expand All @@ -1296,12 +1296,12 @@ exports[`addon Info should render <Info /> and markdown 1`] = `
flex-shrink: 0;
}

.emotion-1:hover {
.emotion-2:hover {
background-color: #f4f7fa;
border-color: #ddd;
}

.emotion-1:active {
.emotion-2:active {
background-color: #e9ecef;
border-color: #ccc;
}
Expand Down Expand Up @@ -1384,8 +1384,8 @@ containing **bold**, *cursive* text, \`code\` and [a link](https://github.com)"
<div>
<h1>
function func(x) {
return x + 1;
}
return x + 1;
}
</h1>
<h2>
[object Object]
Expand Down Expand Up @@ -1658,7 +1658,7 @@ containing **bold**, *cursive* text, \`code\` and [a link](https://github.com)"
>
<Styled(pre)>
<pre
className="emotion-2"
className="emotion-4 emotion-5"
>
<div>
<Node
Expand Down Expand Up @@ -2571,14 +2571,14 @@ containing **bold**, *cursive* text, \`code\` and [a link](https://github.com)"
styles={Object {}}
>
<button
className="emotion-1"
className="emotion-2 emotion-3"
onClick={[Function]}
>
<Styled(div)
toggled={false}
>
<div
className="emotion-0"
className="emotion-0 emotion-1"
>
<div
style={
Expand Down
10 changes: 3 additions & 7 deletions addons/info/src/components/makeTableComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,10 @@ const propsFromPropTypes = type => {
return;
}

// eslint-disable-next-line react/destructuring-assignment
if (!props[property]) {
props[property] = { property };
}

// eslint-disable-next-line react/destructuring-assignment
props[property].defaultValue = value;
});
}
Expand All @@ -86,12 +84,10 @@ export default function makeTableComponent(Component) {
return null;
}

/* eslint-disable react/destructuring-assignment */
const propDefinitionsMap = hasDocgen(props.type)
? propsFromDocgen(props.type)
: propsFromPropTypes(props.type);
const { type } = props;

const propDefinitionsMap = hasDocgen(type) ? propsFromDocgen(type) : propsFromPropTypes(type);
const propDefinitions = Object.values(propDefinitionsMap);
/* eslint-enable react/destructuring-assignment */

return <Component propDefinitions={propDefinitions} {...props} />;
};
Expand Down
1 change: 0 additions & 1 deletion addons/info/src/components/types/ArrayOf.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';

// eslint-disable-next-line import/no-cycle
import PrettyPropType from './PrettyPropType';
import { TypeInfo, getPropTypes } from './proptypes';

Expand Down
1 change: 0 additions & 1 deletion addons/info/src/components/types/ObjectOf.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';

// eslint-disable-next-line import/no-cycle
import PrettyPropType from './PrettyPropType';
import { TypeInfo, getPropTypes } from './proptypes';

Expand Down
1 change: 0 additions & 1 deletion addons/info/src/components/types/OneOfType.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';

// eslint-disable-next-line import/no-cycle
import PrettyPropType from './PrettyPropType';
import { TypeInfo, getPropTypes } from './proptypes';

Expand Down
3 changes: 0 additions & 3 deletions addons/info/src/components/types/PrettyPropType.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import PropTypes from 'prop-types';
import React from 'react';

// TODO: FIX this dependency cycle
/* eslint-disable import/no-cycle */
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ESLint packages update seems quite irrelevant to this PR, and it makes it harder to review =(

import Shape from './Shape';
import OneOfType from './OneOfType';
import ArrayOf from './ArrayOf';
Expand All @@ -11,7 +9,6 @@ import OneOf from './OneOf';
import InstanceOf from './InstanceOf';
import Signature from './Signature';
import Literal from './Literal';
/* eslint-enable import/no-cycle */

import { TypeInfo } from './proptypes';

Expand Down
1 change: 0 additions & 1 deletion addons/info/src/components/types/Shape.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import PropTypes from 'prop-types';
import React from 'react';

import { HighlightButton } from '@storybook/components';
// eslint-disable-next-line import/no-cycle
import PrettyPropType from './PrettyPropType';
import PropertyLabel from './PropertyLabel';

Expand Down
1 change: 0 additions & 1 deletion addons/jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"dependencies": {
"@storybook/addons": "4.0.0-alpha.16",
"@storybook/components": "4.0.0-alpha.16",
"babel-runtime": "^6.26.0",
"global": "^4.3.2",
"prop-types": "^15.6.2",
"react-emotion": "^9.2.6",
Expand Down
1 change: 0 additions & 1 deletion addons/knobs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"@storybook/addons": "4.0.0-alpha.16",
"@storybook/components": "4.0.0-alpha.16",
"@storybook/core-events": "4.0.0-alpha.16",
"babel-runtime": "^6.26.0",
"copy-to-clipboard": "^3.0.8",
"escape-html": "^1.0.3",
"fast-deep-equal": "^2.0.1",
Expand Down
Loading