Closed Bug 1229224 Opened 9 years ago Closed 8 years ago

Make all mozilla plugins use the same methods for finding global variables and add a way to get globals from browser.js

Categories

(Testing :: General, defect)

defect
Not set
normal

Tracking

(firefox46 fixed)

RESOLVED FIXED
mozilla46
Tracking Status
firefox46 --- fixed

People

(Reporter: mossop, Assigned: mossop)

References

Details

Attachments

(3 files, 1 obsolete file)

I found the components-imports not to be quite good enough for the various ways we define properties so I've forked it to something a little more complex. It checks that the scope you're importing to is the global for most cases (the only kind of variable that need to be declared I think).

Also fixed the way that helpers declares variables in scope.
Bug 1229224: Add eslint plugin for various ways to declare properties on the global object and enable globally. r?pbro
Attachment #8693881 - Flags: review?(pbrosset)
Comment on attachment 8693881 [details]
MozReview Request: Bug 1229224: Add eslint plugin for various ways to declare properties on the global object and enable globally. r?miker

I think Mike should review this instead (I haven't found a way to edit the reviewer in mozreview, so I'm doing it here only).
Attachment #8693881 - Flags: review?(pbrosset) → review?(mratcliffe)
Comment on attachment 8693881 [details]
MozReview Request: Bug 1229224: Add eslint plugin for various ways to declare properties on the global object and enable globally. r?miker

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/26611/diff/1-2/
Attachment #8693881 - Attachment description: MozReview Request: Bug 1229224: Add eslint plugin for various ways to declare properties on the global object and enable globally. r?pbro → MozReview Request: Bug 1229224: Add eslint plugin for various ways to declare properties on the global object and enable globally. r?mratcliffe
Attachment #8693881 - Flags: review?(mratcliffe) → review?(pbrosset)
Attachment #8693881 - Flags: review?(pbrosset) → review?(mratcliffe)
Comment on attachment 8693881 [details]
MozReview Request: Bug 1229224: Add eslint plugin for various ways to declare properties on the global object and enable globally. r?miker

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/26611/diff/2-3/
Attachment #8693881 - Attachment description: MozReview Request: Bug 1229224: Add eslint plugin for various ways to declare properties on the global object and enable globally. r?mratcliffe → MozReview Request: Bug 1229224: Add eslint plugin for various ways to declare properties on the global object and enable globally. r?miker
Blocks: eslint
See also bug 1229911.
This patch will need a small tweak if that happens to go in first.
Comment on attachment 8693881 [details]
MozReview Request: Bug 1229224: Add eslint plugin for various ways to declare properties on the global object and enable globally. r?miker

Want to tinker with this some more
Attachment #8693881 - Flags: review?(mratcliffe)
Attachment #8693881 - Attachment is obsolete: true
Blocks: 1229142
Summary: Add eslint plugin to support Object.defineProperty etc. → Make all mozilla plugins use the same methods for finding global variables and add a way to get globals from browser.js
Comment on attachment 8700055 [details]
MozReview Request: Bug 1229224: Fix linting for some browser files that tests depend on. r=felipe

https://reviewboard.mozilla.org/r/28543/#review25375

::: browser/base/content/browser-social.js:1363
(Diff revision 1)
> -    [m.parentNode.removeChild(m) for (m of menus)];
> +      m.parentNode.removeChild(m);

I was probably doing something dumb at the time, but I tried fixing this file and made this change before, and there was a test that was failing it, and I couldn't figure out why.. So, just a heads up. I think it was browser_social_marks.js but I'm not 100% sure.

Anyway, now that this file is fixed, can you remove it from the exclusion list in .eslintignore?
Attachment #8700055 - Flags: review?(felipc) → review+
https://reviewboard.mozilla.org/r/28547/#review25381

It would be nice if this rule could also be activated with a comment tag (like import-globals-from does), so that we can use it for browser.js and these listed scripts themselves too, and not only for tests.  Or maybe you're already thinking of a different way to deal with the undeclared vars on those files?
https://reviewboard.mozilla.org/r/28547/#review25381

You can activate any eslint rule with a comment tag already, /* eslint mozilla/import-browserjs-globals: 2 */
Comment on attachment 8700056 [details]
MozReview Request: Bug 1229224: Support more forms of defining globals and make anywhere we import scripts use them too. r=miker

https://reviewboard.mozilla.org/r/28545/#review25487

Awesome, I really like estraverse... nice find!
Attachment #8700056 - Flags: review?(mratcliffe) → review+
Comment on attachment 8700057 [details]
MozReview Request: Bug 1229224: Add an eslint plugin for importing all browser.js globals for browser-chrome tests. r=miker

https://reviewboard.mozilla.org/r/28547/#review25489

::: testing/eslint-plugin-mozilla/lib/index.js:34
(Diff revision 1)
>      "import-headjs-globals": 0,

Nit: You should probably include `"import-browserjs-globals": 0,` here as this is where we set defaults.
Attachment #8700057 - Flags: review?(mratcliffe) → review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: