Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
for (const line of lines) {
if (line === '// @component-docs ignore-next-line') {
skip = true;
continue;
}
if (skip) {
skip = false;
continue;
}
content += line + '\n';
}
const info = parse(
content,
undefined,
[...defaultHandlers, staticPropertyHandler],
{
cwd: root,
filename: filepath,
}
);
const name = info.displayName || getNameFromPath(filepath);
return {
filepath: path.relative(root, filepath),
title: name,
description: info.description,
link: dashify(name),
data: info,
lab.test('with arrayOf', ({ context }) => {
const result = context.renderer.render(
'./some/path',
reactDocgen.parse(
simpleComponent({
componentName: 'MyComponent',
props: [
context.getShapeProp([
{ name: 'stringProp', type: 'string' },
{ name: 'arrayOfProp', type: 'arrayOf(PropTypes.number)' },
]),
],
}),
),
[],
);
expect(result).to.equal(
simpleMarkdown({
types: [
function render(methods) {
const parsed = parse(`
import { Component } from 'react';
export default class Cmpnt extends Component {
${methods.join('\n')}
render() {
}
}
`);
return shallow();
}
const SettingsPanelPage = () => {
const info = parse(componentCode);
return (
<div>
</div>
);
};
const ToFieldPage = () => {
const info = parse(componentCode);
return (
<div>
</div>
);
};
const RecentActivityViewPage = () => {
const info = parse(componentCode);
return (
<div>
</div>
);
};
function parse(source, handler) {
const code = `
var React = require('react');
${source}
`;
return docgen.parse(code, findAllComponentDefinitions, [handler])[0];
}
const MessagesPanelPage = () => {
const info = parse(componentCode);
return (
<div>
</div>
);
};
const TabNavigationViewPage = () => {
const info = parse(componentCode);
return (
<div>
</div>
);
};
const SwitchPage = () => {
const info = parse(componentCode);
return (
<div>
</div>
);
};