From 578e912faff0673fef345f742be22a8f4de497c5 Mon Sep 17 00:00:00 2001 From: pooja-bruno Date: Tue, 25 Mar 2025 19:44:22 +0530 Subject: [PATCH] fix: codemirror lint errors (#4321) * fix: codemirror lint errors * chore: added comments for await lint fix and removed the indent config prop that was not needed --------- Co-authored-by: Anoop M D --- .../src/utils/codemirror/javascript-lint.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/bruno-app/src/utils/codemirror/javascript-lint.js b/packages/bruno-app/src/utils/codemirror/javascript-lint.js index ec612e5f9..371fd2a30 100644 --- a/packages/bruno-app/src/utils/codemirror/javascript-lint.js +++ b/packages/bruno-app/src/utils/codemirror/javascript-lint.js @@ -28,12 +28,16 @@ if (!SERVER_RENDERED) { undef: true, browser: true, devel: true, + module: true, + node: true, predef: { 'bru': false, 'req': false, 'res': false, 'test': false, - 'expect': false + 'expect': false, + 'require': false, + 'module': false } }; @@ -51,15 +55,19 @@ if (!SERVER_RENDERED) { * Filter out errors due to top level awaits * See https://github.com/usebruno/bruno/issues/1214 * + * - E058: Missing semicolon at top level await + * codemirror error: "Missing semicolon." + * - W024: 'await' used as identifier (JSHint doesn't recognize top-level await syntax) + * codemirror error: "Expected an identifier and instead saw 'await' (a reserved word)." + * * Once JSHINT top level await support is added, this file can be removed * and we can use the default javascript-lint addon from codemirror */ errors = filter(errors, (error) => { - if (error.code === 'E058') { + if (error.code === 'E058' || error.code === 'W024') { if ( error.evidence && error.evidence.includes('await') && - error.reason === 'Missing semicolon.' && error.scope === '(main)' ) { return false;