Ignore Custom Preprocessor Directives

74 views
Skip to first unread message

Si Robertson

unread,
Jun 27, 2013, 2:39:00 AM6/27/13
to jsh...@googlegroups.com
Hi guys,

I am using preprocessor directives in my JavaScript code, and obviously JSHint isn't happy when it encounters them.

#if BUILD::DEBUG
console.log( "this will be stripped out of release builds" )
#endif

Is it possible to tell JSHint to ignore those lines (i.e. lines that begin with a hash symbol), or am I going to have to hack the JSHint source code?

Thanks :-)

Anton Kovalyov

unread,
Jun 27, 2013, 2:53:51 AM6/27/13
to jsh...@googlegroups.com
Yep, you're going to have to hack JSHint source. Pre-processor directives are not part of the language so we won't add support for it.

Anton
--
You received this message because you are subscribed to the Google Groups "JSHint" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jshint+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Si Robertson

unread,
Jun 27, 2013, 3:37:18 AM6/27/13
to jsh...@googlegroups.com
I thought that would be the case :-)

No problem though, I chained an additional replace() near the beginning of the lexer code (where the line endings are normalized etc) and that seems have worked nicely. Thankfully it was a lot easier than I expected to it be.

John Taufa

unread,
Oct 24, 2013, 9:56:42 PM10/24/13
to jsh...@googlegroups.com, retrom...@gmail.com
Hi Si,
I'm having the same problem. Would you mind sharing a bit more code on what you did, I'm fairly new at coding so any help is greatly appreciated.

John
Reply all
Reply to author
Forward
0 new messages