codeant-ai-for-open-source[bot] commented on code in PR #43686:
URL: https://github.com/apache/superset/pull/43686#discussion_r3887094364


##########
superset-frontend/scripts/bundle-size-summary.js:
##########
@@ -79,8 +80,11 @@ function main() {
   console.log(JSON.stringify(results, null, 2));
 }
 
-if (require.main === module) {
+const isMain =
+  process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href;
+
+if (isMain) {
   main();
 }
 
-module.exports = { entrypointSizeByExt, main, TRACKED_ENTRYPOINTS };
+export default { entrypointSizeByExt, main, TRACKED_ENTRYPOINTS };

Review Comment:
   **Suggestion:** The existing Jest consumer loads this module with 
`require()` and destructures `entrypointSizeByExt` and `main` as named exports. 
Exporting only a default object makes those properties unavailable at the 
expected level, so the tests and any equivalent CommonJS consumers receive 
`undefined` (or fail to load the ESM module). [api mismatch]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ Bundle-size summary Jest tests fail.
   - ⚠️ Bundle-size validation loses its test coverage.
   - ⚠️ CommonJS script consumers cannot access helpers.
   ```
   </details>
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=ecc4646efde0438aa7ddc8e78c1da932&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=ecc4646efde0438aa7ddc8e78c1da932&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/scripts/bundle-size-summary.js
   **Line:** 90:90
   **Comment:**
        *Api Mismatch: The existing Jest consumer loads this module with 
`require()` and destructures `entrypointSizeByExt` and `main` as named exports. 
Exporting only a default object makes those properties unavailable at the 
expected level, so the tests and any equivalent CommonJS consumers receive 
`undefined` (or fail to load the ESM module).
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43686&comment_hash=ca5d54431eee2be0605ead39b3f567ebb1e861bcc58e4d29a1645e22de2647ca&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43686&comment_hash=ca5d54431eee2be0605ead39b3f567ebb1e861bcc58e4d29a1645e22de2647ca&reaction=dislike'>👎</a>



##########
superset-frontend/eslint.config.minimal.js:
##########
@@ -34,14 +34,14 @@
 
 // Register the TypeScript require hook so ESLint can load the .ts plugin files
 // from eslint-rules/*.
-require('tsx/cjs');
+import 'tsx/cjs';
 
-const tsParser = require('@typescript-eslint/parser');
-const themeColorsPlugin = require('eslint-plugin-theme-colors');
-const iconsPlugin = require('eslint-plugin-icons');
-const i18nStringsPlugin = require('eslint-plugin-i18n-strings');
+import tsParser from '@typescript-eslint/parser';
+import themeColorsPlugin from 'eslint-plugin-theme-color';

Review Comment:
   **Suggestion:** The imported package name does not exist in the repository: 
the local plugin is published as `eslint-plugin-theme-colors` (plural), but 
this import requests `eslint-plugin-theme-color`. Loading the ESLint flat 
config will fail with a module-not-found error before linting starts. [import 
error]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ `lint-stats` fails before linting begins.
   - ❌ Custom theme-color rules are unavailable.
   - ⚠️ CI lint metrics cannot be uploaded.
   ```
   </details>
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=b799374625cf44708a86e7dd5583358e&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=b799374625cf44708a86e7dd5583358e&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/eslint.config.minimal.js
   **Line:** 40:40
   **Comment:**
        *Import Error: The imported package name does not exist in the 
repository: the local plugin is published as `eslint-plugin-theme-colors` 
(plural), but this import requests `eslint-plugin-theme-color`. Loading the 
ESLint flat config will fail with a module-not-found error before linting 
starts.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43686&comment_hash=f2c99b6e293b715760205be9c72e209efdeb07ae1db5f98f0832a2b16b4ef088&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43686&comment_hash=f2c99b6e293b715760205be9c72e209efdeb07ae1db5f98f0832a2b16b4ef088&reaction=dislike'>👎</a>



##########
superset-frontend/scripts/check-storybook-coverage.js:
##########
@@ -117,7 +120,7 @@ function main() {
 
     for (const pluginDir of pluginDirs) {
       const fullPath = path.join(ROOT, pluginDir);
-      if (!fs.existsSync(fullPath)) continue;
+      if (!fs.existsglob.sync(fullPath)) continue;

Review Comment:
   **Suggestion:** `fs` has no `existsglob` or `statglob` methods; the script 
throws a `TypeError` as soon as it processes the first matching plugin or 
component instead of checking Storybook coverage. Use the corresponding 
filesystem methods and pass the path separately to them. [api mismatch]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ Storybook coverage command crashes immediately.
   - ❌ Missing plugin stories are not reported.
   - ⚠️ Coverage results are unavailable in CI.
   ```
   </details>
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=cf3d1111f7364fe38e99ba9e22afb6cd&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=cf3d1111f7364fe38e99ba9e22afb6cd&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/scripts/check-storybook-coverage.js
   **Line:** 123:123
   **Comment:**
        *Api Mismatch: `fs` has no `existsglob` or `statglob` methods; the 
script throws a `TypeError` as soon as it processes the first matching plugin 
or component instead of checking Storybook coverage. Use the corresponding 
filesystem methods and pass the path separately to them.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43686&comment_hash=d60276ab8bbc584f86a78f92582ce05709c199d14394795e061f9040f1f1ce6d&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43686&comment_hash=d60276ab8bbc584f86a78f92582ce05709c199d14394795e061f9040f1f1ce6d&reaction=dislike'>👎</a>



##########
superset-frontend/scripts/build.js:
##########
@@ -23,12 +23,13 @@
 /**
  * Build packages/plugins filtered by globs
  */
-process.env.PATH = `./node_modules/.bin:${process.env.PATH}`;
 
-const { spawnSync } = require('child_process');
-const fastGlob = require('fast-glob');
-const yargs = require('yargs');
-const { hideBin } = require('yargs/helpers');
+import { spawnSync } from 'node:child_process';
+import fastGlob from 'fast-glob';
+import yargs from 'yargs';
+import { hideBin } from 'yargs/helpers';
+
+process.env.PATH = `./node_modules/.bin:${process.env.PATH}`;

Review Comment:
   **Suggestion:** The PATH separator is hardcoded as `:`, which is invalid on 
Windows where entries are separated by `;`. This causes `spawnSync` to be 
unable to locate commands such as `lerna` and `babel` when `plugins:build` runs 
on Windows. Use Node's platform-specific `path.delimiter` and preserve the 
existing PATH entries. [possible bug]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ Windows plugin builds cannot resolve local `lerna` and `babel`.
   - ⚠️ Plugin release scripts also depend on `plugins:build`.
   ```
   </details>
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=23f6f8ee672645beaac5213e7a5cc5fe&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=23f6f8ee672645beaac5213e7a5cc5fe&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/scripts/build.js
   **Line:** 32:32
   **Comment:**
        *Possible Bug: The PATH separator is hardcoded as `:`, which is invalid 
on Windows where entries are separated by `;`. This causes `spawnSync` to be 
unable to locate commands such as `lerna` and `babel` when `plugins:build` runs 
on Windows. Use Node's platform-specific `path.delimiter` and preserve the 
existing PATH entries.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43686&comment_hash=5d5372b80338f77ff5720cbfd11fa09a161a5de0f1a7b727d7ab8456692316f1&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43686&comment_hash=5d5372b80338f77ff5720cbfd11fa09a161a5de0f1a7b727d7ab8456692316f1&reaction=dislike'>👎</a>



##########
superset-frontend/eslint-rules/eslint-plugin-i18n-strings/index.ts:
##########
@@ -229,4 +229,4 @@ const plugin: { rules: Record<string, Rule.RuleModule> } = {
   },
 };
 
-module.exports = plugin;
+export default plugin;

Review Comment:
   **Suggestion:** The plugin package has its own `package.json` without 
`"type": "module"`, so it is still loaded through the `tsx/cjs` require hook as 
CommonJS. `export default plugin` therefore exposes the rule set as 
`module.exports.default`, while the ESM ESLint config expects the default 
import itself to contain `rules`; loading the ESLint configuration will yield 
an object without `rules` and fail when the plugin rules are configured. 
Preserve the CommonJS export for this package or mark the package as ESM and 
update its loading path consistently. [import error]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ `npm run lint-stats` cannot load the i18n ESLint plugin.
   - ❌ Custom i18n violations are omitted from ESLint metrics.
   - ⚠️ ESLint configuration loading emits an error before linting.
   ```
   </details>
   
   [![Use CodeAnt 
Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
 [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=0e63dd1b6c6947a8916a00c0a2efe400&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=0e63dd1b6c6947a8916a00c0a2efe400&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/eslint-rules/eslint-plugin-i18n-strings/index.ts
   **Line:** 232:232
   **Comment:**
        *Import Error: The plugin package has its own `package.json` without 
`"type": "module"`, so it is still loaded through the `tsx/cjs` require hook as 
CommonJS. `export default plugin` therefore exposes the rule set as 
`module.exports.default`, while the ESM ESLint config expects the default 
import itself to contain `rules`; loading the ESLint configuration will yield 
an object without `rules` and fail when the plugin rules are configured. 
Preserve the CommonJS export for this package or mark the package as ESM and 
update its loading path consistently.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43686&comment_hash=51b8e7ab79c52ab9620253938fb861a66d99efcdca4a47e9a0e8d775db0197dd&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43686&comment_hash=51b8e7ab79c52ab9620253938fb861a66d99efcdca4a47e9a0e8d775db0197dd&reaction=dislike'>👎</a>



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