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

Handle JSX elements with spread operator with remove-jsx-attribute plugin #231

Merged
merged 1 commit into from
Nov 13, 2018

Conversation

snags88
Copy link
Contributor

@snags88 snags88 commented Nov 13, 2018

Summary

With the remove-jsx-attribute plugin, if you run an element with a spread operator, it would throw an exception because the JSXSpreadAttribute AST node does not have a name attribute.

In order to allow continue checking for removal of attributes, the PR updates the code so that we make sure that there is a node name to check before we make the comparison to remove it.

Test plan

Wrote a test with a JSX element with spread operator. It failed before the code modification and passes afterwards.

@vercel
Copy link

vercel bot commented Nov 13, 2018

This pull request is automatically deployed with Now.
To access deployments, click Details below or on the icon next to each push.

@codecov
Copy link

codecov bot commented Nov 13, 2018

Codecov Report

Merging #231 into master will increase coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #231      +/-   ##
==========================================
+ Coverage   85.33%   85.36%   +0.03%     
==========================================
  Files          29       29              
  Lines         450      451       +1     
  Branches      127      127              
==========================================
+ Hits          384      385       +1     
  Misses         55       55              
  Partials       11       11
Impacted Files Coverage Δ
...ges/babel-plugin-remove-jsx-attribute/src/index.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 56241b3...07407b2. Read the comment docs.

@gregberge
Copy link
Owner

@snags88 thanks for the fix!

@gregberge gregberge merged commit 4186953 into gregberge:master Nov 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants