Enable yaml linting in codemirror

1.8k views Asked by At

I want to enable linting for yaml in code mirror but even after adding lint:true I am unable to see linting for yaml, the same works fine for other language like JavaScript.

2

There are 2 answers

0
jcbp On

According to the documentation, CodeMirror doesn't come with a built-in linter for yaml. It only supports the following modes: html, json, javascript, coffeescript and css.

https://codemirror.net/5/doc/manual.html#addons (lint section).

0
Mike Twc On

Yaml linter should work. It just depends on js-yaml library https://github.com/nodeca/js-yaml

Portainer is the app which uses it, here is their codemirror service example you can follow (after you added js-yaml)

https://github.com/portainer/portainer/blob/develop/app/portainer/services/codeMirror.js