【发布时间】:2026-02-11 03:15:01
【问题描述】:
我正在为 JSON 组合一个快速的 CodeMirror 输入并确保用户不会搞砸,我正在使用 json-lint 插件。我的问题是,在呈现空 CodeMirror 输入时立即显示 lint 错误。我知道空输入不构成有效的 JSON,但我希望它仅在输入完成后运行。
我正在使用 addon/lint/json-lint.js 插件,而后者又使用 jsonlint 包。
JS
var jsonConfig = {
mode: 'application/json',
lineNumbers: true,
lint: true,
autoCloseBrackets: true,
gutters: ['CodeMirror-lint-markers']
};
$('.json textarea').each(function (pos, el) {
CodeMirror.fromTextArea(el, jsonConfig);
});
我在文档中看不到任何内容来禁用空输入的 linting。我错过了一些简单的东西吗?
【问题讨论】:
标签: javascript codemirror jsonlint ui-codemirror