From 69c8b42c5319921d000e12740e65664268efd347 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Wed, 19 Jun 2024 12:10:30 +0100 Subject: [PATCH] Ignore specific warnings/errors - even after new versions of JSHINT they still come up and can't be disabled: fix #298 --- js/core/editorJavaScript.js | 2 +- js/libs/codemirror/addon/lint/javascript-lint.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/js/core/editorJavaScript.js b/js/core/editorJavaScript.js index 87b9d0d0..2d4fec52 100644 --- a/js/core/editorJavaScript.js +++ b/js/core/editorJavaScript.js @@ -13,7 +13,7 @@ (function(){ var editors = []; var id = 0; // auto-incrementing ID used for codeMirror elements - var defaultLintFlags = { + var defaultLintFlags = { // https://jshint.com/docs/options/ esversion : 6, // Enable ES6 for literals, arrow fns, binary evil : true, // don't warn on use of strings in setInterval laxbreak : true, // don't warn about newlines in expressions diff --git a/js/libs/codemirror/addon/lint/javascript-lint.js b/js/libs/codemirror/addon/lint/javascript-lint.js index cc132d7f..aa568c76 100644 --- a/js/libs/codemirror/addon/lint/javascript-lint.js +++ b/js/libs/codemirror/addon/lint/javascript-lint.js @@ -33,6 +33,9 @@ for ( var i = 0; i < errors.length; i++) { var error = errors[i]; if (error) { + if (error.a == 'nullish coalescing') continue; // ignore these warnings - we don't want to enable all ES11 just to disable this + if (error.code == "E054") continue; // Class properties must be methods (no way to ignore otherwise?) #298 + if (error.line <= 0) { if (window.console) { window.console.warn("Cannot display JSHint error (invalid line " + error.line + ")", error);