Skip to content

Conversation

@nayounsang
Copy link
Contributor

@nayounsang nayounsang commented Jun 20, 2025

PR Checklist

Overview

no-dynamic-tests

Ban these:

{
  invalid: {...spread},
  valid: identifier,
  invalid: bi + nary,
  valid: callExp(),
  invalid: `${templateLiteralWithDynamic()}`,
  valid: obj.member,
  invalid: condition? foo : bar,
}

For test case object, It validate these keys recursively: code, error.
No checks are performed on other keys.

Applied the rules to the test file in eslint-plugin & eslint-plugin-internal. Bulk suppression feature was applied.
Create the script to update suppression.

@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 20, 2025

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit c973039
🔍 Latest deploy log https://app.netlify.com/projects/typescript-eslint/deploys/68e3c39af134b500087b80f1
😎 Deploy Preview https://deploy-preview-11323--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: 81 (🟢 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.

@nx-cloud
Copy link

nx-cloud bot commented Jun 20, 2025

View your CI Pipeline Execution ↗ for commit c973039

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

☁️ Nx Cloud last updated this comment at 2025-10-06 13:33:46 UTC

@nayounsang nayounsang changed the title feat(eslint-plugin-internal) : Lint rule to ban dynamic syntax in generating tests feat(eslint-plugin-internal): Lint rule to ban dynamic syntax in generating tests Jun 20, 2025
@codecov
Copy link

codecov bot commented Jun 20, 2025

Codecov Report

❌ Patch coverage is 93.60000% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.69%. Comparing base (02e0278) to head (c973039).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...lint-plugin-internal/src/rules/no-dynamic-tests.ts 93.60% 8 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main   #11323    +/-   ##
========================================
  Coverage   90.68%   90.69%            
========================================
  Files         516      517     +1     
  Lines       52051    52176   +125     
  Branches     8598     8632    +34     
========================================
+ Hits        47202    47319   +117     
- Misses       4835     4843     +8     
  Partials       14       14            
Flag Coverage Δ
unittest 90.69% <93.60%> (+<0.01%) ⬆️

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

Files with missing lines Coverage Δ
...lint-plugin-internal/src/rules/no-dynamic-tests.ts 93.60% <93.60%> (ø)
🚀 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.

@nayounsang nayounsang changed the title feat(eslint-plugin-internal): Lint rule to ban dynamic syntax in generating tests feat(eslint-plugin-internal): [no-dynamic-tests] new internal Lint rule to ban dynamic syntax in generating tests Jun 20, 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.

LGTM, thanks! Only the one request for an added test is blocking IMO. Everything else is nitpicks that can be ignored if you don't like them. 🙂

@JoshuaKGoldberg JoshuaKGoldberg added the awaiting response Issues waiting for a reply from the OP or another party label Jun 23, 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.

🔥 thanks!

@JoshuaKGoldberg JoshuaKGoldberg added 1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge and removed awaiting response Issues waiting for a reply from the OP or another party labels Jun 24, 2025
Copy link
Member

@kirkwaiblinger kirkwaiblinger left a comment

Choose a reason for hiding this comment

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

I think that if we intend to use this ever, we should enable it already now for all the files that don't currently have violations. (Maybe even this is a good chance for us to try out the eslint bulk suppressions feature)?

Also, please do enable the rule on the codebase and have a look at the reports to see whether they make sense and would make sense to a contributor.

Thanks!

@kirkwaiblinger kirkwaiblinger added awaiting response Issues 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 labels Jul 6, 2025
@nayounsang

This comment was marked as resolved.

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.

LGTM. +1 to @kirkwaiblinger's suggestions on improving the reporting of the rule. I'll want to hear from Kirk before merging too.

@JoshuaKGoldberg JoshuaKGoldberg added the 1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge label Sep 15, 2025
Copy link
Member

@kirkwaiblinger kirkwaiblinger left a comment

Choose a reason for hiding this comment

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

(see comment)

@JoshuaKGoldberg JoshuaKGoldberg removed the 1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge label Sep 16, 2025
JoshuaKGoldberg
JoshuaKGoldberg previously approved these changes Oct 3, 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.

Looks great to me, thanks for jumping on this! 🙌

I'll note that the rule isn't completely covered by unit tests. But since it's internal & specific to this repo (for now?) I think that's fine.

@JoshuaKGoldberg JoshuaKGoldberg added the 1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge label Oct 3, 2025
@JoshuaKGoldberg JoshuaKGoldberg requested review from kirkwaiblinger and removed request for kirkwaiblinger October 3, 2025 12:06
@github-actions github-actions bot removed the 1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge label Oct 3, 2025
@JoshuaKGoldberg JoshuaKGoldberg merged commit aea862d into typescript-eslint:main Oct 6, 2025
68 checks passed
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.

Repo: Lint rule to ban dynamic syntax in generating tests

3 participants