Closed
Bug 1456762
Opened 8 years ago
Closed 8 years ago
Attempt to improve ESLint handling for globals in html files
Categories
(Developer Infrastructure :: Lint and Formatting, enhancement, P2)
Tracking
(firefox62 fixed)
RESOLVED
FIXED
mozilla62
| Tracking | Status | |
|---|---|---|
| firefox62 | --- | fixed |
People
(Reporter: standard8, Assigned: standard8)
References
Details
Attachments
(2 files)
Although we are currently using the html plugin for ESLint to parse our html files (mainly chrome tests), it is very hard currently to determine the globals used as we don't know the files that are imported via script tags.
To get around this, we currently have to manually specify import-globals-from.
I think we can make this better. I've opened a request with eslint-plugin-html to see if we can get the script tags inserted as comments into the javascript it generates. We should then be able to pick these up and process them.
Unfortunately as eslint-plugin-html is a processor, the rules don't have access to the original source to get this by themselves.
https://github.com/BenoitZugmeyer/eslint-plugin-html/issues/94
| Assignee | ||
Comment 1•8 years ago
|
||
Thanks to a suggestion from BenoitZugmeyer, I've realised that we can use `context.getFilename()` to get the file name, and then do a quick scan for any script tags.
I've got a patch more or less working for this now, so will hopefully post something soon.
| Assignee | ||
Comment 2•8 years ago
|
||
I've used htmlparser2 for scanning for the script tags. More reliable than a regexp, and eslint-plugin-html uses it anyway so we aren't including any more packages.
Try push is here: https://treeherder.mozilla.org/#/jobs?repo=try&revision=b181e94f43e2f4d213d89527b373010cc54a402f
Comment 3•8 years ago
|
||
MozReview-Commit-ID: 6jiEbZnyv6e
Comment 4•8 years ago
|
||
Depends on D1643
MozReview-Commit-ID: 84M50HDg0wl
Comment 5•8 years ago
|
||
Comment on attachment 8985144 [details]
Bug 1456762 - Add parsing of HTML files to ESLint to discover their script tags and the globals that are imported.
Dave Townsend [:mossop] has approved the revision.
https://phabricator.services.mozilla.com/D1643
Attachment #8985144 -
Flags: review+
Comment 6•8 years ago
|
||
Comment on attachment 8985145 [details]
Bug 1456762 - Remove now unnecessary import-globals-from statements in html files.
Dave Townsend [:mossop] has approved the revision.
https://phabricator.services.mozilla.com/D1644
Attachment #8985145 -
Flags: review+
Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/70bab1329de0
Add parsing of HTML files to ESLint to discover their script tags and the globals that are imported. r=mossop
Comment 8•8 years ago
|
||
| bugherder | ||
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox62:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
| Assignee | ||
Comment 9•8 years ago
|
||
Reopening so that I can hopefully land the second part if phabricator will now let me...
| Assignee | ||
Updated•8 years ago
|
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment 10•8 years ago
|
||
Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1bc876a7147b
Remove now unnecessary import-globals-from statements in html files. r=mossop
Comment 11•8 years ago
|
||
| bugherder | ||
Status: REOPENED → RESOLVED
Closed: 8 years ago → 8 years ago
Resolution: --- → FIXED
| Assignee | ||
Updated•8 years ago
|
Summary: Attempt to improve handling for globals in html files → Attempt to improve ESLint handling for globals in html files
Updated•7 years ago
|
Version: Version 3 → 3 Branch
Updated•3 years ago
|
Product: Firefox Build System → Developer Infrastructure
You need to log in
before you can comment on or make changes to this bug.
Description
•