@@ -594,8 +594,8 @@ describe('gRPC server', () => {
594594 expect ( responseNoTrigger . issues ?. length ) . toBe ( 0 ) ;
595595 } ) ;
596596
597- it ( 'should handle rule with customForConfiguration and customDefault (S1441 — quotes)' , async ( ) => {
598- // S1441 has customDefault: true and customForConfiguration: `value ? "single" : "double"`
597+ it ( 'should handle rule with customForConfiguration (S1441 — quotes)' , async ( ) => {
598+ // S1441 has default: 'single' and customForConfiguration handling SQ values 'true'/'false'.
599599 // When SQ sends singleQuotes='true', it should be transformed to 'single' for ESLint
600600 const content = 'const x = "hello";\n' ;
601601
@@ -633,9 +633,9 @@ describe('gRPC server', () => {
633633 expect ( responseNoTrigger . issues ?. length ) . toBe ( 0 ) ;
634634 } ) ;
635635
636- it ( 'should handle customDefault with number field in object config (S6418 — hard-coded secrets)' , async ( ) => {
637- // S6418 config.ts has randomnessSensibility with default: 5 (number) and customDefault: '5.0' (string for Java) .
638- // The gRPC path should parse 'randomnessSensibility' as a number (from default: 5) .
636+ it ( 'should handle number field in object config (S6418 — hard-coded secrets)' , async ( ) => {
637+ // S6418 config.ts has randomnessSensibility with numeric default: 5.
638+ // The gRPC path should parse 'randomnessSensibility' as number.
639639 // Also tests that 'secretWords' string param is passed correctly.
640640 // Needs a high-entropy string to exceed the sensibility threshold.
641641 const content =
@@ -678,9 +678,8 @@ describe('gRPC server', () => {
678678 expect ( responseNoTrigger . issues ?. length ) . toBe ( 0 ) ;
679679 } ) ;
680680
681- it ( 'should handle customDefault with escaped regex string (S139 — trailing comments)' , async ( ) => {
682- // S139 (line-comment-position) config.ts has ignorePattern with default: '^\\s*[^\\s]+$'
683- // and customDefault: '^\\\\s*[^\\\\s]+$' (double-escaped for Java).
681+ it ( 'should handle escaped regex string defaults (S139 — trailing comments)' , async ( ) => {
682+ // S139 (line-comment-position) config.ts has ignorePattern default: '^\\s*[^\\s]+$'.
684683 // The SQ key is 'pattern' (displayName).
685684
686685 // Multi-word trailing comment doesn't match default ignorePattern → should trigger
@@ -720,9 +719,30 @@ describe('gRPC server', () => {
720719 expect ( responseNoTrigger . issues ?. length ) . toBe ( 0 ) ;
721720 } ) ;
722721
723- it ( 'should handle customDefault with array of escaped regexes (S7718 — catch error name)' , async ( ) => {
724- // S7718 config.ts has ignore field with default: array of regexes and
725- // customDefault: same array with double-escaped regexes (for Java).
722+ it ( 'should handle escaped regex defaults with optional $ prefix (S101 — class names)' , async ( ) => {
723+ // S101 default format is '^\\$?[A-Z][a-zA-Z0-9]*$' and should allow optional '$'.
724+ // This verifies the default from Java is correctly unescaped on the JS side.
725+ const content = 'interface $ZodCheckDef {}\ninterface my_interface {}\n' ;
726+
727+ const request : analyzer . IAnalyzeRequest = {
728+ analysisId : generateAnalysisId ( ) ,
729+ contextIds : { } ,
730+ sourceFiles : [ { relativePath : '/project/src/interface-name.ts' , content } ] ,
731+ activeRules : [
732+ {
733+ ruleKey : { repo : 'javascript' , rule : 'S101' } ,
734+ params : [ ] ,
735+ } ,
736+ ] ,
737+ } ;
738+
739+ const response = await client . analyze ( request ) ;
740+ expect ( response . issues ?. length ) . toBe ( 1 ) ;
741+ expect ( response . issues ?. [ 0 ] . rule ?. rule ) . toBe ( 'S101' ) ;
742+ } ) ;
743+
744+ it ( 'should handle escaped regex defaults in arrays (S7718 — catch error name)' , async ( ) => {
745+ // S7718 config.ts has ignore field default as an array of regexes.
726746 // The gRPC path should split comma-separated values into an array.
727747 const content = 'try { foo(); } catch (myVar) { throw myVar; }\n' ;
728748
0 commit comments