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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON linting in the code editor #605

Merged
merged 2 commits into from
Feb 25, 2020

Conversation

AndrewBastin
Copy link
Member

This PR intends to add the ability for the Ace Code Editor to provide linting for JSON files in Postwoman.

You can try out the linter through any editor instance that specifies JSON as the language (so basically the GraphQL variable editor and the POST request content editor (when content type is set to application/json)).

@AndrewBastin AndrewBastin added the feature New feature or request label Feb 25, 2020
@AndrewBastin AndrewBastin self-assigned this Feb 25, 2020
@ghost
Copy link

ghost commented Feb 25, 2020

DeepCode's analysis on #b9b074 found:

  • 0 critical issues. ⚠️ 0 warnings and 2 minor issues. ✔️ 0 issues were fixed.

💬 This comment has been generated by the DeepCode bot, installed by the owner of the repository. The DeepCode bot protects your repository by detecting and commenting on security vulnerabilities or other critical issues.


☺️ If you want to provide feedback on our bot, here is how to contact us.

@TravisBuddy
Copy link

Hey @AndrewBastin,
Something went wrong with the build.

TravisCI finished with status errored, which means the build failed because of something unrelated to the tests, such as a problem with a dependency or the build process itself.

View build log

TravisBuddy Request Identifier: e809c5a0-57f5-11ea-acab-ef795e2c3319

@TravisBuddy
Copy link

Hey @AndrewBastin,
Your changes look good to me!

View build log

TravisBuddy Request Identifier: de1cab40-5820-11ea-acab-ef795e2c3319

@AndrewBastin AndrewBastin merged commit 711cabc into hoppscotch:master Feb 25, 2020
@dihmeetree
Copy link
Contributor

dihmeetree commented Feb 26, 2020

@AndrewBastin @liyasthomas I've introduced a new prop to the Ace Editor component (<Editor />). You can specify a lint prop like <Editor :lint="false" /> and it will disable linting for that editor. The reason for this was because the response box on the GraphQL page is supplied with :lang="'json'". However when the runQuery function is run .. it updates the response box to regular text Loading... (which isn't json), thus showing a linting error.

While the runQuery function should return json, we shouldn't run any linting on it anyways as the data is coming from an external data source. (Plus; they can't edit the content in the response box)

This lint prop may come in handy for other editor boxes in the future, so I think it's a decent addition. 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants