-
Notifications
You must be signed in to change notification settings - Fork 16
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
feat(code-editor): lint and fold json #1818
Conversation
Documentation has been published to https://lundalogik.github.io/lime-elements/versions/PR-1818/ |
6d0a9e5
to
2a29195
Compare
Since we have gotten questions from users that didn't know that double vs single quotes matters in json I tried this This linter is technically correct and shows a parser error, for none developers it highlights the line before the error and says something incomprehensible? It took me several minutes just to understand Compared to vscode |
Prettier is able to autofix single-quotes in json: Link to Prettier playground for json Is there a Prettier-plugin for the code editor? Or could auto-fix be enabled for the linter that's added here? |
There's a formatting addon to codemirror but I haven't yet found a codemirror + prettier example but it should be doable: https://discuss.codemirror.net/t/formatting-the-code/2442/5 The question is how much all this will add to the lime-elements dist size; Will it be ok or too much? |
587f1a1
to
f18d8c7
Compare
This so cool @anderssonjohan 🥳 |
🎉 This PR is included in version 36.0.0-next.19 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@adrianschmidt @dorisenthecat The error caught by JSON.parse is actually better than the one from json-lint :/ |
I don't want any error message, I want it to be fixed automatically 😄 But yeah, in lieu of that, use the one that gives better error messages, of course! 👍 |
🎉 This PR is included in version 36.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Adds linting and folding support for JSON! 🎉
(needs tooltip CSS from @Kiarokh or @LucyChyzhova !)
Review:
Browsers tested:
(Check any that applies, it's ok to leave boxes unchecked if testing something didn't seem relevant.)
Windows:
Linux:
macOS:
Mobile: