Disable JSHint warnings in CodeMirror

I thought it would be a trivial question, but I did a ton of search and could not find anything.

I have a CodeMirror div that turns on. I have included JSHint.js, which works correctly; syntax errors and warnings appear in my CodeMirror editor. However, I need to disable some warnings (most importantly, I want to allow keys without quotes).

Where can I pass in preferences or turn off JSHint warnings so that they display only those problems that I really care about?

Or, alternatively, is there an alternative to JSHint that allows more configuration (and can be used with the CodeMirror framework)?

+4
source share
3 answers

You should be able to set JSHint-specific parameters directly in the object that you use as the value of the "lint" CodeMirror option.

+1
source
codemirror.setOption('lint', { options: { bitwise: true }});
0
source

Just set lint = false when initializing the codemirror instance

var editorSettings = CodeMirror.defaults;   
editorSettings.codemirror.lint = false;
var myCodeMirror = CodeMirror(document.body, editorSettings);

In Wordpress 4. 9+:

var editorSettings = wp.codeEditor.defaultSettings;
editorSettings.codemirror.lint = false;
var editor = wp.codeEditor.initialize( $('#whatever'), editorSettings);
0
source

Source: https://habr.com/ru/post/1545983/


All Articles