-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(eslint-plugin): [require-explicit-array-types] new rule #11756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(eslint-plugin): [require-explicit-array-types] new rule #11756
Conversation
|
Thanks for the PR, @adam-sajko! typescript-eslint is a 100% community driven project, and we are incredibly grateful that you are contributing to that community. The core maintainers work on this in their personal time, so please understand that it may not be possible for them to review your work immediately. Thanks again! 🙏 Please, if you or your company is finding typescript-eslint valuable, help us sustain the project by sponsoring it transparently on https://opencollective.com/typescript-eslint. |
✅ Deploy Preview for typescript-eslint ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run-many -t typecheck |
❌ Failed | 1m 59s | View ↗ |
nx test eslint-plugin --coverage=false |
✅ Succeeded | 5m 10s | View ↗ |
nx test typescript-estree --coverage=false |
✅ Succeeded | 2s | View ↗ |
nx test eslint-plugin-internal --coverage=false |
✅ Succeeded | 4s | View ↗ |
nx run types:build |
✅ Succeeded | 5s | View ↗ |
nx run integration-tests:test |
✅ Succeeded | 4s | View ↗ |
nx run generate-configs |
✅ Succeeded | 6s | View ↗ |
nx run-many --target=build --parallel --exclude... |
✅ Succeeded | 17s | View ↗ |
Additional runs (28) |
✅ Succeeded | ... | View ↗ |
☁️ Nx Cloud last updated this comment at 2025-11-12 13:36:22 UTC
c73f217 to
6616e4c
Compare
6616e4c to
3d87e08
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #11756 +/- ##
==========================================
- Coverage 90.56% 90.56% -0.01%
==========================================
Files 522 523 +1
Lines 53063 53113 +50
Branches 8838 8843 +5
==========================================
+ Hits 48058 48103 +45
- Misses 4990 4995 +5
Partials 15 15
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
The related proposal was rejected, so closing this PR. |

PR Checklist
Overview
Requires explicit type annotations for empty arrays assigned to variables.
Problem:
TypeScript infers empty arrays as an "evolving any" type that evolves as you push elements. TypeScript already prevents unsafe usage, so it's type-safe. The issue is purely about code clarity: without an explicit annotation, it's not clear what type the array should contain.
Solution:
This rule enforces explicit type annotations for empty arrays for code clarity and consistency. It's a style preference, not a safety requirement.
Note: This rule is complementary to TypeScript's
noImplicitAnyoption, not a replacement. It can be used together withnoImplicitAnyto catch issues earlier, or independently to enforce explicit types.