korbit-ai[bot] commented on code in PR #32352:
URL: https://github.com/apache/superset/pull/32352#discussion_r1967961351


##########
superset-frontend/src/types/react-syntax-highlighter.d.ts:
##########
@@ -0,0 +1,47 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+declare module 'react-syntax-highlighter/dist/cjs/light' {
+  import SyntaxHighlighter from 'react-syntax-highlighter';
+  export default SyntaxHighlighter;
+}
+
+declare module 'react-syntax-highlighter/dist/cjs/styles/hljs/github' {
+  const style: any;
+  export default style;
+}
+
+declare module 'react-syntax-highlighter/dist/cjs/languages/hljs/markdown' {
+  const language: any;
+  export default language;
+}
+
+declare module 'react-syntax-highlighter/dist/cjs/languages/hljs/htmlbars' {
+  const language: any;
+  export default language;
+}
+
+declare module 'react-syntax-highlighter/dist/cjs/languages/hljs/sql' {
+  const language: any;
+  export default language;
+}
+
+declare module 'react-syntax-highlighter/dist/cjs/languages/hljs/json' {
+  const language: any;
+  export default language;
+}

Review Comment:
   ### Redundant language module declarations <sub>![category 
Design](https://img.shields.io/badge/Design-0d9488)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   Repeated module declarations with identical structure violate the DRY 
principle and make maintenance more difficult.
   
   ###### Why this matters
   If the structure of these language modules needs to change in the future, 
developers would need to update multiple identical declarations, increasing the 
risk of inconsistencies and maintenance overhead.
   
   ###### Suggested change ∙ *Feature Preview*
   Create a type helper or utility to declare language modules:
   ```typescript
   type HighlighterLanguage = { language: any };
   
   function declareLanguageModule(name: string) {
     return `declare module 
'react-syntax-highlighter/dist/cjs/languages/hljs/${name}' {
       const language: any;
       export default language;
     }`;
   }
   
   // Or use a string literal union type
   type SupportedLanguages = 'markdown' | 'htmlbars' | 'sql' | 'json';
   declare module 'react-syntax-highlighter/dist/cjs/languages/hljs/*' {
       const language: any;
       export default language;
   }
   ```
   
   
   </details>
   
   <sub>
   
   [![Report a problem with this 
comment](https://img.shields.io/badge/Report%20a%20problem%20with%20this%20comment-gray.svg?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiNmNWVjMDAiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBjbGFzcz0ibHVjaWRlIGx1Y2lkZS10cmlhbmdsZS1hbGVydCI+PHBhdGggZD0ibTIxLjczIDE4LTgtMTRhMiAyIDAgMCAwLTMuNDggMGwtOCAxNEEyIDIgMCAwIDAgNCAyMWgxNmEyIDIgMCAwIDAgMS43My0zIi8+PHBhdGggZD0iTTEyIDl2NCIvPjxwYXRoIGQ9Ik0xMiAxN2guMDEiLz48L3N2Zz4=)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/125dc621-7846-4abd-b53f-ba701e664e5b?suggestedFixEnabled=true)
   
   💬 Chat with Korbit by mentioning @korbit-ai.
   </sub>
   
   <!--- korbi internal id:32f51ad1-40d3-4475-b651-78197b055aa4 -->
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to