Closed Bug 1170804 Opened 9 years ago Closed 9 years ago

Add .eslintrc files for /mobile JS files

Categories

(Firefox Build System :: Android Studio and Gradle Integration, defect)

35 Branch
defect
Not set
normal

Tracking

(firefox41 fixed)

RESOLVED FIXED
mozilla41
Tracking Status
firefox41 --- fixed

People

(Reporter: Margaret, Assigned: mcomella)

References

Details

Attachments

(5 files)

So that we can use ESLint in IJ.
For the record: 17:14 nalexander: margaret: it's important to install npm globally (brew install npm) and then |npm install -g eslint|. Otherwise, you get a copy in $OBJDIR, which will disappear eventually. It looks like devtools and hello have configurations we might want to take from.
Bug 1170804 - Add .eslintrc configuration file to components/. r=margaret
Attachment #8626030 - Flags: review?(margaret.leibovic)
Bug 1170804 - Fix bugs found by eslint in components/. r=margaret A few errors still remain.
Attachment #8626031 - Flags: review?(margaret.leibovic)
The remaining errors are: HelperAppDialog.js 213:13 error "ContentAreaUtils" is not defined no-undef Is this inherited from browser.js? PromptService.js 399:60 error "aText" is not defined no-undef 401:49 error "aText" is not defined no-undef I imagine aText is supposed to be in the method header, but I can't find the idl definition. Snippets.js 256:24 error Unexpected identifier I don't think it likes yield, but HelperAppDialog didn't have any issues. Any ideas, Margaret?
Assignee: nobody → michael.l.comella
Flags: needinfo?(margaret.leibovic)
Comment on attachment 8626030 [details] MozReview Request: Bug 1170804 - Add .eslintrc configuration file to mobile/android. r=margaret Bug 1170804 - Add .eslintrc configuration file to mobile/android. r=margaret eslint can be run by `cd`ing to mobile/android and running `eslint .` (assuming eslint is installed). Note that .jsm files have not yet been configured. Add an eslintignore to avoid the files that will take more work.
Attachment #8626030 - Attachment description: MozReview Request: Bug 1170804 - Add .eslintrc configuration file to components/. r=margaret → MozReview Request: Bug 1170804 - Add .eslintrc configuration file to mobile/android. r=margaret
Comment on attachment 8626031 [details] MozReview Request: Bug 1170804 - Fix bugs found by eslint in components/. r=margaret Bug 1170804 - Fix bugs found by eslint in components/. r=margaret A few errors still remain.
Margaret, one more: modules/WebappManagerWorker.js 13:0 error "onmessage" is not defined no-undef Should this just be let onmessage = ? Where is onmessage used?
Bug 1170804 - Get .jsm to work under eslint. r=margaret You can now run by `cd mobile/android && eslint . --ext "[.js,.jsm]"`.
Attachment #8626052 - Flags: review?(margaret.leibovic)
And for the jsms: modules/HelperApps.jsm 183:17 error "ContentAreaUtils" is not defined no-undef Again, from browser.js? modules/HomeProvider.jsm 208:10 error Illegal yield expression It just doesn't like generators. modules/MatchstickApp.jsm 245:16 error Unexpected token if A new expression type, probably. Not sure what to do here. modules/SharedPreferences.jsm 64:37 error "level" is not defined no-undef This actually seems undefined. modules/WebappManager.jsm 54:67 error Unexpected token for Another new syntax that it doesn't seem to recognize.
Bug 1170804 - Set non-final eslintrc for chrome/content. r=margaret Still a lot of errors but it's progress.
Attachment #8626200 - Flags: review?(margaret.leibovic)
Bug 1170804 - Add non-final eslintrc for tests/. r=margaret There are still some failures but it's a start.
Attachment #8626202 - Flags: review?(margaret.leibovic)
Comment on attachment 8626030 [details] MozReview Request: Bug 1170804 - Add .eslintrc configuration file to mobile/android. r=margaret https://reviewboard.mozilla.org/r/11977/#review10507 Ship It!
Attachment #8626030 - Flags: review?(margaret.leibovic) → review+
Comment on attachment 8626031 [details] MozReview Request: Bug 1170804 - Fix bugs found by eslint in components/. r=margaret https://reviewboard.mozilla.org/r/11979/#review10505 ::: mobile/android/components/PromptService.js:377 (Diff revision 2) > - return nsIAuthPrompt_loginPrompt(aTitle, aText, aPasswordRealm, aSavePassword, aUser, aPass); > + return this.nsIAuthPrompt_loginPrompt(aTitle, aText, aPasswordRealm, aSavePassword, aUser, aPass); /me facepalm ::: mobile/android/components/BlocklistPrompt.js:51 (Diff revision 2) > - addonList[i].item.disabled = true; > + aAddons[i].item.disabled = true; /me facepalm
Attachment #8626031 - Flags: review?(margaret.leibovic)
Attachment #8626052 - Flags: review?(margaret.leibovic)
Comment on attachment 8626052 [details] MozReview Request: Bug 1170804 - Get .jsm to work under eslint. r=margaret https://reviewboard.mozilla.org/r/11983/#review10509 ::: mobile/android/modules/Notifications.jsm:22 (Diff revision 1) > - this._when = (new Date).getTime(); > + this._when = (new Date()).getTime(); This actually does work, but yeah, better to be explicit here :)
Comment on attachment 8626200 [details] MozReview Request: Bug 1170804 - Set non-final eslintrc for chrome/content. r=margaret https://reviewboard.mozilla.org/r/11989/#review10511 Ship It!
Attachment #8626200 - Flags: review?(margaret.leibovic) → review+
Comment on attachment 8626202 [details] MozReview Request: Bug 1170804 - Add non-final eslintrc for tests/. r=margaret https://reviewboard.mozilla.org/r/11991/#review10513 Ship It!
Attachment #8626202 - Flags: review?(margaret.leibovic) → review+
Comment on attachment 8626031 [details] MozReview Request: Bug 1170804 - Fix bugs found by eslint in components/. r=margaret https://reviewboard.mozilla.org/r/11979/#review10517 Ship It!
Attachment #8626031 - Flags: review+
Comment on attachment 8626052 [details] MozReview Request: Bug 1170804 - Get .jsm to work under eslint. r=margaret https://reviewboard.mozilla.org/r/11983/#review10519 Ship It!
Attachment #8626052 - Flags: review+
(In reply to Michael Comella (:mcomella) from comment #5) > The remaining errors are: > > HelperAppDialog.js > 213:13 error "ContentAreaUtils" is not defined no-undef > > Is this inherited from browser.js? Yeah, looks like this was probably copy/pasted from browser.js, where we do define this: http://mxr.mozilla.org/mozilla-central/source/mobile/android/chrome/content/browser.js#374 But looking how HelperAppDialog.js is loaded, I don't think it loads in the global window context, so this is probably busted... we should file another bug about this to look into whether or not this logic works. Probably we just need to add this lazy getter definition. > PromptService.js > 399:60 error "aText" is not defined no-undef > 401:49 error "aText" is not defined no-undef > > I imagine aText is supposed to be in the method header, but I can't find the > idl definition. Looks like text should be a parameter here... http://mxr.mozilla.org/mozilla-central/source/netwerk/base/nsIAuthPrompt.idl#31 wesj, is there just a typo in here that we're missing an aText parameter? http://mxr.mozilla.org/mozilla-central/source/mobile/android/components/PromptService.js#384 > Snippets.js > 256:24 error Unexpected identifier > > I don't think it likes yield, but HelperAppDialog didn't have any issues. > > Any ideas, Margaret? Maybe because gStatsPath is a global defined in a lazy getter? http://mxr.mozilla.org/mozilla-central/source/mobile/android/components/Snippets.js#59
Flags: needinfo?(margaret.leibovic)
Flags: needinfo?(wjohnston)
(Moving request to bug 1177774)
Flags: needinfo?(wjohnston)
Product: Firefox for Android → Firefox Build System
Target Milestone: Firefox 41 → mozilla41
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: