react-codemirror2
react-codemirror2 copied to clipboard
Any example for using js-yaml to enable linting for yaml content?
I've been struggling with how to make js-yaml to work with my Codemirror component but no luck so far:
// const jsyaml = require("js-yaml"); // import * as jsyaml from "js-yaml"; window.jsyaml=jsyaml;
none of the two ways mentioned above to import the package work and I get the error jsyaml.loadAll is not a function
which shows it's not imported correctly, would appreciate any help.
I have looked at the entire internet and couldn't find an example, finally, managed to make it work, here is the the example:
https://codesandbox.io/s/react-codemirror-yaml-lint-5zhtk