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></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
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/476075e8-80e3-428b-8350-90d4b8159ee3/upvote)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/476075e8-80e3-428b-8350-90d4b8159ee3?what_not_true=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/476075e8-80e3-428b-8350-90d4b8159ee3?what_out_of_scope=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/476075e8-80e3-428b-8350-90d4b8159ee3?what_not_in_standard=true)
[](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]