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

   ## SUMMARY
   
   Third batch of lint cleanup to reduce tech debt and enforce stricter 
patterns.
   
   ### Rules upgraded to error:
   
   1. **`unicorn/no-new-array`** - Prefer `Array.from({ length: n }, callback)` 
over `new Array(n).fill().map()`
   2. **`@typescript-eslint/no-use-before-define`** - Previously at warn, now 
error (no violations found)
   3. **`react-you-might-not-need-an-effect/no-adjust-state-on-prop-change`** - 
New rule added
   4. **`react-you-might-not-need-an-effect/no-pass-data-to-parent`** - New 
rule added
   
   ### Fixes applied:
   
   Fixed all `unicorn/no-new-array` violations across 17 files by replacing:
   - `new Array(n).fill().map(callback)` → `Array.from({ length: n }, callback)`
   - `new Array(n).fill(0).join('')` → `'0'.repeat(n)`
   - `new Array(n).fill().forEach(callback)` → `for` loop
   
   ### Why prefer Array.from?
   
   `new Array(n).fill().map()` has several issues:
   1. Creates a sparse array first, then fills it, then maps - three operations 
instead of one
   2. `.fill()` alone creates holes that behave unexpectedly with array methods
   3. `Array.from({ length: n }, callback)` is more readable and direct
   
   ## BEFORE/AFTER
   
   Before:
   ```typescript
   const items = new Array(10).fill(undefined).map((_, i) => ({ id: i }));
   ```
   
   After:
   ```typescript
   const items = Array.from({ length: 10 }, (_, i) => ({ id: i }));
   ```
   
   ## TESTING INSTRUCTIONS
   
   These are lint rule changes. CI will verify all linting passes.
   
   ## ADDITIONAL INFORMATION
   
   - Part of ongoing lint cleanup effort (batch 3)
   - Related PRs: #37883, #37884
   
   🤖 Generated with [Claude Code](https://claude.ai/code)


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