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

feat(typescript-estree): forbid invalid keys inEnumMember#11232

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

Open
fisker wants to merge12 commits intotypescript-eslint:main
base:main
Choose a base branch
Loading
fromfisker:non-computed-enum-member

Conversation

fisker
Copy link
Contributor

PR Checklist

Overview

@typescript-eslint
Copy link
Contributor

Thanks for the PR,@fisker!

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.

@netlifyNetlify
Copy link

netlifybot commentedMay 21, 2025
edited
Loading

Deploy Preview fortypescript-eslint ready!

NameLink
🔨 Latest commit8908efb
🔍 Latest deploy loghttps://app.netlify.com/projects/typescript-eslint/deploys/6848684af995370008782322
😎 Deploy Previewhttps://deploy-preview-11232--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: 94 (🔴 down 5 from production)
Accessibility: 100 (no change from production)
Best Practices: 92 (🔴 down 8 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 project configuration.

@nx-cloudNx Cloud
Copy link

nx-cloudbot commentedMay 21, 2025
edited
Loading

View yourCI Pipeline Execution ↗ for commit8908efb.

CommandStatusDurationResult
nx test eslint-plugin --coverage=false✅ Succeeded5m 7sView ↗
nx run-many -t typecheck✅ Succeeded2m 12sView ↗
nx test typescript-estree --coverage=false✅ Succeeded18sView ↗
nx test eslint-plugin-internal --coverage=false✅ Succeeded6sView ↗
nx run-many -t lint✅ Succeeded10sView ↗
nx run integration-tests:test✅ Succeeded<1sView ↗
nx run types:build✅ Succeeded4sView ↗
nx run generate-configs✅ Succeeded8sView ↗
Additional runs (27)✅ Succeeded...View ↗

☁️Nx Cloud last updated this comment at2025-06-10 17:27:17 UTC

@fiskerfiskerforce-pushed thenon-computed-enum-member branch from45c92cb to82e8533CompareMay 21, 2025 17:18
@fiskerfisker marked this pull request as draftMay 21, 2025 17:31
Comment on lines +636 to +637
// Unknown reason, can't get the correct type
const id = node.id as TSESTree.Identifier | TSESTree.StringLiteral;
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I think the build script is using the published package instead of local one. I tried to useworkspace:^, but still can't build.

Copy link
Member

Choose a reason for hiding this comment

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

it might be due to nx not seeing the changes toast-spec?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Do you know how to fix? Or should I leave it?

@codecovCodecov
Copy link

codecovbot commentedMay 21, 2025
edited
Loading

Codecov Report

Attention: Patch coverage is69.04762% with13 lines in your changes missing coverage. Please review.

Project coverage is 90.83%. Comparing base(8915a47) to head(8908efb).
Report is 37 commits behind head on main.

Files with missing linesPatch %Lines
packages/typescript-estree/src/convert.ts65.78%13 Missing⚠️
Additional details and impacted files
@@            Coverage Diff             @@##             main   #11232      +/-   ##==========================================- Coverage   90.85%   90.83%   -0.03%==========================================  Files         501      501                Lines       50901    50922      +21       Branches     8383     8381       -2     ==========================================+ Hits        46248    46253       +5- Misses       4638     4654      +16  Partials       15       15
FlagCoverage Δ
unittest90.83% <69.04%> (-0.03%)⬇️

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

Files with missing linesCoverage Δ
...kages/eslint-plugin/src/rules/naming-convention.ts97.79% <100.00%> (-0.02%)⬇️
...ackages/scope-manager/src/referencer/Referencer.ts97.93% <100.00%> (-0.01%)⬇️
packages/typescript-estree/src/convert.ts30.59% <65.78%> (+0.21%)⬆️

... and2 files with indirect coverage changes

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

@fiskerfisker marked this pull request as ready for reviewMay 21, 2025 19:52
@fisker
Copy link
ContributorAuthor

Wait formicrosoft/TypeScript#61772

@fiskerfisker marked this pull request as draftMay 27, 2025 20:22
@fisker
Copy link
ContributorAuthor

microsoft/TypeScript#61772 has been fixed.

@fiskerfisker marked this pull request as ready for reviewJune 8, 2025 08:56
@fiskerfiskerforce-pushed thenon-computed-enum-member branch fromf60ffa6 toe45b631CompareJune 8, 2025 08:58
@fiskerfisker marked this pull request as draftJune 8, 2025 09:04
@fiskerfisker changed the titlefeat(typescript-estree): forbid computedEnumMemberfeat(typescript-estree): forbid invalid keys inEnumMemberJun 8, 2025
@fiskerfisker marked this pull request as ready for reviewJune 8, 2025 09:15
Comment on lines +3211 to +3250
const computed = node.name.kind === ts.SyntaxKind.ComputedPropertyName;
if (computed) {
this.#throwUnlessAllowInvalidAST(
node.name,
'Computed property names are not allowed in enums.',
);
}
Copy link
Member

Choose a reason for hiding this comment

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

https://www.typescriptlang.org/play/?ts=5.9.0-dev.20250608#code/KYOwrgtgBAYg9nKBvAsAKClA2gcgII4C6UAvFAIzoC+6QA

It looks like computed members are still allowed in the nightly (which includes the fix formicrosoft/TypeScript#61772)

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

microsoft/TypeScript#61772 forbids bigint, may computed string literals not be forbidden? I'll ask.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

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

Added a test for it8908efb (#11232), TS already confirmed it's bug. Should be good to forbid.

Comment on lines +636 to +637
// Unknown reason, can't get the correct type
const id = node.id as TSESTree.Identifier | TSESTree.StringLiteral;
Copy link
Member

Choose a reason for hiding this comment

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

it might be due to nx not seeing the changes toast-spec?

@bradzacherbradzacher added awaiting responseIssues waiting for a reply from the OP or another party ASTPRs and Issues about the AST structure labelsJun 9, 2025
@fiskerfiskerforce-pushed thenon-computed-enum-member branch from2d56333 tofcc7712CompareJune 10, 2025 17:11
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@bradzacherbradzacherbradzacher requested changes

Requested changes must be addressed to merge this pull request.

Assignees
No one assigned
Labels
ASTPRs and Issues about the AST structureawaiting responseIssues waiting for a reply from the OP or another party
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@fisker@bradzacher

[8]ページ先頭

©2009-2025 Movatter.jp