Skip to content

Commit

Permalink
ESLintBear: Show errors shown in stderr
Browse files Browse the repository at this point in the history
In some cases, eslint fails. Because of this, the user can't see any
results, nor does the user see any warning that it failed. We now show
the stderr to the user as a WARNING.

Fixes #730
  • Loading branch information
AbdealiLoKo committed Sep 3, 2016
1 parent 3464701 commit dcca236
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions bears/js/ESLintBear.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@


@linter(executable='eslint',
use_stdin=True)
use_stdin=True,
use_stderr=True)
class ESLintBear:
"""
Check JavaScript and JSX code for style issues and semantic errors.
Expand Down Expand Up @@ -48,10 +49,15 @@ def generate_config(filename, file):
return '{"extends": "eslint:recommended"}'

def process_output(self, output, filename, file):
if not file or not output:
if output[1]:
self.warn("While running {0}, some issues were found:"
.format(self.__class__.__name__))
self.warn(output[1])

if not file or not output[0]:
return

output = json.loads(output)
output = json.loads(output[0])
lines = "".join(file)

assert len(output) == 1
Expand Down

0 comments on commit dcca236

Please sign in to comment.