react-codemirror2 icon indicating copy to clipboard operation
react-codemirror2 copied to clipboard

Any example for using js-yaml to enable linting for yaml content?

Open mkamrani opened this issue 3 years ago • 1 comments

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.

mkamrani avatar Apr 04 '21 00:04 mkamrani

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

royhadad avatar Nov 28 '21 13:11 royhadad