styleguidist/react-styleguidist

Unexpected token in code example

Open

#1.321 geöffnet am 27. März 2019

Auf GitHub ansehen
 (43 Kommentare) (47 Reaktionen) (0 zugewiesene Personen)TypeScript (1.416 Forks)github user discovery
help wantedtechnical debt

Repository-Metriken

Stars
 (11.091 Stars)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

I had to install react-styleguidist with yarn (vs npm) to have PROPS & METHODSi working.

Now it works but i have Syntax errors for all my components (with defaultExample set to true and components with their own examples too):

Current behavior

in the .md file

``` jsx
<Card>test</Card>

results in

SyntaxError: Unexpected token (1:6)
1 : <React.Fragment><Card>test</Card></React.Fragment>;
          ^

and

``` jsx
// comment
<Card>test</Card>

results in

SyntaxError: Unexpected token (2:11)
1 : // comment
2 : <Card>test</Card>
               ^

here is an example of a simple component code :

import React from 'react';
import PropTypes from "prop-types";
import "../../../styles/elements/card.less"

const Card = ({children, id}) =>
    <div id={id} className={"Card"}>
        {children}
    </div>;

Card.propTypes = {
    id: PropTypes.string
};

export default Card;

Expected behavior The code example should display my component

Contributor Guide