Add rudimentary eslint support for XUL files

RESOLVED FIXED in Firefox 68

Status

enhancement
RESOLVED FIXED
3 months ago
2 months ago

People

(Reporter: Gijs, Assigned: Gijs)

Tracking

(Depends on 1 bug)

Trunk
mozilla68
Dependency tree / graph

Firefox Tracking Flags

(firefox68 fixed)

Details

Attachments

(2 attachments)

Assignee

Description

3 months ago

I recently landed broken JS in an onfoo inline event handler attribute. We should catch that type of mistake, like we do in HTML.

Assignee

Updated

3 months ago
Depends on: 1537630
Assignee

Comment 1

3 months ago

I'm deliberately proposing a pretty rudimentary patch. It solves some of the more annoying problems (like preprocessing) but doesn't address inline <script>s, and just turns off no-undef for XUL files to avoid having to do global processing. If we want to fix either of those things we can do so in follow-ups, I think.

This generally works OK, and found a few minor issues. I also verified it correctly flagged up the issue from bug 1536514 if reintroduced. The main issue I'm aware of is that we have no column information, and line information is restricted to the closing '>' of the node in which an attribute occurs (which can be confusing if the attribute is not on that line). Unfortunately, it doesn't seem like sax.js provides the information we need to do better here.

I also have to admit that although line numbers are correct in every other file I've tried, in browser.xul they seem to be slightly off in some cases. I haven't been able to figure out why exactly (possibly something to do with the gazillion (and nested) includes), but IMO that doesn't need to block this landing given that, when modifying code, it should be fairly obvious where any new issues are anyway.

Severity: normal → enhancement
Assignee

Updated

3 months ago
Status: NEW → ASSIGNED

Comment 4

2 months ago
Pushed by gijskruitbosch@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/f88912387010
fix various minor eslint issues in XUL files, r=Standard8
https://hg.mozilla.org/integration/autoland/rev/3bf1176d151b
add rudimentary support for linting XUL files, r=Standard8

Comment 5

2 months ago
bugherder
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
Depends on: 1542548
You need to log in before you can comment on or make changes to this bug.