Hi!

This is actually possible, per example, the 33 * 2 expression will always 
result in a number. The same goes for some dynamic expressions like !foo 
that will always be a boolean whatever foo may contain.

That's what i made in the previously linked file but in a naive way since 
creating such a lib is out of the scope of my eslint plugin.

What i'd like to find is a robust library to use it instead. Anyway, i'll 
continue this way until i find something and if not i'll probably create 
another module to handle that concern. Fell free to help!

Le jeudi 27 août 2015 17:23:28 UTC+2, Ilya Volodin a écrit :
>
> I think without using something like Flow or TypeScript, it’s impossible 
> to determine type of the value for an AST node. Sorry, I’m not aware of 
> anything that would allow you to do it, and I’m not really sure it’s 
> possible to do in the first place.
>
>  
>
> Thanks,
>
>  
>
>                                 Ilya Volodin
>
>  
>
> *From:* [email protected] <javascript:> [mailto:
> [email protected] <javascript:>] *On Behalf Of *Nicolas FROIDURE
> *Sent:* Thursday, August 27, 2015 9:28 AM
> *To:* ESLint <[email protected] <javascript:>>
> *Subject:* [ESLint] Good AST node assertion library?
>
>  
>
> Hi all,
>
>  
>
> I'm currently creating an eslint plugin for MongoDB queries/updates 
> linting and for this work i need to guess the resulting type of a 
> particular AST node at execution.
>
>  
>
> By example, knowing if a particular AST node will always return a number, 
> a date object or a string or if it is impossible to know it for that 
> particular node.
>
>  
>
> I started factorizing the code here 
> https://github.com/nfroidure/eslint-plugin-mongodb/blob/master/src/lib/utils.js#L101
>  but 
> i'm sure i'm missing some great library that could do it for me.
>
>  
>
> Despite my various search i couldn't find it, does some of you know an 
> existing library allowing to do that kind of things?
>
>  
>
> Thanks in advance.
>
> -- 
> 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] <javascript:>.
> 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.

Reply via email to