Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@adam-sajko
Copy link

@adam-sajko adam-sajko commented Nov 12, 2025

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 noImplicitAny option, not a replacement. It can be used together with noImplicitAny to catch issues earlier, or independently to enforce explicit types.

@typescript-eslint
Copy link
Contributor

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.

@netlify
Copy link

netlify bot commented Nov 12, 2025

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 3d87e08
🔍 Latest deploy log https://app.netlify.com/projects/typescript-eslint/deploys/69148aae4ae7f90008688025
😎 Deploy Preview https://deploy-preview-11756--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 98 (🟢 up 2 from production)
Accessibility: 97 (no change from production)
Best Practices: 100 (no change from production)
SEO: 92 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@nx-cloud
Copy link

nx-cloud bot commented Nov 12, 2025

🤖 Nx Cloud AI Fix Eligible

An automatically generated fix could have helped fix failing tasks for this run, but Self-healing CI is disabled for this workspace. Visit workspace settings to enable it and get automatic fixes in future runs.

To disable these notifications, a workspace admin can disable them in workspace settings.


View your CI Pipeline Execution ↗ for commit 3d87e08

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

@adam-sajko adam-sajko force-pushed the feat/eslint-plugin/require-explicit-array-types branch from c73f217 to 6616e4c Compare November 12, 2025 13:13
@adam-sajko adam-sajko force-pushed the feat/eslint-plugin/require-explicit-array-types branch from 6616e4c to 3d87e08 Compare November 12, 2025 13:25
@codecov
Copy link

codecov bot commented Nov 12, 2025

Codecov Report

❌ Patch coverage is 90.00000% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.56%. Comparing base (1d15881) to head (3d87e08).

Files with missing lines Patch % Lines
...t-plugin/src/rules/require-explicit-array-types.ts 89.58% 5 Missing ⚠️
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              
Flag Coverage Δ
unittest 90.56% <90.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/eslint-plugin/src/configs/eslintrc/all.ts 100.00% <100.00%> (ø)
packages/eslint-plugin/src/configs/flat/all.ts 100.00% <100.00%> (ø)
...t-plugin/src/rules/require-explicit-array-types.ts 89.58% <89.58%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bradzacher
Copy link
Member

The related proposal was rejected, so closing this PR.

@bradzacher bradzacher closed this Nov 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rule proposal: require-explicit-array-types

2 participants