I’m working with Adobe Extendscript, which == javascript*, and I’m using the Atom JSHint package in Atom. Extendscript is the scripting framework for Adobe apps like Photoshop and After Effects. Adobe do make an IDE but it’s really feeble, so I write with Atom and then switch over to “Extendscript Toolkit” to run my scripts. Anyway…
Adobe lets you use C-style preprocessor directives like #include "myUsefulFunctions.jsx"
so that you can keep reusable stuff in libraries like a real programming language.
The problem is that the JSHint linter sees my C-style preprocessor directives at the top of the page, freaks out and gives up. To actually get it to lint my code I have to comment the preprocessor directives out and then remember to uncomment them before I run the code. This means at least 3 or 4 extra keystrokes each time I test, which as you all know is The. Worst. Thing. Ever.
So to save half a dozen keystrokes I’ve been looking into the settings for JSHint. Nothing I’ve found so far seems related. Is there any way of globally getting JSHint to ignore lines like #this
, or locally in the file to get it to skip a line or two?
*or is it ===
? I’m really confused by JS’s approach to the truth.
3
Answers
I changed the JSHint package that I use, and now there's no need for workarounds.
For anyone else developing Extendscript in Atom the linter I recommend is this one: Linter-JSHint. It's a plug-in for the Atom Linter package, so you'll need to install that too.
Then once you've done that use this to ignore a block:
or for a single line:
I also tried to figure it out for a long time, until I found the best solution.
Instead of using:
You can use:
I didn’t found any documentations for the above solution.
I just found it in a script over the net, and I tried it and it worked.
And instead using:
As mentioned in the JavaScript Tools Guide:
You can use:
The diffrence is that
#include
:In jshint you can ignore lines by adding a ignore statement to the line.
Or you can ignore whole blocks like this.
(BTW the
//@target aftereffects
is pretty cool. Thanks for pointing that out)