@storybook/codemod 7.0.0-beta.2 → 7.0.0-beta.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. package/dist/chunk-3OPQTROG.mjs +1 -0
  2. package/dist/chunk-B5FMQ3BX.mjs +1 -0
  3. package/dist/chunk-HBPKIMKE.mjs +1 -0
  4. package/dist/index.d.ts +13 -261
  5. package/dist/index.js +1 -1
  6. package/dist/index.mjs +1 -1
  7. package/dist/transforms/add-component-parameters.d.ts +22 -0
  8. package/dist/transforms/add-component-parameters.js +1 -0
  9. package/dist/transforms/add-component-parameters.mjs +1 -0
  10. package/dist/transforms/csf-2-to-3.d.ts +6 -0
  11. package/dist/transforms/csf-2-to-3.js +1 -0
  12. package/dist/transforms/csf-2-to-3.mjs +1 -0
  13. package/dist/transforms/csf-hoist-story-annotations.d.ts +26 -0
  14. package/dist/transforms/csf-hoist-story-annotations.js +1 -0
  15. package/dist/transforms/csf-hoist-story-annotations.mjs +1 -0
  16. package/dist/transforms/csf-to-mdx.d.ts +29 -0
  17. package/dist/transforms/csf-to-mdx.js +3 -0
  18. package/dist/transforms/csf-to-mdx.mjs +3 -0
  19. package/dist/transforms/move-builtin-addons.d.ts +3 -0
  20. package/dist/transforms/move-builtin-addons.js +1 -0
  21. package/dist/transforms/move-builtin-addons.mjs +1 -0
  22. package/dist/transforms/storiesof-to-csf.d.ts +24 -0
  23. package/dist/transforms/storiesof-to-csf.js +1 -0
  24. package/dist/transforms/storiesof-to-csf.mjs +1 -0
  25. package/dist/transforms/update-addon-info.d.ts +27 -0
  26. package/dist/transforms/update-addon-info.js +1 -0
  27. package/dist/transforms/update-addon-info.mjs +1 -0
  28. package/dist/transforms/update-organisation-name.d.ts +25 -0
  29. package/dist/transforms/update-organisation-name.js +1 -0
  30. package/dist/transforms/update-organisation-name.mjs +1 -0
  31. package/dist/transforms/upgrade-hierarchy-separators.d.ts +3 -0
  32. package/dist/transforms/upgrade-hierarchy-separators.js +1 -0
  33. package/dist/transforms/upgrade-hierarchy-separators.mjs +1 -0
  34. package/package.json +28 -7
  35. package/src/index.js +11 -1
  36. package/src/lib/utils.ts +2 -2
  37. package/src/transforms/__testfixtures__/csf-to-mdx/decorators.input.js +1 -1
  38. package/src/transforms/__testfixtures__/csf-to-mdx/story-function.input.js +1 -1
  39. package/src/transforms/__testfixtures__/csf-to-mdx/story-function.output.snapshot +1 -1
  40. package/src/transforms/__testfixtures__/mdx-to-csf/{basic.input.js → basic.input.mdx} +0 -0
  41. package/src/transforms/__testfixtures__/mdx-to-csf/{component-id.input.js → component-id.input.mdx} +0 -0
  42. package/src/transforms/__testfixtures__/mdx-to-csf/{decorators.input.js → decorators.input.mdx} +0 -0
  43. package/src/transforms/__testfixtures__/mdx-to-csf/{exclude-stories.input.js → exclude-stories.input.mdx} +0 -0
  44. package/src/transforms/__testfixtures__/mdx-to-csf/{parameters.input.js → parameters.input.mdx} +0 -0
  45. package/src/transforms/__testfixtures__/mdx-to-csf/{plaintext.input.js → plaintext.input.mdx} +0 -0
  46. package/src/transforms/__testfixtures__/mdx-to-csf/{story-function.input.js → story-function.input.mdx} +0 -0
  47. package/src/transforms/__testfixtures__/mdx-to-csf/{story-parameters.input.js → story-parameters.input.mdx} +0 -0
  48. package/src/transforms/__testfixtures__/mdx-to-csf/{story-refs.input.js → story-refs.input.mdx} +0 -0
  49. package/src/transforms/__testfixtures__/storiesof-to-csf/decorators.input.js +1 -1
  50. package/src/transforms/__testfixtures__/storiesof-to-csf/export-function.input.js +1 -1
  51. package/src/transforms/__testfixtures__/storiesof-to-csf/story-decorators.input.js +1 -1
  52. package/src/transforms/__testfixtures__/update-addon-info/update-addon-info.input.js +34 -48
  53. package/src/transforms/__testfixtures__/update-addon-info/update-addon-info.output.snapshot +33 -47
  54. package/src/transforms/__tests__/csf-2-to-3.test.ts +5 -3
  55. package/src/transforms/csf-2-to-3.ts +23 -16
  56. package/tsconfig.json +4 -2
@@ -0,0 +1 @@
1
+ import{transformer}from"../chunk-B5FMQ3BX.mjs";export{transformer as default};
@@ -0,0 +1,25 @@
1
+ declare function transformer(file: any, api: any): any;
2
+ declare const packageNames: {
3
+ '@kadira/react-storybook-decorator-centered': string;
4
+ '@kadira/storybook-addons': string;
5
+ '@kadira/storybook-addon-actions': string;
6
+ '@kadira/storybook-addon-comments': string;
7
+ '@kadira/storybook-addon-graphql': string;
8
+ '@kadira/storybook-addon-info': string;
9
+ '@kadira/storybook-addon-knobs': string;
10
+ '@kadira/storybook-addon-links': string;
11
+ '@kadira/storybook-addon-notes': string;
12
+ '@kadira/storybook-addon-options': string;
13
+ '@kadira/storybook-channels': string;
14
+ '@kadira/storybook-channel-postmsg': string;
15
+ '@kadira/storybook-channel-websocket': string;
16
+ '@kadira/storybook-ui': string;
17
+ '@kadira/react-native-storybook': string;
18
+ '@kadira/react-storybook': string;
19
+ '@kadira/getstorybook': string;
20
+ '@kadira/storybook': string;
21
+ storyshots: string;
22
+ getstorybook: string;
23
+ };
24
+
25
+ export { transformer as default, packageNames };
@@ -0,0 +1 @@
1
+ var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var update_organisation_name_exports={};__export(update_organisation_name_exports,{default:()=>transformer,packageNames:()=>packageNames});module.exports=__toCommonJS(update_organisation_name_exports);var packageNames={"@kadira/react-storybook-decorator-centered":"@storybook/addon-centered","@kadira/storybook-addons":"@storybook/preview-api","@kadira/storybook-addon-actions":"@storybook/addon-actions","@kadira/storybook-addon-comments":"@storybook/addon-comments","@kadira/storybook-addon-graphql":"@storybook/addon-graphql","@kadira/storybook-addon-info":"@storybook/addon-info","@kadira/storybook-addon-knobs":"@storybook/addon-knobs","@kadira/storybook-addon-links":"@storybook/addon-links","@kadira/storybook-addon-notes":"@storybook/addon-notes","@kadira/storybook-addon-options":"@storybook/addon-options","@kadira/storybook-channels":"@storybook/channels","@kadira/storybook-channel-postmsg":"@storybook/channel-postmessage","@kadira/storybook-channel-websocket":"@storybook/channel-websocket","@kadira/storybook-ui":"@storybook/manager","@kadira/react-native-storybook":"@storybook/react-native","@kadira/react-storybook":"@storybook/react","@kadira/getstorybook":"@storybook/cli","@kadira/storybook":"@storybook/react",storyshots:"@storybook/addon-storyshots",getstorybook:"@storybook/cli"};function transformer(file,api){let j=api.jscodeshift,packageNamesKeys=Object.keys(packageNames),getMatch=oldpart=>packageNamesKeys.find(newpart=>oldpart.match(newpart)),getNewPackageName=oldPackageName=>{let match=getMatch(oldPackageName);if(match){let replacement=packageNames[match];return oldPackageName.replace(match,replacement)}return oldPackageName},updatePackageName=declaration=>(declaration.node.source.value=getNewPackageName(declaration.node.source.value),declaration.node);return j(file.source).find(j.ImportDeclaration).replaceWith(updatePackageName).toSource({quote:"single"})}0&&(module.exports={packageNames});
@@ -0,0 +1 @@
1
+ import{packageNames,transformer}from"../chunk-3OPQTROG.mjs";export{transformer as default,packageNames};
@@ -0,0 +1,3 @@
1
+ declare function transformer(file: any, api: any, options: any): any;
2
+
3
+ export { transformer as default };
@@ -0,0 +1 @@
1
+ var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var upgrade_hierarchy_separators_exports={};__export(upgrade_hierarchy_separators_exports,{default:()=>transformer});module.exports=__toCommonJS(upgrade_hierarchy_separators_exports);function upgradeSeparator(path){return path.replace(/[|.]/g,"/")}function transformer(file,api,options){let j=api.jscodeshift,root=j(file.source);return root.find(j.CallExpression).filter(call=>call.node.callee.name==="storiesOf").filter(call=>call.node.arguments.length>0&&["Literal","StringLiteral"].includes(call.node.arguments[0].type)).forEach(call=>{let arg0=call.node.arguments[0];arg0.value=upgradeSeparator(arg0.value)}),root.find(j.ExportDefaultDeclaration).filter(def=>def.node.declaration.properties.map(p=>p.key.name).includes("title")).forEach(def=>{def.node.declaration&&def.node.declaration.properties&&def.node.declaration.properties.forEach(p=>{p.key.name==="title"&&(p.value.value=upgradeSeparator(p.value.value))})}),root.toSource({quote:"single"})}0&&(module.exports={});
@@ -0,0 +1 @@
1
+ function upgradeSeparator(path){return path.replace(/[|.]/g,"/")}function transformer(file,api,options){let j=api.jscodeshift,root=j(file.source);return root.find(j.CallExpression).filter(call=>call.node.callee.name==="storiesOf").filter(call=>call.node.arguments.length>0&&["Literal","StringLiteral"].includes(call.node.arguments[0].type)).forEach(call=>{let arg0=call.node.arguments[0];arg0.value=upgradeSeparator(arg0.value)}),root.find(j.ExportDefaultDeclaration).filter(def=>def.node.declaration.properties.map(p=>p.key.name).includes("title")).forEach(def=>{def.node.declaration&&def.node.declaration.properties&&def.node.declaration.properties.forEach(p=>{p.key.name==="title"&&(p.value.value=upgradeSeparator(p.value.value))})}),root.toSource({quote:"single"})}export{transformer as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/codemod",
3
- "version": "7.0.0-beta.2",
3
+ "version": "7.0.0-beta.21",
4
4
  "description": "A collection of codemod scripts written with JSCodeshift",
5
5
  "keywords": [
6
6
  "storybook"
@@ -22,26 +22,37 @@
22
22
  "sideEffects": false,
23
23
  "exports": {
24
24
  ".": {
25
+ "node": "./dist/index.js",
25
26
  "require": "./dist/index.js",
26
27
  "import": "./dist/index.mjs",
27
28
  "types": "./dist/index.d.ts"
28
29
  },
30
+ "./dist/transforms/add-component-parameters.js": "./dist/transforms/add-component-parameters.js",
31
+ "./dist/transforms/csf-2-to-3.js": "./dist/transforms/csf-2-to-3.js",
32
+ "./dist/transforms/csf-hoist-story-annotations.js": "./dist/transforms/csf-hoist-story-annotations.js",
33
+ "./dist/transforms/csf-to-mdx.js": "./dist/transforms/csf-to-mdx.js",
34
+ "./dist/transforms/move-builtin-addons.js": "./dist/transforms/move-builtin-addons.js",
35
+ "./dist/transforms/storiesof-to-csf.js": "./dist/transforms/storiesof-to-csf.js",
36
+ "./dist/transforms/update-addon-info.js": "./dist/transforms/update-addon-info.js",
37
+ "./dist/transforms/update-organisation-name.js": "./dist/transforms/update-organisation-name.js",
38
+ "./dist/transforms/upgrade-hierarchy-separators.js": "./dist/transforms/upgrade-hierarchy-separators.js",
29
39
  "./package.json": "./package.json"
30
40
  },
31
41
  "main": "dist/index.js",
32
42
  "module": "dist/index.mjs",
33
- "jsnext:main": "src/index.js",
34
43
  "types": "dist/index.d.ts",
35
44
  "scripts": {
36
45
  "check": "../../../scripts/node_modules/.bin/tsc --noEmit",
37
46
  "prep": "../../../scripts/prepare/bundle.ts"
38
47
  },
39
48
  "dependencies": {
49
+ "@babel/core": "^7.20.2",
50
+ "@babel/preset-env": "^7.20.2",
40
51
  "@babel/types": "^7.20.2",
41
52
  "@storybook/csf": "next",
42
- "@storybook/csf-tools": "7.0.0-beta.2",
43
- "@storybook/node-logger": "7.0.0-beta.2",
44
- "@storybook/types": "7.0.0-beta.2",
53
+ "@storybook/csf-tools": "7.0.0-beta.21",
54
+ "@storybook/node-logger": "7.0.0-beta.21",
55
+ "@storybook/types": "7.0.0-beta.21",
45
56
  "cross-spawn": "^7.0.3",
46
57
  "globby": "^11.0.2",
47
58
  "jscodeshift": "^0.13.1",
@@ -51,6 +62,7 @@
51
62
  "util": "^0.12.4"
52
63
  },
53
64
  "devDependencies": {
65
+ "@types/jscodeshift": "^0.11.6",
54
66
  "jest": "^29.3.1",
55
67
  "jest-specific-snapshot": "^7.0.0",
56
68
  "typescript": "~4.9.3"
@@ -61,8 +73,17 @@
61
73
  "bundler": {
62
74
  "platform": "node",
63
75
  "entries": [
64
- "./src/index.js"
76
+ "./src/index.js",
77
+ "./src/transforms/add-component-parameters.js",
78
+ "./src/transforms/csf-2-to-3.ts",
79
+ "./src/transforms/csf-hoist-story-annotations.js",
80
+ "./src/transforms/csf-to-mdx.js",
81
+ "./src/transforms/move-builtin-addons.js",
82
+ "./src/transforms/storiesof-to-csf.js",
83
+ "./src/transforms/update-addon-info.js",
84
+ "./src/transforms/update-organisation-name.js",
85
+ "./src/transforms/upgrade-hierarchy-separators.js"
65
86
  ]
66
87
  },
67
- "gitHead": "66a0d588184add900c48d49f3a62743fa9cc5185"
88
+ "gitHead": "fb45d854842e10fa119a65c628333e3a5d495e77"
68
89
  }
package/src/index.js CHANGED
@@ -59,7 +59,17 @@ export async function runCodemod(codemod, { glob, logger, dryRun, rename, parser
59
59
  const parserArgs = inferredParser ? ['--parser', inferredParser] : [];
60
60
  spawnSync(
61
61
  'npx',
62
- ['jscodeshift', '-t', `${TRANSFORM_DIR}/${codemod}.js`, ...parserArgs, ...files],
62
+ [
63
+ 'jscodeshift',
64
+ // this makes sure codeshift doesn't transform our own source code with babel
65
+ // which is faster, and also makes sure the user won't see babel messages such as:
66
+ // [BABEL] Note: The code generator has deoptimised the styling of repo/node_modules/prettier/index.js as it exceeds the max of 500KB.
67
+ '--no-babel',
68
+ '-t',
69
+ `${TRANSFORM_DIR}/${codemod}.js`,
70
+ ...parserArgs,
71
+ ...files,
72
+ ],
63
73
  {
64
74
  stdio: 'inherit',
65
75
  shell: true,
package/src/lib/utils.ts CHANGED
@@ -1,5 +1,5 @@
1
- import camelCase from 'lodash/camelCase';
2
- import upperFirst from 'lodash/upperFirst';
1
+ import camelCase from 'lodash/camelCase.js';
2
+ import upperFirst from 'lodash/upperFirst.js';
3
3
 
4
4
  export const sanitizeName = (name: string) => {
5
5
  let key = upperFirst(camelCase(name));
@@ -3,7 +3,7 @@ import Button from './Button';
3
3
 
4
4
  export default {
5
5
  title: 'Some.Button',
6
- decorators: [withKnobs, storyFn => <div className="foo">{storyFn}</div>],
6
+ decorators: [withKnobs, (storyFn) => <div className="foo">{storyFn}</div>],
7
7
  };
8
8
 
9
9
  export const story1 = () => <Button label="The Button" />;
@@ -1,4 +1,4 @@
1
- import global from 'global';
1
+ import { global } from '@storybook/global';
2
2
 
3
3
  const { document } = global;
4
4
 
@@ -1,7 +1,7 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`csf-to-mdx transforms correctly using "story-function.input.js" data 1`] = `
4
- "import global from 'global';
4
+ "import { global } from '@storybook/global';
5
5
  import { Meta, Story } from '@storybook/addon-docs';
6
6
 
7
7
  const {
@@ -5,5 +5,5 @@ import Button from './Button';
5
5
  // This isn't a valid story, but it tests the `import { comp } from ...` case
6
6
  storiesOf('Some.Button', module)
7
7
  .addDecorator(withKnobs)
8
- .addDecorator(storyFn => <div className="foo">{storyFn}</div>)
8
+ .addDecorator((storyFn) => <div className="foo">{storyFn}</div>)
9
9
  .add('with decorator', () => <Button label="The Button" />);
@@ -8,5 +8,5 @@ export function someHelper() {
8
8
  }
9
9
 
10
10
  storiesOf('ComponentItem', module)
11
- .addDecorator(storyFn => <div style={{ margin: '1rem' }}>{storyFn()}</div>)
11
+ .addDecorator((storyFn) => <div style={{ margin: '1rem' }}>{storyFn()}</div>)
12
12
  .add('loading', () => <ComponentItem loading />);
@@ -4,7 +4,7 @@ import Button from './Button';
4
4
  storiesOf('Some.Button', module)
5
5
  .add('with story params and decorators', () => <Button label="The Button" />, {
6
6
  bar: 1,
7
- decorators: [withKnobs, storyFn => <div className="foo">{storyFn}</div>],
7
+ decorators: [withKnobs, (storyFn) => <div className="foo">{storyFn}</div>],
8
8
  })
9
9
  .add('with story decorators', () => <Button label="The Button" />, {
10
10
  decorators: [withKnobs],
@@ -1,25 +1,21 @@
1
1
  /* eslint-disable */
2
- import React from 'react'
3
- import Button from './Button'
2
+ import React from 'react';
3
+ import Button from './Button';
4
4
 
5
- import { storiesOf } from '@storybook/react'
6
- import { action } from '@storybook/addon-actions'
5
+ import { storiesOf } from '@storybook/react';
6
+ import { action } from '@storybook/addon-actions';
7
7
 
8
- storiesOf(
9
- 'Button'
10
- ).addWithInfo(
8
+ storiesOf('Button').addWithInfo(
11
9
  'simple usage',
12
10
  'This is the basic usage with the button with providing a label to show the text.',
13
11
  () => (
14
12
  <div>
15
13
  <Button label="The Button" onClick={action('onClick')} />
16
14
  <br />
17
- <p>
18
- Click the "?" mark at top-right to view the info.
19
- </p>
15
+ <p>Click the "?" mark at top-right to view the info.</p>
20
16
  </div>
21
17
  )
22
- )
18
+ );
23
19
 
24
20
  storiesOf('Button').addWithInfo(
25
21
  'simple usage (inline info)',
@@ -28,7 +24,7 @@ storiesOf('Button').addWithInfo(
28
24
  `,
29
25
  () => <Button label="The Button" onClick={action('onClick')} />,
30
26
  { inline: true }
31
- )
27
+ );
32
28
 
33
29
  storiesOf('Button').addWithInfo(
34
30
  'simple usage (disable source)',
@@ -37,7 +33,7 @@ storiesOf('Button').addWithInfo(
37
33
  `,
38
34
  () => <Button label="The Button" onClick={action('onClick')} />,
39
35
  { source: false, inline: true }
40
- )
36
+ );
41
37
 
42
38
  storiesOf('Button').addWithInfo(
43
39
  'simple usage (no header)',
@@ -46,7 +42,7 @@ storiesOf('Button').addWithInfo(
46
42
  `,
47
43
  () => <Button label="The Button" onClick={action('onClick')} />,
48
44
  { header: false, inline: true }
49
- )
45
+ );
50
46
 
51
47
  storiesOf('Button').addWithInfo(
52
48
  'simple usage (no prop tables)',
@@ -55,7 +51,7 @@ storiesOf('Button').addWithInfo(
55
51
  `,
56
52
  () => <Button label="The Button" onClick={action('onClick')} />,
57
53
  { propTables: false, inline: true }
58
- )
54
+ );
59
55
 
60
56
  storiesOf('Button').addWithInfo(
61
57
  'simple usage (custom propTables)',
@@ -80,22 +76,19 @@ storiesOf('Button').addWithInfo(
80
76
  </div>
81
77
  ),
82
78
  { inline: true, propTables: [Button] }
83
- )
79
+ );
84
80
 
85
81
  storiesOf('Button').addWithInfo(
86
82
  'simple usage (JSX description)',
87
83
  <div>
88
84
  <h2>This is a JSX info section</h2>
89
85
  <p>
90
- Lorem ipsum dolor sit amet, consectetur adipiscing elit.
91
- Sed ornare massa rutrum metus commodo, a mattis velit dignissim.
92
- Fusce vestibulum turpis sed massa egestas pharetra. Sed at libero
93
- nulla.
86
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ornare massa rutrum metus
87
+ commodo, a mattis velit dignissim. Fusce vestibulum turpis sed massa egestas pharetra. Sed at
88
+ libero nulla.
94
89
  </p>
95
90
  <p>
96
- <a href="https://github.com/storybookjs/react-storybook-addon-info">
97
- This is a link
98
- </a>
91
+ <a href="https://github.com/storybookjs/react-storybook-addon-info">This is a link</a>
99
92
  </p>
100
93
  <p>
101
94
  <img src="https://storybook.js.org/images/placeholders/350x150.png" />
@@ -105,27 +98,22 @@ storiesOf('Button').addWithInfo(
105
98
  <div>
106
99
  <Button label="The Button" onClick={action('onClick')} />
107
100
  <br />
108
- <p>
109
- Click the "?" mark at top-right to view the info.
110
- </p>
101
+ <p>Click the "?" mark at top-right to view the info.</p>
111
102
  </div>
112
103
  )
113
- )
104
+ );
114
105
 
115
106
  storiesOf('Button').addWithInfo(
116
107
  'simple usage (inline JSX description)',
117
108
  <div>
118
109
  <h2>This is a JSX info section</h2>
119
110
  <p>
120
- Lorem ipsum dolor sit amet, consectetur adipiscing elit.
121
- Sed ornare massa rutrum metus commodo, a mattis velit dignissim.
122
- Fusce vestibulum turpis sed massa egestas pharetra. Sed at libero
123
- nulla.
111
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ornare massa rutrum metus
112
+ commodo, a mattis velit dignissim. Fusce vestibulum turpis sed massa egestas pharetra. Sed at
113
+ libero nulla.
124
114
  </p>
125
115
  <p>
126
- <a href="https://github.com/storybookjs/react-storybook-addon-info">
127
- This is a link
128
- </a>
116
+ <a href="https://github.com/storybookjs/react-storybook-addon-info">This is a link</a>
129
117
  </p>
130
118
  <p>
131
119
  <img src="https://storybook.js.org/images/placeholders/350x150.png" />
@@ -133,7 +121,7 @@ storiesOf('Button').addWithInfo(
133
121
  </div>,
134
122
  () => <Button label="The Button" onClick={action('onClick')} />,
135
123
  { inline: true }
136
- )
124
+ );
137
125
 
138
126
  storiesOf('Button').addWithInfo(
139
127
  'simple usage (maxPropsInLine === 1)',
@@ -142,7 +130,7 @@ storiesOf('Button').addWithInfo(
142
130
  `,
143
131
  () => <Button label="The Button" onClick={action('onClick')} />,
144
132
  { inline: true, maxPropsIntoLine: 1 }
145
- )
133
+ );
146
134
 
147
135
  storiesOf('Button').addWithInfo(
148
136
  'simple usage (maxPropObjectKeys === 5)',
@@ -151,7 +139,7 @@ storiesOf('Button').addWithInfo(
151
139
  `,
152
140
  () => <Button label="The Button" object={{ a: 1, b: 2, c: 3, d: 4, e: 5, f: 6 }} />,
153
141
  { inline: true, maxPropObjectKeys: 5 }
154
- )
142
+ );
155
143
 
156
144
  storiesOf('Button').addWithInfo(
157
145
  'simple usage (maxPropArrayLength === 8)',
@@ -160,7 +148,7 @@ storiesOf('Button').addWithInfo(
160
148
  `,
161
149
  () => <Button label="The Button" array={[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]} />,
162
150
  { inline: true, maxPropArrayLength: 8 }
163
- )
151
+ );
164
152
 
165
153
  storiesOf('Button').addWithInfo(
166
154
  'simple usage (maxPropStringLength === 10)',
@@ -169,7 +157,7 @@ storiesOf('Button').addWithInfo(
169
157
  `,
170
158
  () => <Button label="The Button" string="1 2 3 4 5 6 7 8" />,
171
159
  { inline: true, maxPropStringLength: 5 }
172
- )
160
+ );
173
161
 
174
162
  storiesOf('Button').addWithInfo(
175
163
  'with custom styles',
@@ -180,19 +168,17 @@ storiesOf('Button').addWithInfo(
180
168
  () => <Button label="The Button" onClick={action('onClick')} />,
181
169
  {
182
170
  inline: true,
183
- styles: stylesheet => {
171
+ styles: (stylesheet) => {
184
172
  stylesheet.infoPage = {
185
- backgroundColor: '#ccc'
186
- }
187
- return stylesheet
188
- }
173
+ backgroundColor: '#ccc',
174
+ };
175
+ return stylesheet;
176
+ },
189
177
  }
190
- )
178
+ );
191
179
 
192
180
  storiesOf('shared/ProgressBar', module)
193
181
  .addDecorator(withKnobs)
194
182
  .addWithInfo('default style', () => (
195
- <ProgressBar progress={number('progress', 25)}
196
- delay={number('delay', 500)}
197
- />
183
+ <ProgressBar progress={number('progress', 25)} delay={number('delay', 500)} />
198
184
  ));
@@ -2,27 +2,23 @@
2
2
 
3
3
  exports[`update-addon-info transforms correctly using "update-addon-info.input.js" data 1`] = `
4
4
  "/* eslint-disable */
5
- import React from 'react'
6
- import Button from './Button'
5
+ import React from 'react';
6
+ import Button from './Button';
7
7
 
8
- import { storiesOf } from '@storybook/react'
9
- import { action } from '@storybook/addon-actions'
8
+ import { storiesOf } from '@storybook/react';
9
+ import { action } from '@storybook/addon-actions';
10
10
 
11
11
  import { withInfo } from \\"@storybook/addon-info\\";
12
12
 
13
- storiesOf(
14
- 'Button'
15
- ).add('simple usage', withInfo(
13
+ storiesOf('Button').add('simple usage', withInfo(
16
14
  'This is the basic usage with the button with providing a label to show the text.'
17
15
  )(() => (
18
16
  <div>
19
17
  <Button label=\\"The Button\\" onClick={action('onClick')} />
20
18
  <br />
21
- <p>
22
- Click the \\"?\\" mark at top-right to view the info.
23
- </p>
19
+ <p>Click the \\"?\\" mark at top-right to view the info.</p>
24
20
  </div>
25
- )))
21
+ )));
26
22
 
27
23
  storiesOf('Button').add('simple usage (inline info)', withInfo({
28
24
  text: \`
@@ -30,7 +26,7 @@ storiesOf('Button').add('simple usage (inline info)', withInfo({
30
26
  \`,
31
27
 
32
28
  inline: true
33
- })(() => <Button label=\\"The Button\\" onClick={action('onClick')} />))
29
+ })(() => <Button label=\\"The Button\\" onClick={action('onClick')} />));
34
30
 
35
31
  storiesOf('Button').add('simple usage (disable source)', withInfo({
36
32
  text: \`
@@ -39,7 +35,7 @@ storiesOf('Button').add('simple usage (disable source)', withInfo({
39
35
 
40
36
  source: false,
41
37
  inline: true
42
- })(() => <Button label=\\"The Button\\" onClick={action('onClick')} />))
38
+ })(() => <Button label=\\"The Button\\" onClick={action('onClick')} />));
43
39
 
44
40
  storiesOf('Button').add('simple usage (no header)', withInfo({
45
41
  text: \`
@@ -48,7 +44,7 @@ storiesOf('Button').add('simple usage (no header)', withInfo({
48
44
 
49
45
  header: false,
50
46
  inline: true
51
- })(() => <Button label=\\"The Button\\" onClick={action('onClick')} />))
47
+ })(() => <Button label=\\"The Button\\" onClick={action('onClick')} />));
52
48
 
53
49
  storiesOf('Button').add('simple usage (no prop tables)', withInfo({
54
50
  text: \`
@@ -57,7 +53,7 @@ storiesOf('Button').add('simple usage (no prop tables)', withInfo({
57
53
 
58
54
  propTables: false,
59
55
  inline: true
60
- })(() => <Button label=\\"The Button\\" onClick={action('onClick')} />))
56
+ })(() => <Button label=\\"The Button\\" onClick={action('onClick')} />));
61
57
 
62
58
  storiesOf('Button').add('simple usage (custom propTables)', withInfo({
63
59
  text: \`
@@ -82,20 +78,17 @@ storiesOf('Button').add('simple usage (custom propTables)', withInfo({
82
78
  <Button label=\\"The Button\\" onClick={action('onClick')} />
83
79
  <br />
84
80
  </div>
85
- )))
81
+ )));
86
82
 
87
83
  storiesOf('Button').add('simple usage (JSX description)', withInfo(<div>
88
84
  <h2>This is a JSX info section</h2>
89
85
  <p>
90
- Lorem ipsum dolor sit amet, consectetur adipiscing elit.
91
- Sed ornare massa rutrum metus commodo, a mattis velit dignissim.
92
- Fusce vestibulum turpis sed massa egestas pharetra. Sed at libero
93
- nulla.
86
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ornare massa rutrum metus
87
+ commodo, a mattis velit dignissim. Fusce vestibulum turpis sed massa egestas pharetra. Sed at
88
+ libero nulla.
94
89
  </p>
95
90
  <p>
96
- <a href=\\"https://github.com/storybookjs/react-storybook-addon-info\\">
97
- This is a link
98
- </a>
91
+ <a href=\\"https://github.com/storybookjs/react-storybook-addon-info\\">This is a link</a>
99
92
  </p>
100
93
  <p>
101
94
  <img src=\\"https://storybook.js.org/images/placeholders/350x150.png\\" />
@@ -104,25 +97,20 @@ storiesOf('Button').add('simple usage (JSX description)', withInfo(<div>
104
97
  <div>
105
98
  <Button label=\\"The Button\\" onClick={action('onClick')} />
106
99
  <br />
107
- <p>
108
- Click the \\"?\\" mark at top-right to view the info.
109
- </p>
100
+ <p>Click the \\"?\\" mark at top-right to view the info.</p>
110
101
  </div>
111
- )))
102
+ )));
112
103
 
113
104
  storiesOf('Button').add('simple usage (inline JSX description)', withInfo({
114
105
  text: <div>
115
106
  <h2>This is a JSX info section</h2>
116
107
  <p>
117
- Lorem ipsum dolor sit amet, consectetur adipiscing elit.
118
- Sed ornare massa rutrum metus commodo, a mattis velit dignissim.
119
- Fusce vestibulum turpis sed massa egestas pharetra. Sed at libero
120
- nulla.
108
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ornare massa rutrum metus
109
+ commodo, a mattis velit dignissim. Fusce vestibulum turpis sed massa egestas pharetra. Sed at
110
+ libero nulla.
121
111
  </p>
122
112
  <p>
123
- <a href=\\"https://github.com/storybookjs/react-storybook-addon-info\\">
124
- This is a link
125
- </a>
113
+ <a href=\\"https://github.com/storybookjs/react-storybook-addon-info\\">This is a link</a>
126
114
  </p>
127
115
  <p>
128
116
  <img src=\\"https://storybook.js.org/images/placeholders/350x150.png\\" />
@@ -130,7 +118,7 @@ storiesOf('Button').add('simple usage (inline JSX description)', withInfo({
130
118
  </div>,
131
119
 
132
120
  inline: true
133
- })(() => <Button label=\\"The Button\\" onClick={action('onClick')} />))
121
+ })(() => <Button label=\\"The Button\\" onClick={action('onClick')} />));
134
122
 
135
123
  storiesOf('Button').add('simple usage (maxPropsInLine === 1)', withInfo({
136
124
  text: \`
@@ -139,7 +127,7 @@ storiesOf('Button').add('simple usage (maxPropsInLine === 1)', withInfo({
139
127
 
140
128
  inline: true,
141
129
  maxPropsIntoLine: 1
142
- })(() => <Button label=\\"The Button\\" onClick={action('onClick')} />))
130
+ })(() => <Button label=\\"The Button\\" onClick={action('onClick')} />));
143
131
 
144
132
  storiesOf('Button').add('simple usage (maxPropObjectKeys === 5)', withInfo({
145
133
  text: \`
@@ -150,7 +138,7 @@ storiesOf('Button').add('simple usage (maxPropObjectKeys === 5)', withInfo({
150
138
  maxPropObjectKeys: 5
151
139
  })(
152
140
  () => <Button label=\\"The Button\\" object={{ a: 1, b: 2, c: 3, d: 4, e: 5, f: 6 }} />
153
- ))
141
+ ));
154
142
 
155
143
  storiesOf('Button').add('simple usage (maxPropArrayLength === 8)', withInfo({
156
144
  text: \`
@@ -161,7 +149,7 @@ storiesOf('Button').add('simple usage (maxPropArrayLength === 8)', withInfo({
161
149
  maxPropArrayLength: 8
162
150
  })(
163
151
  () => <Button label=\\"The Button\\" array={[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]} />
164
- ))
152
+ ));
165
153
 
166
154
  storiesOf('Button').add('simple usage (maxPropStringLength === 10)', withInfo({
167
155
  text: \`
@@ -170,7 +158,7 @@ storiesOf('Button').add('simple usage (maxPropStringLength === 10)', withInfo({
170
158
 
171
159
  inline: true,
172
160
  maxPropStringLength: 5
173
- })(() => <Button label=\\"The Button\\" string=\\"1 2 3 4 5 6 7 8\\" />))
161
+ })(() => <Button label=\\"The Button\\" string=\\"1 2 3 4 5 6 7 8\\" />));
174
162
 
175
163
  storiesOf('Button').add('with custom styles', withInfo({
176
164
  text: \`
@@ -180,19 +168,17 @@ storiesOf('Button').add('with custom styles', withInfo({
180
168
 
181
169
  inline: true,
182
170
 
183
- styles: stylesheet => {
171
+ styles: (stylesheet) => {
184
172
  stylesheet.infoPage = {
185
- backgroundColor: '#ccc'
186
- }
187
- return stylesheet
173
+ backgroundColor: '#ccc',
174
+ };
175
+ return stylesheet;
188
176
  }
189
- })(() => <Button label=\\"The Button\\" onClick={action('onClick')} />))
177
+ })(() => <Button label=\\"The Button\\" onClick={action('onClick')} />));
190
178
 
191
179
  storiesOf('shared/ProgressBar', module)
192
180
  .addDecorator(withKnobs)
193
181
  .add('default style', withInfo('default style')(() => (
194
- <ProgressBar progress={number('progress', 25)}
195
- delay={number('delay', 500)}
196
- />
182
+ <ProgressBar progress={number('progress', 25)} delay={number('delay', 500)} />
197
183
  )));"
198
184
  `;