Skip to content

Commit 59773b9

Browse files
committed
handle errors with no ESLint rule reference
1 parent 4a19b74 commit 59773b9

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

Support/content.ejs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@
6767
<% } %>
6868
<a href="<%= issue.url %>">at line <%= issue.line %> position <%= issue.character %></a>
6969
<div><tt>
70-
<%= issue.reason %> (<a href="http://eslint.org/docs/rules/<%= issue.shortname %>.html" class="open-external"><%= issue.shortname %></a>)
70+
<%= issue.reason %>
71+
<% if (issue.shortname) { %>
72+
(<a href="http://eslint.org/docs/rules/<%= issue.shortname %>.html" class="open-external"><%= issue.shortname %></a>)
73+
<% } %>
7174
</tt></div>
7275
</li>
7376
<% } %>

Support/validate.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,10 @@ def validate(quiet=False):
294294
sys.exit()
295295

296296
# parse the results
297-
rx = re.compile('^[^:]+\: line (?P<line>\d+), col (?P<character>\d+), ' +
298-
'(?P<code>\w+) - (?P<reason>.+) \((?P<shortname>\w+)\)$')
297+
298+
rx = re.compile('^[^:]+\\: line (?P<line>\\d+), ' +
299+
'col (?P<character>\\d+), ' +
300+
'(?P<code>\\w+) - (?P<reason>.+)\\s?(\\((?P<shortname>\\w+)\\))?$')
299301

300302
issues = []
301303

@@ -313,10 +315,12 @@ def validate(quiet=False):
313315
'line': int(m.group('line')),
314316
'character': int(m.group('character')) + 1,
315317
'code': m.group('code'),
316-
'reason': m.group('reason'),
317-
'shortname': m.group('shortname')
318+
'reason': m.group('reason')
318319
}
319320

321+
if m.group('shortname'):
322+
issue['shortname'] = m.group('shortname')
323+
320324
issues.append(issue)
321325

322326
# normalize line numbers

0 commit comments

Comments
 (0)