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

   ## Summary
   
   This PR consolidates the ESLint configuration in `superset-frontend/` from 6 
separate config files down to 2, significantly simplifying our linting setup 
while maintaining the same enforcement level.
   
   ### Current State of ESLint Configs in Superset
   
   #### After This PR:
   - **`superset-frontend/`**: 2 configs (down from 6)
     - `.eslintrc.js` - Main consolidated config
     - `cypress-base/.eslintrc` - Cypress-specific (to be removed with 
Playwright migration)
   - **`docs/`**: 1 config (`eslint.config.js` - already using flat config)
   - **`superset-websocket/`**: 1 config (`eslint.config.js` - already using 
flat config)
   
   ### Changes Made
   
   #### 🗑️ Removed Configs (4 files)
   - `spec/.eslintrc` - Consolidated test rules into main config
   - `spec/javascripts/dashboard/.eslintrc` - Removed (empty directory with 
outdated config)
   - `packages/superset-ui-core/.eslintrc` - Consolidated test rules into main 
config  
   - `packages/generator-superset/.eslintrc` - Unnecessary (main config handles 
it)
   
   #### ✅ Kept Configs (2 files)
   - `.eslintrc.js` - Main config with consolidated rules
   - `cypress-base/.eslintrc` - Kept separate (will be removed with Cypress → 
Playwright migration)
   
   #### 📝 Main Config Improvements
   - Added comprehensive test file patterns to catch all test/mock/fixture files
   - Added `jest/consistent-test-it` rule for consistent test naming 
(auto-fixed ~60 test files)
   - Consolidated all test-specific rules into dedicated override blocks
   - Fixed packages stories/overview files to properly disable 
`import/no-extraneous-dependencies`
   
   ### What We Learned
   
   1. **Less is More**: We went from 6 configs to 2, making maintenance much 
simpler
   2. **Airbnb Config**: Despite disabling 119 of its rules (72%), Airbnb 
actually provides a good baseline that's less strict than modern "recommended" 
configs in problematic areas
   3. **Test Config Duplication**: Multiple directories had nearly identical 
Jest/testing-library configs - now unified
   4. **Flat Config Ready**: Other parts of the repo (`docs/`, 
`superset-websocket/`) already use ESLint 9 flat config
   5. **Project Separation**: The three projects (frontend, docs, websocket) 
should maintain separate configs due to different frameworks and requirements
   
   ### Next Steps for ESLint Modernization
   
   #### Short Term
   - [x] ~~Consolidate configs~~ ✅ Done in this PR
   - [ ] Remove `cypress-base/.eslintrc` when Cypress is deprecated for 
Playwright
   - [ ] Consider enabling some currently disabled rules gradually
   
   #### Medium Term  
   - [ ] Upgrade to ESLint 9.x (currently on 8.57.1)
   - [ ] Convert to flat config format (`eslint.config.js`)
   - [ ] Evaluate removing Airbnb config once flat config is adopted
   - [ ] Update custom plugins (`theme-colors`, `icons`, `i18n-strings`) for 
flat config
   
   #### Long Term
   - [ ] Align all three projects (frontend, websocket, docs) on same ESLint 
version
   - [ ] Consider shared base config package if beneficial
   - [ ] Enable stricter rules that are currently disabled
   
   ### Testing
   
   - ✅ `npm run lint` passes without errors
   - ✅ `npm run lint-fix` successfully auto-fixes issues
   - ✅ Pre-commit hooks pass
   - ✅ All test files properly recognized by new patterns
   - ✅ ~60 test files auto-fixed to use consistent `it()` instead of `test()`
   
   ### Notes
   
   - The separate configs for `superset-websocket/` and `docs/` are 
intentionally kept separate as they are different projects with different 
requirements (Node.js service vs Docusaurus site)
   - Attempting to remove Airbnb config revealed it's actually preventing ~350+ 
errors that recommended configs would introduce
   - The `cypress-base/.eslintrc` will naturally disappear with the Cypress 
deprecation
   
   ### Migration Lessons
   
   During this consolidation, we discovered that migrating away from Airbnb is 
more complex than expected:
   - Modern "recommended" configs are stricter in some areas (react/jsx-key, 
react/display-name)
   - We would need to disable MORE rules without Airbnb than with it
   - Best to wait for flat config migration before reconsidering Airbnb removal
   
   ## References
   
   - [ESLint Flat Config 
Documentation](https://eslint.org/docs/latest/use/configure/configuration-files-new)
   - [Working with LLMs - Superset Contributing 
Guide](https://superset.apache.org/docs/contributing/development#working-with-llms)


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