This would be reasonably tough to do. You would have to separately add a
listener for FunctionDelcaration and FunctionExpression and track their return
value. Then on program:exit get the list of all of the variables and check
which function is assigned to them. Basically you have to do that using
multiple passes.
Thanks,
Ilya Volodin
From: [email protected] <[email protected]> On Behalf Of Chris Meyer
Sent: Wednesday, February 20, 2019 5:11 PM
To: ESLint <[email protected]>
Subject: [ESLint] Rules: tracking variables back to a literal value
Hi, I need some guidance on how to find a literal value for a variable, if it
can be determined. For example:
function getValue() {
return false;
}
var val = getValue();
...
var x = val;
Let's say I wanted to know when x was false. How would I go about walking back
to the return value in the getValue function? The rule I'm working on is to
detect synchronous XMLHttpRequests.
Thanks for any advice!
--
You received this message because you are subscribed to the Google Groups
"ESLint" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected]
<mailto:[email protected]> .
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"ESLint" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.