Closed Bug 1338249 Opened 7 years ago Closed 7 years ago

Improve eslint-plugin-mozilla's handling of workers when dealing with globals and imports

Categories

(Developer Infrastructure :: Lint and Formatting, defect)

3 Branch
defect
Not set
normal

Tracking

(firefox54 fixed)

RESOLVED FIXED
mozilla54
Tracking Status
firefox54 --- fixed

People

(Reporter: standard8, Assigned: standard8)

References

Details

Attachments

(1 file)

There's a couple of things wrong with the current handling for workers:

- It doesn't correctly detect globals from modules
- It doesn't have an option if a worker doesn't have 'worker' in its filename.

In the patch I'm addressing, I'm also dealing with some files imported into workers as modules.
Blocks: 1338195
Comment on attachment 8835617 [details]
Bug 1338249 - Improve eslint-plugin-mozilla's handling of workers when dealing with globals and imports.

https://reviewboard.mozilla.org/r/111292/#review113510

Rather than using /* eslint-is-worker */ can we just create our own environment for workers then use /* eslint-env worker */ ?
http://eslint.org/docs/developer-guide/working-with-plugins#environments-in-plugins
Attachment #8835617 - Flags: review?(dtownsend)
I hadn't noticed the environments option, but that's definitely a lot better. I also discovered there's already a "worker" environment, so extending that for chrome workers seems the good option.
Comment on attachment 8835617 [details]
Bug 1338249 - Improve eslint-plugin-mozilla's handling of workers when dealing with globals and imports.

https://reviewboard.mozilla.org/r/111292/#review113876

::: tools/lint/eslint/eslint-plugin-mozilla/package.json:3
(Diff revision 2)
>  {
>    "name": "eslint-plugin-mozilla",
>    "version": "0.2.20",

Do we still need to bump the version number here?
Attachment #8835617 - Flags: review?(dtownsend) → review+
Comment on attachment 8835617 [details]
Bug 1338249 - Improve eslint-plugin-mozilla's handling of workers when dealing with globals and imports.

https://reviewboard.mozilla.org/r/111292/#review113880

::: tools/lint/eslint/eslint-plugin-mozilla/package.json:3
(Diff revision 2)
>  {
>    "name": "eslint-plugin-mozilla",
>    "version": "0.2.20",

Yes, please bump the version to force local users to update on next run.
Comment on attachment 8835617 [details]
Bug 1338249 - Improve eslint-plugin-mozilla's handling of workers when dealing with globals and imports.

https://reviewboard.mozilla.org/r/111292/#review113876

> Do we still need to bump the version number here?

Yes, that got lost in a rebase unfortunately. I'll add it back in.
Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/03bfb1ccd33f
Improve eslint-plugin-mozilla's handling of workers when dealing with globals and imports. r=mossop
sorry had to back this out for test failures like https://treeherder.mozilla.org/logviewer.html#?job_id=77590058&repo=autoland
Flags: needinfo?(standard8)
Backout by cbook@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/dee6c94829e4
Backed out changeset 03bfb1ccd33f for test failures in test_loading.xul
The test failures were due to the test expecting failures on specific line numbers, adding an eslint comment affected those.

Hence I'm updating the test for the new line numbers, and adding a comment to warn others.
Flags: needinfo?(standard8)
Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/49c83f6481dc
Improve eslint-plugin-mozilla's handling of workers when dealing with globals and imports. r=mossop
https://hg.mozilla.org/mozilla-central/rev/49c83f6481dc
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
Product: Testing → Firefox Build System
Version: Version 3 → 3 Branch
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: