Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 495822

Summary: [tern][eslint] Guessed types should not be flagged as problems in the no-undef-expression rule
Product: [ECD] Orion Reporter: Michael Rennie <Michael_Rennie>
Component: JS ToolsAssignee: Michael Rennie <Michael_Rennie>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: curtis.windatt.public, Olivier_Thomann
Version: 10.0Flags: Olivier_Thomann: review+
curtis.windatt.public: review+
Target Milestone: 12.0   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Michael Rennie CLA 2016-06-09 13:29:57 EDT
When we ask for a type from Tern, sometimes it will guess (OK), and sometimes the guess is correct (and sometimes not).

In our linting rule no-undef-expression, if it guesses and gets it wrong we end up marking the member expression anyway. We should ignore guessed types by default, as mis-marked expressions cause loss of trust in the tools.
Comment 1 Michael Rennie CLA 2016-06-09 13:32:38 EDT
A real life example of this is in server.js - electron.app.* all get flagged as not being part of 'express'.
Comment 2 Michael Rennie CLA 2016-06-09 14:09:22 EDT
Fix + tests:

http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=0032b1c3caffe5be54c64cf388c33065f3aea988

Curtis, Olivier, please review.
Comment 3 Olivier Thomann CLA 2016-06-09 14:23:11 EDT
+1
Comment 4 Curtis Windatt CLA 2016-06-09 14:30:11 EDT
+1

I don't think that we should be checking the guess flag on the first findTypeExpr result.  If we are guessing a type but then can't find the prop, we should fall into the second check (check the type of the object).  However, in practice this case should never come up (if we get a guessed type information we should always be able to find the matching prop).