Skip to content

Commit 72d111f

Browse files
committed
Pretend ' ' for empty views
eslint < 4.10.0 has a bug where it shows its CLI usage info when we send the empty string via stdin. The solution here is to send one space instead. Tested with the 'no-trailing-spaces' rule to not mark as an error for such cases. Proper version branching is maybe over-engineering, and left as exercise for the reader. Another solution would be to just check the configuration bc empty views usually cannot have lint errors. This *could* be done via `eslint --print-config .`
1 parent e724c43 commit 72d111f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

linter.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,11 @@ def reposition_match(self, line, col, m, vv):
9898
end_column += len(text)
9999

100100
return line, col, end_column
101+
102+
def run(self, cmd, code):
103+
# Workaround eslint bug https://github.com/eslint/eslint/issues/9515
104+
# Fixed in eslint 4.10.0
105+
if code == '':
106+
code = ' '
107+
108+
return super().run(cmd, code)

0 commit comments

Comments
 (0)