Skip to content

Conversation

@mdm317
Copy link
Contributor

@mdm317 mdm317 commented Dec 9, 2024

PR Checklist

Overview

Hard-code the typed arrays and added code to skip check if the type is a typed array.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @mdm317!

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.

@mdm317 mdm317 marked this pull request as draft December 9, 2024 09:33
@nx-cloud
Copy link

nx-cloud bot commented Dec 9, 2024

View your CI Pipeline Execution ↗ for commit 2bd81ac

Command Status Duration Result
nx test eslint-plugin --coverage=false ✅ Succeeded 5m 15s View ↗
nx run-many -t lint ✅ Succeeded 3m 11s View ↗
nx run-many -t typecheck ✅ Succeeded 2m 6s View ↗
nx test eslint-plugin-internal --coverage=false ✅ Succeeded 3s View ↗
nx run types:build ✅ Succeeded 6s View ↗
nx run integration-tests:test ✅ Succeeded 4s View ↗
nx test typescript-estree --coverage=false ✅ Succeeded 2s View ↗
nx run generate-configs ✅ Succeeded 6s View ↗
Additional runs (29) ✅ Succeeded ... View ↗

☁️ Nx Cloud last updated this comment at 2025-11-03 22:52:07 UTC

@netlify
Copy link

netlify bot commented Dec 9, 2024

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 2bd81ac
🔍 Latest deploy log https://app.netlify.com/projects/typescript-eslint/deploys/69092f4243a5270008a2587d
😎 Deploy Preview https://deploy-preview-10477--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: 99 (🟢 up 3 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.

@codecov
Copy link

codecov bot commented Dec 9, 2024

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.67%. Comparing base (ea2ee6b) to head (2bd81ac).
⚠️ Report is 22 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #10477   +/-   ##
=======================================
  Coverage   90.66%   90.67%           
=======================================
  Files         518      518           
  Lines       52435    52456   +21     
  Branches     8686     8688    +2     
=======================================
+ Hits        47541    47562   +21     
  Misses       4880     4880           
  Partials       14       14           
Flag Coverage Δ
unittest 90.67% <100.00%> (+<0.01%) ⬆️

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

Files with missing lines Coverage Δ
...lugin/src/rules/consistent-generic-constructors.ts 97.48% <100.00%> (+0.38%) ⬆️
🚀 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.

@mdm317 mdm317 marked this pull request as ready for review December 9, 2024 15:56
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A good start! 🚀

@JoshuaKGoldberg JoshuaKGoldberg added the awaiting response Issues waiting for a reply from the OP or another party label Dec 14, 2024
@Josh-Cena
Copy link
Member

FWIW, my personal preference is still "we should not special case built-ins". These types of declarations can legitimately happen with user-defined types, so we should just create a generic allowlist of types.

@github-actions github-actions bot removed the awaiting response Issues waiting for a reply from the OP or another party label Dec 17, 2024
@mdm317
Copy link
Contributor Author

mdm317 commented Dec 17, 2024

Should we avoid dealing specifically with the built-in array-likes?

@JoshuaKGoldberg JoshuaKGoldberg changed the title fix: ignore when constructor is typed array fix(eslint-plugin): [consistent-generic-constructors] ignore when constructor is typed array Jan 13, 2025
@JoshuaKGoldberg
Copy link
Member

@Josh-Cena just confirming, what do you suggest we do here?

@Josh-Cena
Copy link
Member

This:

we should just create a generic allowlist of types.

Like a new option called ignore or allow where the types would just be ignored for consistency checks.

@JoshuaKGoldberg JoshuaKGoldberg added the awaiting response Issues waiting for a reply from the OP or another party label Mar 3, 2025
@mdm317
Copy link
Contributor Author

mdm317 commented Mar 14, 2025

Like a new option called ignore or allow where the types would just be ignored for consistency checks.

I added an allow option to ignore consistency checks.

Should I add TypedArray to the default option?

Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the back-and-forth on this rule's option(s)! It looks like we have a bit of design/discussion work to do before we're settled?

@JoshuaKGoldberg JoshuaKGoldberg added the triage Waiting for team members to take a look label Mar 31, 2025
@JoshuaKGoldberg JoshuaKGoldberg removed the triage Waiting for team members to take a look label Sep 22, 2025
@JoshuaKGoldberg
Copy link
Member

@mdm317 sorry for the delay on this! I think there's consensus on what to do in #10477 (comment). Is there anything else blocking you on this PR?

@mdm317
Copy link
Contributor Author

mdm317 commented Sep 23, 2025

@JoshuaKGoldberg
All good, no blockers. Appreciate you driving the consensus, I’ll resolve the merge conflicts on my side.

@github-actions github-actions bot removed the awaiting response Issues waiting for a reply from the OP or another party label Sep 24, 2025
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current status is waiting on:

  • Having the known "can't be fixed" built-in lib types always be allowed
  • Implementing the TypeOrValueSpecifier change

@JoshuaKGoldberg JoshuaKGoldberg added the awaiting response Issues waiting for a reply from the OP or another party label Oct 3, 2025
@JoshuaKGoldberg
Copy link
Member

Ok, looking back at this, I figured out the discrepancy - we'd only 👍d hardcoding the known built-in array classes as ignored. Adding a TypeOrValueSpecifier ignore option is out-of-scope because that format requires type information. This rule isn't typed right now.

Sorry for the confusion. I updated the code to just hardcode allowing the types mentioned in https://github.com/microsoft/TypeScript/pull/59417/files.

@JoshuaKGoldberg JoshuaKGoldberg requested a review from a team November 3, 2025 22:42
@JoshuaKGoldberg JoshuaKGoldberg dismissed their stale review November 3, 2025 22:42

I updated the code myself.

@github-actions github-actions bot removed the awaiting response Issues waiting for a reply from the OP or another party label Nov 3, 2025
@bradzacher bradzacher merged commit 5ea21f1 into typescript-eslint:main Nov 23, 2025
66 of 67 checks passed
renovate bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Nov 24, 2025
| datasource | package                          | from   | to     |
| ---------- | -------------------------------- | ------ | ------ |
| npm        | @typescript-eslint/eslint-plugin | 8.47.0 | 8.48.0 |
| npm        | @typescript-eslint/parser        | 8.47.0 | 8.48.0 |


## [v8.48.0](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8480-2025-11-24)

##### 🚀 Features

- **eslint-plugin:** \[no-redundant-type-constituents] use assignability checking for redundancy checks ([#10744](typescript-eslint/typescript-eslint#10744))

##### 🩹 Fixes

- **typescript-estree:** disallow binding patterns in parameter properties ([#11760](typescript-eslint/typescript-eslint#11760))
- **eslint-plugin:** \[consistent-generic-constructors] ignore when constructor is  typed array ([#10477](typescript-eslint/typescript-eslint#10477))

##### ❤️ Thank You

- Dima Barabash [@dbarabashh](https://github.com/dbarabashh)
- JamesHenry [@JamesHenry](https://github.com/JamesHenry)
- Josh Goldberg
- mdm317 [@gen-ip-1](https://github.com/gen-ip-1)

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
renovate bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Nov 24, 2025
| datasource | package                          | from   | to     |
| ---------- | -------------------------------- | ------ | ------ |
| npm        | @typescript-eslint/eslint-plugin | 8.47.0 | 8.48.0 |
| npm        | @typescript-eslint/parser        | 8.47.0 | 8.48.0 |


## [v8.48.0](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8480-2025-11-24)

##### 🚀 Features

- **eslint-plugin:** \[no-redundant-type-constituents] use assignability checking for redundancy checks ([#10744](typescript-eslint/typescript-eslint#10744))

##### 🩹 Fixes

- **typescript-estree:** disallow binding patterns in parameter properties ([#11760](typescript-eslint/typescript-eslint#11760))
- **eslint-plugin:** \[consistent-generic-constructors] ignore when constructor is  typed array ([#10477](typescript-eslint/typescript-eslint#10477))

##### ❤️ Thank You

- Dima Barabash [@dbarabashh](https://github.com/dbarabashh)
- JamesHenry [@JamesHenry](https://github.com/JamesHenry)
- Josh Goldberg
- mdm317 [@gen-ip-1](https://github.com/gen-ip-1)

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.
ch4og pushed a commit to csmplay/mapban that referenced this pull request Dec 4, 2025
This PR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [@typescript-eslint/eslint-plugin](https://typescript-eslint.io/packages/eslint-plugin) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin)) | [`8.47.0` -> `8.48.1`](https://renovatebot.com/diffs/npm/@typescript-eslint%2feslint-plugin/8.47.0/8.48.1) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@typescript-eslint%2feslint-plugin/8.48.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@typescript-eslint%2feslint-plugin/8.47.0/8.48.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) |
| [@typescript-eslint/parser](https://typescript-eslint.io/packages/parser) ([source](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser)) | [`8.47.0` -> `8.48.1`](https://renovatebot.com/diffs/npm/@typescript-eslint%2fparser/8.47.0/8.48.1) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@typescript-eslint%2fparser/8.48.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@typescript-eslint%2fparser/8.47.0/8.48.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/eslint-plugin)</summary>

### [`v8.48.1`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8481-2025-12-02)

[Compare Source](typescript-eslint/typescript-eslint@v8.48.0...v8.48.1)

##### 🩹 Fixes

- **eslint-plugin:** \[restrict-template-expressions] check base types in allow list ([#&#8203;11764](typescript-eslint/typescript-eslint#11764), [#&#8203;11759](typescript-eslint/typescript-eslint#11759))
- **eslint-plugin:** honor ignored base types on generic classes ([#&#8203;11767](typescript-eslint/typescript-eslint#11767))
- **eslint-plugin:** \[consistent-type-exports] check value flag before resolving alias ([#&#8203;11769](typescript-eslint/typescript-eslint#11769))

##### ❤️ Thank You

- Josh Goldberg
- OleksandraKordonets
- SangheeSon [@&#8203;Higangssh](https://github.com/Higangssh)
- tao

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.

### [`v8.48.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8480-2025-11-24)

[Compare Source](typescript-eslint/typescript-eslint@v8.47.0...v8.48.0)

##### 🚀 Features

- **eslint-plugin:** \[no-redundant-type-constituents] use assignability checking for redundancy checks ([#&#8203;10744](typescript-eslint/typescript-eslint#10744))

##### 🩹 Fixes

- **typescript-estree:** disallow binding patterns in parameter properties ([#&#8203;11760](typescript-eslint/typescript-eslint#11760))
- **eslint-plugin:** \[consistent-generic-constructors] ignore when constructor is  typed array ([#&#8203;10477](typescript-eslint/typescript-eslint#10477))

##### ❤️ Thank You

- Dima Barabash [@&#8203;dbarabashh](https://github.com/dbarabashh)
- JamesHenry [@&#8203;JamesHenry](https://github.com/JamesHenry)
- Josh Goldberg
- mdm317 [@&#8203;gen-ip-1](https://github.com/gen-ip-1)

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.

</details>

<details>
<summary>typescript-eslint/typescript-eslint (@&#8203;typescript-eslint/parser)</summary>

### [`v8.48.1`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/parser/CHANGELOG.md#8481-2025-12-02)

[Compare Source](typescript-eslint/typescript-eslint@v8.48.0...v8.48.1)

This was a version bump only for parser to align it with other projects, there were no code changes.

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.

### [`v8.48.0`](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/parser/CHANGELOG.md#8480-2025-11-24)

[Compare Source](typescript-eslint/typescript-eslint@v8.47.0...v8.48.0)

This was a version bump only for parser to align it with other projects, there were no code changes.

You can read about our [versioning strategy](https://typescript-eslint.io/users/versioning) and [releases](https://typescript-eslint.io/users/releases) on our website.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi4xNC4yIiwidXBkYXRlZEluVmVyIjoiNDIuMTQuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

Reviewed-on: https://git.csmpro.ru/csmpro/mapban/pulls/57
Co-authored-by: Renovate Bot <renovate@csmpro.ru>
Co-committed-by: Renovate Bot <renovate@csmpro.ru>
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.

Bug: [consistent-generic-constructors] improper fix into new Uint8Array<ArrayBufferLike>()

4 participants