You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "rusackas (via GitHub)" <gi...@apache.org> on 2025/01/09 03:59:40 UTC

[PR] build(eslint) disabling wildcard imports with eslint [superset]

rusackas opened a new pull request, #31761:
URL: https://github.com/apache/superset/pull/31761

   <!---
   Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
   Example:
   fix(dashboard): load charts correctly
   -->
   
   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   @justinpark adeptly spotted a wildcard input on a PR [here](https://github.com/apache/superset/pull/31751#discussion_r1907711809). I figured this might be happening elsewhere, so I added a lint rule, and cleaned up the fallout. This should lead to a smaller bundle size, with any luck, or at least better hygiene. 
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   
   ### TESTING INSTRUCTIONS
   <!--- Required! What steps can be taken to manually verify the changes? -->
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] build(eslint): disabling wildcard imports with eslint [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #31761:
URL: https://github.com/apache/superset/pull/31761#discussion_r1908142501


##########
superset-frontend/plugins/legacy-preset-chart-deckgl/src/utils/sandbox.ts:
##########
@@ -19,6 +19,7 @@
 // A safe alternative to JS's eval
 import vm, { Context, RunningScriptOptions } from 'vm';
 import _ from 'underscore';
+/* eslint-ignore-next-line no-restricted-syntax*/
 import * as d3array from 'd3-array';

Review Comment:
   Ignoring this, since it's a unique scenario, and I'm going to axe this file soon anyway.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] build(eslint): disabling wildcard imports with eslint [superset]

Posted by "mistercrunch (via GitHub)" <gi...@apache.org>.
mistercrunch commented on PR #31761:
URL: https://github.com/apache/superset/pull/31761#issuecomment-2585836215

   Ooops approved twice...


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] build(eslint): disabling wildcard imports with eslint [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas merged PR #31761:
URL: https://github.com/apache/superset/pull/31761


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] build(eslint): disabling wildcard imports with eslint [superset]

Posted by "jpchev (via GitHub)" <gi...@apache.org>.
jpchev commented on PR #31761:
URL: https://github.com/apache/superset/pull/31761#issuecomment-2581209553

   > @jpchev do you mean to see what the rules are? There are various eslint.config.js files in the codebase you can look at.
   > 
   > If you mean you want to _run_ the script to test it, you can check the `package.json` file for all the npm scripts, but the one you probably want is `npm run lint-fix`
   
   yes thank you, anyway
   I've seen there is a page about ruff https://superset.apache.org/docs/contributing/howtos#linting


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] build(eslint) disabling wildcard imports with eslint [superset]

Posted by "korbit-ai[bot] (via GitHub)" <gi...@apache.org>.
korbit-ai[bot] commented on code in PR #31761:
URL: https://github.com/apache/superset/pull/31761#discussion_r1908136917


##########
superset-frontend/plugins/legacy-preset-chart-deckgl/src/utils/sandbox.ts:
##########
@@ -19,6 +19,7 @@
 // A safe alternative to JS's eval
 import vm, { Context, RunningScriptOptions } from 'vm';
 import _ from 'underscore';
+/* eslint-ignore-next-line no-restricted-syntax*/
 import * as d3array from 'd3-array';

Review Comment:
   ### Invalid ESLint Disable Comment <sub>![category Functionality](https://img.shields.io/badge/Functionality-0284c7)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   The ESLint disable comment has a typo ('eslint-ignore-next-line' instead of 'eslint-disable-next-line'), making it ineffective at disabling the intended ESLint rule.
   
   ###### Why this matters
   The ESLint rule intended to be disabled will still be active, potentially causing build errors or CI failures when the code is pushed.
   
   ###### Suggested change
   Correct the ESLint disable comment syntax:
   ```typescript
   /* eslint-disable-next-line no-restricted-syntax */
   import * as d3array from 'd3-array';
   ```
   
   
   </details>
   
   ###### Chat with Korbit by mentioning @korbit-ai, and give a 👍 or 👎 to help Korbit improve your reviews.
   
   <!--- korbi internal id:4b186e7e-83cb-4e77-ba7b-e1d6e1acb6a3 -->
   



##########
superset-frontend/src/SqlLab/components/ScheduleQueryButton/index.tsx:
##########
@@ -50,7 +50,7 @@ const getJSONSchema = () => {
           jsonSchema.properties[key] = {
             ...value,
             default: value.default
-              ? chrono.parseDate(value.default)?.toISOString()
+              ? parseDate(value.default)?.toISOString()

Review Comment:
   ### Unsafe Date Parsing <sub>![category Functionality](https://img.shields.io/badge/Functionality-0284c7)</sub>
   
   <details>
     <summary>Tell me more</summary>
   
   ###### What is the issue?
   Using optional chaining with parseDate result could lead to runtime errors if parseDate returns undefined and toISOString() is called.
   
   ###### Why this matters
   If chrono-node's parseDate fails to parse the date string, it returns undefined. The optional chaining will prevent accessing toISOString on undefined, but the code still assigns undefined to the default property which might cause issues when the form tries to use this value.
   
   ###### Suggested change
   Add additional null check and provide a fallback value:
   ```typescript
   default: value.default && parseDate(value.default)
     ? parseDate(value.default).toISOString()
     : null,
   ```
   
   
   </details>
   
   ###### Chat with Korbit by mentioning @korbit-ai, and give a 👍 or 👎 to help Korbit improve your reviews.
   
   <!--- korbi internal id:239da8a5-10ea-4c8f-a0c6-2030bcf33c94 -->
   



##########
superset-frontend/plugins/legacy-preset-chart-deckgl/src/utils/sandbox.ts:
##########
@@ -19,6 +19,7 @@
 // A safe alternative to JS's eval
 import vm, { Context, RunningScriptOptions } from 'vm';
 import _ from 'underscore';
+/* eslint-ignore-next-line no-restricted-syntax*/
 import * as d3array from 'd3-array';

Review Comment:
   ### Avoid ignoring ESLint rule 'no-restricted-syntax'. <sub>![category Readability and Maintainability](https://img.shields.io/badge/Readability%20and%20Maintainability-0284c7)</sub>
   
   <details>
     <summary>Tell me more</summary>
   &#8203;
   
   Hello, thank you for your pull request. I notice that you ignored an ESLint rule with 'eslint-ignore-next-line no-restricted-syntax'. As much as possible, we should follow the lint rules because they help to keep our codebase consistent, readable, and maintainable. The rule you've ignored might be in place to deter us from importing the whole 'd3-array' module – which could potentially increase the bundle size. Could you please refactor your code to comply with the rule by importing only the specific functions you need from 'd3-array'? Thank you.
   
   
   </details>
   
   ###### Chat with Korbit by mentioning @korbit-ai, and give a 👍 or 👎 to help Korbit improve your reviews.
   
   <!--- korbi internal id:34f50f2a-6a84-4a9c-99cb-3c5e2e0e33db -->
   



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] build(eslint): disabling wildcard imports with eslint [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #31761:
URL: https://github.com/apache/superset/pull/31761#issuecomment-2581160421

   @jpchev do you mean to see what the rules are? There are various eslint.config.js files in the codebase you can look at. 
   
   If you mean you want to _run_ the script to test it, you can check the `package.json` file for all the npm scripts, but the one you probably want is `npm run lint-fix`


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] build(eslint): disabling wildcard imports with eslint [superset]

Posted by "jpchev (via GitHub)" <gi...@apache.org>.
jpchev commented on PR #31761:
URL: https://github.com/apache/superset/pull/31761#issuecomment-2580047763

   sorry to ask this question here (did not find the information on the [contributing](https://superset.apache.org/docs/contributing/) page), can you please recommend some tools to check all the lint rules on one's own dev environment?


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] build(eslint): disabling wildcard imports with eslint [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #31761:
URL: https://github.com/apache/superset/pull/31761#discussion_r1908150463


##########
superset-frontend/plugins/legacy-preset-chart-deckgl/src/utils/sandbox.ts:
##########
@@ -19,6 +19,7 @@
 // A safe alternative to JS's eval
 import vm, { Context, RunningScriptOptions } from 'vm';
 import _ from 'underscore';
+/* eslint-ignore-next-line no-restricted-syntax*/
 import * as d3array from 'd3-array';

Review Comment:
   Addressed



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org