Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(eslint-plugin): [no-unnecessary-type-assertion] handle literal types#10523

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@mdm317
Copy link
Contributor

@mdm317mdm317 commentedDec 19, 2024
edited by JoshuaKGoldberg
Loading

PR Checklist

Overview

Add case when cast type is a template literal or a union type that is string-like.

@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 onhttps://opencollective.com/typescript-eslint.

@mdm317mdm317 marked this pull request as draftDecember 19, 2024 16:00
@netlify
Copy link

netlifybot commentedDec 19, 2024
edited
Loading

Deploy Preview fortypescript-eslint ready!

NameLink
🔨 Latest commita6786eb
🔍 Latest deploy loghttps://app.netlify.com/sites/typescript-eslint/deploys/677a37ce8eca9a000881a28e
😎 Deploy Previewhttps://deploy-preview-10523--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 8 from production)
Accessibility: 100 (no change from production)
Best Practices: 92 (no change from production)
SEO: 98 (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 yourNetlify site configuration.

@nx-cloud
Copy link

nx-cloudbot commentedDec 19, 2024
edited
Loading

View yourCI Pipeline Execution ↗ for commita6786eb.

CommandStatusDurationResult
nx run-many --target=build --exclude website --...✅ Succeeded2sView ↗
nx run-many --target=clean✅ Succeeded10sView ↗

☁️Nx Cloud last updated this comment at2025-01-05 19:31:13 UTC

@codecov
Copy link

codecovbot commentedDec 19, 2024
edited
Loading

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.91%. Comparing base(4dbf48b) to head(a6786eb).
Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@##             main   #10523   +/-   ##=======================================  Coverage   86.90%   86.91%           =======================================  Files         446      446             Lines       15502    15509    +7       Branches     4516     4519    +3     =======================================+ Hits        13472    13479    +7  Misses       1675     1675             Partials      355      355
FlagCoverage Δ
unittest86.91% <100.00%> (+<0.01%)⬆️

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

Files with missing linesCoverage Δ
...-plugin/src/rules/no-unnecessary-type-assertion.ts97.97% <100.00%> (+0.02%)⬆️

... and2 files with indirect coverage changes

@mdm317mdm317 marked this pull request as ready for reviewDecember 20, 2024 11:53
Copy link
Member

@JoshuaKGoldbergJoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

LGTM! Just requesting changes on naming and removing thenoFormat. Thanks!

@JoshuaKGoldbergJoshuaKGoldberg added the awaiting responseIssues waiting for a reply from the OP or another party labelDec 30, 2024
@github-actionsgithub-actionsbot removed the awaiting responseIssues waiting for a reply from the OP or another party labelJan 2, 2025
JoshuaKGoldberg
JoshuaKGoldberg previously approved these changesJan 2, 2025
Copy link
Member

@JoshuaKGoldbergJoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

🪨

mdm317 reacted with thumbs up emoji
@JoshuaKGoldbergJoshuaKGoldberg added the 1 approval>=1 team member has approved this PR; we're now leaving it open for more reviews before we merge labelJan 2, 2025
Copy link
Member

@ronamironami left a comment
edited
Loading

Choose a reason for hiding this comment

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

Looking great! Just requesting minor changes around testing 🏆

Edit: I'm not sure if it's too fringe, but I did see one regression with thereadonly modifier (main branch playground link,deploy preview playground link).


constwouldSameTypeBeInferred=
castType.isLiteral()||
isAssertionTypeTemplateLiteral||
Copy link
Member

Choose a reason for hiding this comment

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

[Testing]: No tests fail if this is omitted (isAssertionTypeTemplateLiteral ||), let's simplify or add a test case?

mdm317 reacted with thumbs up emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Thanks for the review. I think it would be better to simplify logic for this issue.

ronami reacted with heart emoji
@JoshuaKGoldbergJoshuaKGoldberg added awaiting responseIssues waiting for a reply from the OP or another party and removed 1 approval>=1 team member has approved this PR; we're now leaving it open for more reviews before we merge labelsJan 3, 2025
@mdm317mdm317 requested a review fromronamiJanuary 5, 2025 08:16
@github-actionsgithub-actionsbot removed the awaiting responseIssues waiting for a reply from the OP or another party labelJan 5, 2025
Copy link
Member

@ronamironami left a comment

Choose a reason for hiding this comment

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

Thanks 👍

@ronamironami added the 1 approval>=1 team member has approved this PR; we're now leaving it open for more reviews before we merge labelJan 5, 2025
@JoshuaKGoldbergJoshuaKGoldberg merged commit82716b8 intotypescript-eslint:mainJan 6, 2025
65 checks passed
@ronami
Copy link
Member

This was on my mind, and I missed it when I reviewed the PR yesterday, but I did notice this one regression (playground link,deploy preview playground link):

conststate:"expired"|"pending"="pending";functionmain(){return{// correctly reported previously, now doesn't reporttype:stateas"expired"|"pending"};}

I'll open a separate issue about it.

mdm317 and JoshuaKGoldberg reacted with heart emoji

@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commentedJan 6, 2025
edited
Loading

Ah, it's both class properties and object properties:

classExample{type=stateas'expired'|'pending'}

I'm going to go ahead and revert this before it gets into the weekly release today - I think the logic will need to be more intricate.

renovatebot added a commit to mmkal/eslint-plugin-mmkal that referenced this pull requestJan 6, 2025
##### [v8.19.1](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8191-2025-01-06)##### 🩹 Fixes-   **eslint-plugin:** \[no-unnecessary-type-assertion] handle literal types ([#10523](typescript-eslint/typescript-eslint#10523))-   **eslint-plugin:** \[no-deprecated] doesn't report on shorthand property in an object expression ([#10550](typescript-eslint/typescript-eslint#10550))-   **eslint-plugin:** \[strict-boolean-expressions] remove remaining (unsafe) autofixes ([#10548](typescript-eslint/typescript-eslint#10548))-   **eslint-plugin:** \[no-shadow] report correctly on parameters of functions declared with the `declare` keyword ([#10543](typescript-eslint/typescript-eslint#10543))-   **eslint-plugin:** \[no-base-to-string] check array generic type ([#10437](typescript-eslint/typescript-eslint#10437))##### ❤️ Thank You-   Kirk Waiblinger-   mdm317-   Ronen Amiel-   Yukihiro Hasegawa [@y-hsgw](https://github.com/y-hsgw)You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.
renovatebot added a commit to andrei-picus-tink/auto-renovate that referenced this pull requestJan 6, 2025
| datasource | package                          | from   | to     || ---------- | -------------------------------- | ------ | ------ || npm        | @typescript-eslint/eslint-plugin | 8.19.0 | 8.19.1 || npm        | @typescript-eslint/parser        | 8.19.0 | 8.19.1 |## [v8.19.1](https://github.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#8191-2025-01-06)##### 🩹 Fixes-   **eslint-plugin:** \[no-unnecessary-type-assertion] handle literal types ([#10523](typescript-eslint/typescript-eslint#10523))-   **eslint-plugin:** \[no-deprecated] doesn't report on shorthand property in an object expression ([#10550](typescript-eslint/typescript-eslint#10550))-   **eslint-plugin:** \[strict-boolean-expressions] remove remaining (unsafe) autofixes ([#10548](typescript-eslint/typescript-eslint#10548))-   **eslint-plugin:** \[no-shadow] report correctly on parameters of functions declared with the `declare` keyword ([#10543](typescript-eslint/typescript-eslint#10543))-   **eslint-plugin:** \[no-base-to-string] check array generic type ([#10437](typescript-eslint/typescript-eslint#10437))##### ❤️ Thank You-   Kirk Waiblinger-   mdm317-   Ronen Amiel-   Yukihiro Hasegawa [@y-hsgw](https://github.com/y-hsgw)You can read about our [versioning strategy](https://main--typescript-eslint.netlify.app/users/versioning) and [releases](https://main--typescript-eslint.netlify.app/users/releases) on our website.
@github-actionsgithub-actionsbot locked asresolvedand limited conversation to collaboratorsJan 14, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@ronamironamironami approved these changes

@JoshuaKGoldbergJoshuaKGoldbergJoshuaKGoldberg left review comments

Assignees

No one assigned

Labels

1 approval>=1 team member has approved this PR; we're now leaving it open for more reviews before we merge

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Bug: [no-unnecessary-type-assertion] False report with an 'as' assertion

3 participants

@mdm317@ronami@JoshuaKGoldberg

[8]ページ先頭

©2009-2025 Movatter.jp