Closed Bug 1217851 Opened 9 years ago Closed 9 years ago

eslint custom rule import-headjs-globals.js does not work on windows

Categories

(DevTools :: General, defect)

Unspecified
Windows 10
defect
Not set
normal

Tracking

(firefox44 fixed)

RESOLVED FIXED
Firefox 44
Tracking Status
firefox44 --- fixed

People

(Reporter: pbro, Assigned: miker)

References

Details

Attachments

(1 obsolete file)

This rule lives in:
eslint-plugin-mozilla\lib\rules\import-headjs-globals.js

It's enabled in the devtools .eslintrc file.

Its job is to check if the file name is browser_*.js and if yes, locate the nearest head.js and import all globals from there so that eslint later doesn't complain about using undefined things when linting the test.

Turns out the way the rule is implemented doesn't work on Windows.

var isTest = /.*\/browser_.+\.js$/.test(pathAndFilename);

There's an assumption in the regex that path separators are forward slashes /
Just removing this character from the regex makes it work on Windows.
Assignee: nobody → mratcliffe
See Also: → 1217922
Bug 1217851 - Fix mozplugin's import-headjs-globals on Windows r?=pbro
Attachment #8678815 - Flags: review?(pbrosset)
We shouldn't remove the slash altogether as that would cause new errors. This patch simply changes this regex:
/.*\/browser_.+\.js$/

To this:
/.*[\\/]browser_.+\.js$/

Tests just fine on both osx and Win 10
Attachment #8678815 - Flags: review?(pbrosset) → review+
Comment on attachment 8678815 [details]
MozReview Request: Bug 1217851 - Fix mozplugin's import-headjs-globals on Windows r?=pbro

https://reviewboard.mozilla.org/r/23253/#review20725

Thanks!
https://hg.mozilla.org/mozilla-central/rev/10533587f045
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 44
Attachment #8678815 - Attachment is obsolete: true
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: