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

Unable use components with hyphenated proptypes for aria attributes #601

Closed
alexanbj opened this issue Nov 3, 2016 · 3 comments
Closed
Assignees
Labels

Comments

@alexanbj
Copy link

alexanbj commented Nov 3, 2016

I upgraded from Storybook 2.24.0 to 2.29.3 today and Storybook no longer starts.

For me it breaks on our 3 components that use hyphenated proptypes for required aria attributes, such as this:

ExampleComponent.propTypes = {
  // Required because of accessibility
  'aria-label': PropTypes.string.isRequired,
};

If I remove those proptypes it works. I guess I could just use camelCase instead, but React supports this, and as I said, this used to work fine before the upgrade.

Here is a stacktrace:

ERROR in ./src/breadcrumb/Breadcrumb.jsx
Module parse failed: /Users/alexanbj/Documents/Jobb/Prosjekter/KF/common-frontend/packages/kf-ui/node_modules/babel-loader/index.js?{"babelrc":false,"cacheDirectory":"/Users/alexanbj/Documents/Jobb/Prosjekter/KF/common-frontend/packages/kf-ui/node_modules/.cache/react-storybook","presets":["/Users/alexanbj/Documents/Jobb/Prosjekter/KF/common-frontend/packages/kf-ui/node_modules/babel-preset-react-app/index.js"],"plugins":[["/Users/alexanbj/Documents/Jobb/Prosjekter/KF/common-frontend/packages/kf-ui/node_modules/babel-plugin-react-docgen/lib/index.js",{"DOC_GEN_COLLECTION_NAME":"STORYBOOK_REACT_CLASSES"}]]}!/Users/alexanbj/Documents/Jobb/Prosjekter/KF/common-frontend/packages/kf-ui/src/breadcrumb/Breadcrumb.jsx Unexpected token (89:8)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (89:8)
    at Parser.pp$4.raise (/Users/alexanbj/Documents/Jobb/Prosjekter/KF/common-frontend/packages/kf-ui/node_modules/acorn/dist/acorn.js:2221:15)
    at Parser.pp.unexpected (/Users/alexanbj/Documents/Jobb/Prosjekter/KF/common-frontend/packages/kf-ui/node_modules/acorn/dist/acorn.js:603:10)
    at Parser.pp.expect (/Users/alexanbj/Documents/Jobb/Prosjekter/KF/common-frontend/packages/kf-ui/node_modules/acorn/dist/acorn.js:597:28)
    at Parser.pp$3.parseObj (/Users/alexanbj/Documents/Jobb/Prosjekter/KF/common-frontend/packages/kf-ui/node_modules/acorn/dist/acorn.js:1973:16)
    at Parser.pp$3.parseExprAtom (/Users/alexanbj/Documents/Jobb/Prosjekter/KF/common-frontend/packages/kf-ui/node_modules/acorn/dist/acorn.js:1805:19)
    at Parser.pp$3.parseExprSubscripts (/Users/alexanbj/Documents/Jobb/Prosjekter/KF/common-frontend/packages/kf-ui/node_modules/acorn/dist/acorn.js:1715:21)
    at Parser.pp$3.parseMaybeUnary (/Users/alexanbj/Documents/Jobb/Prosjekter/KF/common-frontend/packages/kf-ui/node_modules/acorn/dist/acorn.js:1692:19)
    at Parser.pp$3.parseExprOps (/Users/alexanbj/Documents/Jobb/Prosjekter/KF/common-frontend/packages/kf-ui/node_modules/acorn/dist/acorn.js:1637:21)
    at Parser.pp$3.parseMaybeConditional (/Users/alexanbj/Documents/Jobb/Prosjekter/KF/common-frontend/packages/kf-ui/node_modules/acorn/dist/acorn.js:1620:21)
    at Parser.pp$3.parseMaybeAssign (/Users/alexanbj/Documents/Jobb/Prosjekter/KF/common-frontend/packages/kf-ui/node_modules/acorn/dist/acorn.js:1597:21)
 @ ./src/index.js 8:18-52
@arunoda arunoda added the bug label Nov 3, 2016
@thani-sh thani-sh self-assigned this Dec 5, 2016
@camjc
Copy link

camjc commented Jan 2, 2017

I'm still getting this defect, would be great to resolve it.

@arunoda
Copy link
Member

arunoda commented Jan 3, 2017

Try the version 2.35.2.
I did a fix for this issue.

@arunoda arunoda closed this as completed Jan 3, 2017
@camjc
Copy link

camjc commented Jan 3, 2017

@arunoda You're my hero, thanks mate!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants