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

fix extraction for expressions with computed properties #86

Merged
merged 5 commits into from May 17, 2017

Conversation

Projects
None yet
2 participants
@AlexMost
Member

AlexMost commented May 15, 2017

Addressing to this issue - #85
@MrOrz @alxpy

@AlexMost AlexMost requested a review from MrOrz May 15, 2017

@codecov

This comment has been minimized.

codecov bot commented May 15, 2017

Codecov Report

Merging #86 into master will increase coverage by 0.31%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #86      +/-   ##
==========================================
+ Coverage   96.14%   96.45%   +0.31%     
==========================================
  Files          13       13              
  Lines        1063     1045      -18     
  Branches      152      151       -1     
==========================================
- Hits         1022     1008      -14     
+ Misses         41       37       -4
Impacted Files Coverage Δ
src/extractors/ngettext.js 99.21% <100%> (-0.03%) ⬇️
src/extractors/tag-gettext.js 100% <100%> (ø) ⬆️
src/utils.js 94.92% <100%> (+1.82%) ⬆️

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 e698f2f...4716d39. Read the comment docs.

@MrOrz

MrOrz suggested changes May 16, 2017 edited

Thanks for the timely fix!
I can confirm it working in situations like

t`${arr[0].name}`

However, it does not work for the following case:

t`${arr[val].name}` // --> ${ arr[undefined].name }
@AlexMost

This comment has been minimized.

Member

AlexMost commented May 16, 2017

@MrOrz ah, nice catch. Maybe it's also reasonable to validate what can be used as a key for the computed property.

I think possible values for the computed property can be:

  • identifiers - ${ arr[val].value }
  • literals - ${ arr[0].value } / ${ arr['test'].value }
  • and member expressions - ${ arr[val.test].value }

Have I missed something?

@MrOrz

MrOrz approved these changes May 17, 2017

Had a test run on my project with 900+ strings. It is looking good :)

@AlexMost AlexMost merged commit e5c42cb into master May 17, 2017

4 checks passed

codecov/patch 100% of diff hit (target 96.14%)
Details
codecov/project 96.45% (+0.31%) compared to e698f2f
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@AlexMost AlexMost deleted the fix-computed-props branch May 17, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment