pugjs / babel-plugin-transform-react-pug

A plugin for transpiling pug templates to jsx
MIT License
808 stars 46 forks source link

Make sure that if we provide only code (if, each, inline code), it operates #76

Closed ezhlobo closed 5 years ago

ezhlobo commented 5 years ago

It basically makes sure that following snippet won't render anything. Before that it crashed with the error.

pug`
  if false
    p Hello
`

How it works: now instead of transforming falsy-branch into undefined, we transform it into null. JSX+React works perfectly with null.

codecov-io commented 5 years ago

Codecov Report

Merging #76 into next will increase coverage by 4.91%. The diff coverage is 83.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##             next      #76      +/-   ##
==========================================
+ Coverage   83.19%   88.11%   +4.91%     
==========================================
  Files          21       21              
  Lines         488      488              
  Branches      117      117              
==========================================
+ Hits          406      430      +24     
+ Misses         73       55      -18     
+ Partials        9        3       -6
Impacted Files Coverage Δ
src/visitors/Conditional.js 100% <100%> (ø) :arrow_up:
src/visitors/Code.js 62.5% <100%> (ø) :arrow_up:
src/visitors/Case.js 77.27% <50%> (+72.72%) :arrow_up:
src/visitors/While.js 81.81% <0%> (+72.72%) :arrow_up:

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 7de39c3...654fb2c. Read the comment docs.