ramasilveyra / unreact

Convert React Components to EJS or Pug [Alpha][Unreleased]
MIT License
14 stars 3 forks source link

fix: calculate the correct scope on iterables to avoid issues with makeReferenceSafe #13

Closed alejofernandez closed 5 years ago

alejofernandez commented 5 years ago

This PR sends the proper scope to makeReferenceSafe for iterables in order to avoid replacing locals in parameters of array functions.

Also added auto-attach debugger setting for vscode, which really helps when using the terminal.

Before the fix

This code

{list.filter(item => !!item).map(item => (...)

was translated into this code

<% locals.list.filter((locals.item) => !!(locals.item)).forEach((item) => { %>

After the fix

This code

{list.filter(item => !!item).map(item => (...)

is now translated into this code

<% locals.list.filter(item => !!item).forEach((item) => { %>
codecov-io commented 5 years ago

Codecov Report

Merging #13 into master will increase coverage by <.01%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #13      +/-   ##
==========================================
+ Coverage   98.41%   98.42%   +<.01%     
==========================================
  Files          23       23              
  Lines         822      827       +5     
  Branches      181      181              
==========================================
+ Hits          809      814       +5     
  Misses         13       13
Impacted Files Coverage Δ
src/code-generator-ejs.js 99.04% <100%> (+0.04%) :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 61a330f...d0669df. Read the comment docs.