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


##########
superset-frontend/eslint-rules/eslint-plugin-i18n-strings/index.js:
##########
@@ -52,5 +52,67 @@ module.exports = {
         };
       },
     },
+    'sentence-case-buttons': {
+      create(context) {
+        function isTitleCase(str) {
+          // Match "Delete Dataset", "Create Chart", etc. (2+ title-cased 
words)
+          return /^[A-Z][a-z]+(\s+[A-Z][a-z]*)+$/.test(str);
+        }
+
+        function isButtonContext(node) {
+          const { parent } = node;
+          if (!parent) return false;

Review Comment:
   ### Unsafe destructuring without validation <sub>![category Error 
Handling](https://img.shields.io/badge/Error%20Handling-ea580c)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   The isButtonContext function destructures parent from node without first 
checking if node exists.
   
   
   ###### Why this matters
   If node is undefined, the destructuring operation will throw an error and 
crash the ESLint rule.
   
   ###### Suggested change ∙ *Feature Preview*
   Add node validation before destructuring:
   ```javascript
   if (!node) return false;
   const { parent } = node;
   if (!parent) return false;
   ```
   
   
   ###### Provide feedback to improve future suggestions
   [![Nice 
Catch](https://img.shields.io/badge/👍%20Nice%20Catch-71BC78)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/476075e8-80e3-428b-8350-90d4b8159ee3/upvote)
 
[![Incorrect](https://img.shields.io/badge/👎%20Incorrect-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/476075e8-80e3-428b-8350-90d4b8159ee3?what_not_true=true)
  [![Not in 
Scope](https://img.shields.io/badge/👎%20Out%20of%20PR%20scope-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/476075e8-80e3-428b-8350-90d4b8159ee3?what_out_of_scope=true)
 [![Not in coding 
standard](https://img.shields.io/badge/👎%20Not%20in%20our%20standards-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/476075e8-80e3-428b-8350-90d4b8159ee3?what_not_in_standard=true)
 
[![Other](https://img.shields.io/badge/👎%20Other-white)](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/476075e8-80e3-428b-8350-90d4b8159ee3)
   </details>
   
   <sub>
   
   💬 Looking for more details? Reply to this comment to chat with Korbit.
   </sub>
   
   <!--- korbi internal id:9a008045-4ceb-478f-865a-7fffb1e5dcc0 -->
   
   
   [](9a008045-4ceb-478f-865a-7fffb1e5dcc0)



-- 
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