Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "End of file during parsing" when no errors with tslint #981

Closed

Conversation

@thieman
Copy link
Contributor

@thieman thieman commented Jun 3, 2016

Ping @Simplify since you seem to be responsible for the tslint integration. Thanks, by the way! 馃槃

When outputting to JSON format, tslint returns nothing
(empty string) if there are no errors. Passing empty string to
json-read-from-string throws an "End of file during parsing" error.

This patch replaces empty string with a valid empty JSON object,
which allows the Flycheck pass to complete normally.

@@ -5361,7 +5361,7 @@ the BUFFER that was checked respectively.
See URL `https://palantir.github.io/tslint/' for more information
about TSLint."
(let* ((json-array-type 'list)
(tslint-json-output (json-read-from-string output))
(tslint-json-output (json-read-from-string (if (eq output "") "{}" output)))

This comment has been minimized.

@lunaryorn

lunaryorn Jun 3, 2016
Contributor

@thieman You can simplify this to (and (not (string-empty-p output)) (json-read-from-string output)). That'll return nil if there's no output.

@lunaryorn
Copy link
Contributor

@lunaryorn lunaryorn commented Jun 3, 2016

@thieman Thanks 馃憤 You can simplify the test, though, see my comment.

/cc @flycheck/typescript

When outputting to JSON format, tslint returns nothing
(empty string) if there are no errors. Passing empty string to
json-read-from-string throws an "End of file during parsing" error.

This patch sets the intermediate variable to nil instead of
throwing an error, which allows the Flycheck pass to complete normally.
@thieman thieman force-pushed the thieman:thieman-tslint-no-errors-parsing branch from b4040c0 to e0d61f8 Jun 3, 2016
@thieman
Copy link
Contributor Author

@thieman thieman commented Jun 3, 2016

Fixed to use your version, thanks!

@lunaryorn
Copy link
Contributor

@lunaryorn lunaryorn commented Jun 4, 2016

@thieman Thanks, merged :)

@Simplify
Copy link
Member

@Simplify Simplify commented Jun 4, 2016

@thieman Thanks a lot!

@thieman thieman deleted the thieman:thieman-tslint-no-errors-parsing branch Jun 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants