From 1b499993be57d870cd71f8adecdb8a1987d4eb43 Mon Sep 17 00:00:00 2001 From: "vivi-the-going-merry[bot]" <308115520+vivi-the-going-merry[bot]@users.noreply.github.com> Date: Fri, 18 Sep 2026 16:17:21 -0600 Subject: [PATCH] Suppress 9 pre-existing sonarjs ESLint/DeepSource errors Inline eslint-disable-next-line at each flagged site (jQuery.inArray and pre-existing regex usages), per triage decision to suppress rather than refactor. Underlying jQuery/regex code unchanged. One site listed in the issue as js/formidable.js:2549 is actually js/src/admin/admin.js:2549 (re-verified all 9 line numbers against a standalone eslint + eslint-plugin-sonarjs run, not the issue's snapshot numbers). Co-Authored-By: Claude Sonnet 5 --- js/admin/legacy-views.js | 2 ++ js/admin/style.js | 1 + js/formidable.js | 2 ++ js/src/admin/admin.js | 3 +++ js/src/admin/styles.js | 1 + 5 files changed, 9 insertions(+) diff --git a/js/admin/legacy-views.js b/js/admin/legacy-views.js index 3cd0d7cbd7..fc2b256524 100644 --- a/js/admin/legacy-views.js +++ b/js/admin/legacy-views.js @@ -395,9 +395,11 @@ 'dyn_default_value' ]; + // eslint-disable-next-line sonarjs/prefer-native-jquery-alternative -- jQuery API kept, not refactored if ( jQuery.inArray( id, a ) >= 0 ) { jQuery( '.frm_code_list a' ).removeClass( 'frm_noallow' ).addClass( 'frm_allow' ); jQuery( `.frm_code_list a.hide_${ id }` ).addClass( 'frm_noallow' ).removeClass( 'frm_allow' ); + // eslint-disable-next-line sonarjs/prefer-native-jquery-alternative -- jQuery API kept, not refactored } else if ( jQuery.inArray( id, b ) >= 0 ) { jQuery( `.frm_code_list:not(.frm-dropdown-menu) a:not(.show_${ id })` ).addClass( 'frm_noallow' ).removeClass( 'frm_allow' ); jQuery( `.frm_code_list a.show_${ id }` ).removeClass( 'frm_noallow' ).addClass( 'frm_allow' ); diff --git a/js/admin/style.js b/js/admin/style.js index 7cb6e49212..f03ccf6a4f 100644 --- a/js/admin/style.js +++ b/js/admin/style.js @@ -1235,6 +1235,7 @@ * @return {void} */ function syncEditPageAfterResetAction( response ) { + // eslint-disable-next-line sonarjs/super-linear-regex -- regex kept as-is, not refactored let defaultValues = response.replace( /^\s+|\s+$/g, '' ); if ( defaultValues.indexOf( '{' ) === 0 ) { defaultValues = JSON.parse( defaultValues ); diff --git a/js/formidable.js b/js/formidable.js index 41c018a4bd..c3bff8c767 100644 --- a/js/formidable.js +++ b/js/formidable.js @@ -893,6 +893,7 @@ function frmFrontFormJS() { response = defaultResponse; } else { // Response is a string. Convert it to an object. + // eslint-disable-next-line sonarjs/super-linear-regex -- regex kept as-is, not refactored response = response.replace( /^\s+|\s+$/g, '' ); if ( response.indexOf( '{' ) === 0 ) { response = JSON.parse( response ); @@ -2284,6 +2285,7 @@ function frmFrontFormJS() { : price.split( options.decimal_separator ); if ( options.thousand_separator ) { + // eslint-disable-next-line sonarjs/super-linear-regex -- regex kept as-is, not refactored split[ 0 ] = split[ 0 ].replace( /\B(?=(\d{3})+(?!\d))/g, options.thousand_separator ); } diff --git a/js/src/admin/admin.js b/js/src/admin/admin.js index 9dc78d46f8..75b4060aeb 100644 --- a/js/src/admin/admin.js +++ b/js/src/admin/admin.js @@ -2546,6 +2546,7 @@ window.frmAdminBuildJS = function() { function handleAjaxLoadFieldSuccess( response ) { let key; + // eslint-disable-next-line sonarjs/super-linear-regex -- regex kept as-is, not refactored response = response.replace( /^\s+|\s+$/g, '' ); if ( response.indexOf( '{' ) !== 0 ) { jQuery( '.frm_load_now' ).removeClass( '.frm_load_now' ).html( 'Error' ); @@ -9649,6 +9650,7 @@ window.frmAdminBuildJS = function() { } const htmlFieldIds = [ 'after_html', 'before_html', 'submit_html', 'field_custom_html' ]; + // eslint-disable-next-line sonarjs/prefer-native-jquery-alternative -- jQuery API kept, not refactored if ( jQuery.inArray( id, htmlFieldIds ) >= 0 ) { jQuery( `.frm_code_list li:not(.show_${ id })` ).addClass( 'frm_hidden' ); jQuery( `.frm_code_list li.show_${ id }` ).removeClass( 'frm_hidden' ); @@ -10508,6 +10510,7 @@ window.frmAdminBuildJS = function() { const input = formData[ i ]; let key = input.name; const { value } = input; + // eslint-disable-next-line sonarjs/super-linear-regex -- regex kept as-is, not refactored const names = key.match( /(.*)\[(.*)\]/ ); if ( ( input.type === 'radio' || input.type === 'checkbox' ) && ! input.checked ) { diff --git a/js/src/admin/styles.js b/js/src/admin/styles.js index 174acd0220..3a469ba65f 100644 --- a/js/src/admin/styles.js +++ b/js/src/admin/styles.js @@ -80,6 +80,7 @@ class frmStyleOptions { const sanitizedCssScope = CSS.escape( cssScope ); this.cssEditorInstance.on( 'change', editor => { + // eslint-disable-next-line sonarjs/super-linear-regex -- regex kept as-is, not refactored const value = editor.getValue().replace( /<[^>]*>/g, '' ).trim(); this.getInlineStyleElement().textContent = `.${ sanitizedCssScope } { ${ value } }`; } );