Closed Bug 715242 Opened 13 years ago Closed 9 years ago

Add build-time syntax checking for JS files in the Fennec build

Categories

(Firefox Build System :: General, defect)

All
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: kats, Unassigned)

Details

Often I make a change to browser.js only to find out I had a typo somewhere when I run it. We should add some sort of JS-lint syntax checker into the build to catch dumb syntax errors faster.
Assignee: bugmail.mozilla → nobody
Component: General → Build Config
Product: Fennec Native → Core
QA Contact: general → build-config
any idea what we can do here Kats/Kyle?
I looked briefly at JSlint and their ilk but it seems they don't like the "let" keyword we use all over the place. Since that's mozilla-specific it makes sense to use SpiderMonkey to check syntax instead of some other tool. Unfortunately the latest version of SpiderMonkey (that I built from trunk) no longer has the -C option (as seen at https://developer.mozilla.org/En/SpiderMonkey/Introduction_to_the_JavaScript_shell) to compile a JS file without running it. Maybe we could use an older version of SpiderMonkey that still has the option?
Or we could just add the option back in a more useful way, or something. The downside is that the JS shell you'd build as part of an Android build is for ARM...
True. Does rhino support mozilla-isms? That could run on any/most platforms, and presumably could do syntax checking.
For what it's worth, in bug 715498, I just brought back support for 'js -c' for "compile only".
Great, thanks! I looked at rhino and it doesn't appear to support "let" or have options for syntax checking only. js -c seems to work well, we just need to hook it into the build system.
Seems like |mach eslint| can be (ab)used to do this so I'm going to close out this bug.
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → WORKSFORME
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.