Skip to content

Conversation

@nayounsang
Copy link
Contributor

@nayounsang nayounsang commented Jun 28, 2025

PR Checklist

Overview

ref: https://github.com/estree/estree/blob/2bc9ea235184b6164e31b1088575447657e686c6/es2018.md?plain=1#L34

  • change type of cooked in the ast-spec
    • also update snapshot
  • eval string to check for incorrect escaping
  • add test case
  • affected these rule
    • plugin-test-formatting : ignore when cooked is null
    • no-unsafe-assignment: ignore when cooked is null
    • no-duplicate-enum-values: There can be no null case. If value is tagged, it causes ts error and the existing logic only assumes that it is not tagged.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @nayounsang!

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 Jun 28, 2025

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 50871ad
🔍 Latest deploy log https://app.netlify.com/projects/typescript-eslint/deploys/692ebeaf76d9910008d33dd7
😎 Deploy Preview https://deploy-preview-11355--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 4 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.

@nayounsang nayounsang marked this pull request as draft June 28, 2025 08:59
@nayounsang nayounsang changed the title fix(typescript-estree): If the template literal is tagged and the text has an invalid escape, cooked will be null fix(typescript-estree): if the template literal is tagged and the text has an invalid escape, cooked will be null Jun 28, 2025
@nx-cloud
Copy link

nx-cloud bot commented Jun 28, 2025

View your CI Pipeline Execution ↗ for commit f43e69b

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

☁️ Nx Cloud last updated this comment at 2025-09-15 13:21:30 UTC

@nayounsang
Copy link
Contributor Author

nayounsang commented Jun 28, 2025

It's strange. In my local, I cleared the cache and the changed types were built in the types package. Isn't the CI environment a new virtual machine that runs anyway?


typescript-estree has a dependency on types. TemplateElement comes from types
TemplateElement in types is auto-generated by ast-spec.
In nx cloud, types is hitting cache in CI.
So, changes are not updated and an error occurs.
Do I need to do something separate?

@nayounsang
Copy link
Contributor Author

nayounsang commented Jul 20, 2025

hi @JamesHenry
Thank you for your efforts on this difficult problem.

  • Can I continue working on this PR?
  • Is it okay if I merge with the main branch and resolve conflicts freely?
  • If CI-related work is not completed, can I help?

@JamesHenry
Copy link
Member

@nayounsang Yes, sorry I forgot about this one, I obviously kept iterating on your other one to discover that one wasn't a caching issue. This one might be related to your other one or it might be totally separate.

Please revert my changes when you fix up the conflicts and let's get back to a clean slate. If it's still failing unexpectedly after that I can take another look

@JamesHenry
Copy link
Member

@nayounsang I see you're doing a lot of pushes that result in failed tasks. Are you running these things locally before pushing? Ideally you would iterate locally to get the high priority tasks passing and then push up to CI to verify in a neutral environment

@nayounsang
Copy link
Contributor Author

CI is failed again.. I guess more work is needed

@github-actions github-actions bot removed the awaiting response Issues waiting for a reply from the OP or another party label Sep 14, 2025
@nayounsang nayounsang requested a review from fisker September 14, 2025 16:42
@JoshuaKGoldberg JoshuaKGoldberg added the awaiting response Issues waiting for a reply from the OP or another party label Sep 15, 2025
@nayounsang nayounsang requested a review from fisker November 19, 2025 11:42
@github-actions github-actions bot removed the awaiting response Issues waiting for a reply from the OP or another party label Nov 19, 2025
@bradzacher bradzacher added the awaiting response Issues waiting for a reply from the OP or another party label Nov 23, 2025
@nayounsang nayounsang requested a review from bradzacher December 2, 2025 10:29
@github-actions github-actions bot removed the awaiting response Issues waiting for a reply from the OP or another party label Dec 2, 2025
) {
key = receiverProperty.key.quasis[0].value.cooked;
const cooked = receiverProperty.key.quasis[0].value.cooked;
if (cooked == null) {
Copy link
Member

Choose a reason for hiding this comment

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

This is an impossible condition (and the test provided doesn't reach it).

This branch refers to keys whose node type is a TemplateLiteral... Which necessarily means they are untagged. If it were tagged it would have the TaggedTemplateExpression.

Suggestion:
Use nullThrows() instead

value = member.initializer.quasis[0].value.cooked;
// cooked can only be null inside a TaggedTemplateExpression, which is not possible.
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
value = member.initializer.quasis[0].value.cooked!;
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion: Use nullThrows() here instead

node,
),
});
const result = this.createNode<TSESTree.TaggedTemplateExpression>(
Copy link
Member

Choose a reason for hiding this comment

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

Revert?

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: Wrong cooked value of TemplateElement in TaggedTemplateExpression

6 participants