Transfer JSdoc stories to new format

This commit is contained in:
Tom Coleman 2022-09-28 16:18:18 +10:00
parent d15deee9d2
commit 7052663b0d
7 changed files with 11 additions and 503 deletions

View File

@ -1,472 +0,0 @@
/* eslint-disable react/no-unused-prop-types */
/* eslint-disable react/require-default-props */
/* eslint-disable react/prop-types */
import React from 'react';
import PropTypes from 'prop-types';
export const ButtonTooManyProps = ({ onClick, children }) => (
<button type="button" onClick={onClick}>
{children}
</button>
);
ButtonTooManyProps.propTypes = {
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick1: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick2: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick3: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick4: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick5: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick6: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick7: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick8: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick9: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick10: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick11: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick12: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick13: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick14: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick15: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick16: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick17: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick18: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick19: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick20: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick21: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick22: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick23: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick24: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick25: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick26: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick27: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick28: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick29: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick30: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick31: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick32: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick33: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick34: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick35: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick36: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick37: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick38: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick39: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick40: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick41: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick42: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick43: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick44: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick45: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick46: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick47: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick48: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick49: PropTypes.func,
/**
* onClick description
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {SyntheticEvent} event1 - React's original SyntheticEvent.
* @param {SyntheticEvent} event2 - React's original SyntheticEvent.
* @param {SyntheticEvent} event3 - React's original SyntheticEvent.
* @returns {void}
*/
onClick50: PropTypes.func,
};

View File

@ -1,10 +0,0 @@
import { Meta, ArgsTable } from '@storybook/addon-docs';
import { ButtonTooManyProps } from './jsdoc-perfo';
<Meta title="Docgen/jsdoc-perfo" />
## Render 150 props with JSDoc tags
<ArgsTable of={ButtonTooManyProps} />
<ArgsTable of={ButtonTooManyProps} />
<ArgsTable of={ButtonTooManyProps} />

View File

@ -1,9 +0,0 @@
import { Meta, ArgsTable } from '@storybook/addon-docs';
import { JsDocProps, FailingJsDocProps } from './jsdoc';
import { TypeScriptProps } from './jsdoc-ts';
<Meta title="Docgen/jsdoc" />
<ArgsTable of={JsDocProps} />
<ArgsTable of={TypeScriptProps} />
<ArgsTable of={FailingJsDocProps} />

View File

@ -1,9 +1,7 @@
/* eslint-disable react/no-unused-prop-types */
/* eslint-disable react/require-default-props */
import React from 'react';
import PropTypes from 'prop-types';
export const JsDocProps = () => <div>JSDoc with PropTypes!</div>;
const JsDocProps = () => <div>JSDoc with PropTypes!</div>;
JsDocProps.propTypes = {
/**
* should not be visible since it's ignored.
@ -229,11 +227,4 @@ JsDocProps.propTypes = {
case43: PropTypes.func,
};
export const FailingJsDocProps = () => <div>Failing JSDoc Props!</div>;
FailingJsDocProps.propTypes = {
/**
* autofix event.
* @param event.
*/
case: PropTypes.func,
};
export const component = JsDocProps;

View File

@ -17,8 +17,10 @@ interface TSProps {
/**
* Button functional component (React.FC)
*/
export const TypeScriptProps: FC<TSProps> = ({ case1, case2 }) => (
const TypeScriptProps: FC<TSProps> = ({ case1, case2 }) => (
<button type="button" onClick={case1}>
JSDoc with TypeScript! {case2}
</button>
);
export const component = TypeScriptProps;

View File

@ -18,6 +18,7 @@ import { component as JsPropTypesOneofComponent } from './__testfixtures__/8140-
import { component as JsHocComponent } from './__testfixtures__/9023-js-hoc/input.jsx';
import { component as JsReactMemoComponent } from './__testfixtures__/9586-js-react-memo/input.jsx';
import { component as JsStaticPropTypesComponent } from './__testfixtures__/8428-js-static-prop-types/input.jsx';
import { component as JsdocComponent } from './__testfixtures__/jsdoc/input.jsx';
// Detect if we are running in vite in a hacky way for now
// eslint-disable-next-line camelcase
@ -84,3 +85,5 @@ export const JsHoc = { parameters: { component: JsHocComponent } };
export const JsReactMemo = { parameters: { component: JsReactMemoComponent } };
export const JsStaticPropTypes = { parameters: { component: JsStaticPropTypesComponent } };
export const Jsdoc = { parameters: { component: JsdocComponent } };

View File

@ -21,6 +21,7 @@ import { component as TsForwardRefComponent } from './__testfixtures__/8894-9511
import { component as TsTypePropsComponent } from './__testfixtures__/9465-ts-type-props/input';
import { component as TsExtendPropsComponent } from './__testfixtures__/9764-ts-extend-props/input';
import { component as TsComponentPropsComponent } from './__testfixtures__/9922-ts-component-props/input';
import { component as TsJsdocComponent } from './__testfixtures__/ts-jsdoc/input';
export default {
component: {},
@ -73,3 +74,5 @@ export const TsTypeProps = { parameters: { component: TsTypePropsComponent } };
export const TsExtendProps = { parameters: { component: TsExtendPropsComponent } };
export const TsComponentProps = { parameters: { component: TsComponentPropsComponent } };
export const TsJsdoc = { parameters: { component: TsJsdocComponent } };