Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(rule-tester): stricter rule test validations #9086

Merged

Conversation

Vinccool96
Copy link
Contributor

PR Checklist

Overview

Brings in changes from eslint/eslint#17654. This is pretty much a copy & paste.

@typescript-eslint
Copy link
Contributor

Thanks for the PR, @Vinccool96!

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.

Copy link

netlify bot commented May 13, 2024

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit 3bdc61e
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/6686389c7fa35000084015a2
😎 Deploy Preview https://deploy-preview-9086--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: 98 (🟢 up 4 from production)
Accessibility: 100 (no change from production)
Best Practices: 92 (no change from production)
SEO: 90 (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 site configuration.

@Vinccool96 Vinccool96 changed the title feat(rule-tester): Stricter rule test validations feat(rule-tester): stricter rule test validations May 13, 2024
Copy link

nx-cloud bot commented May 13, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 3bdc61e. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

packages/rule-tester/src/RuleTester.ts Outdated Show resolved Hide resolved
packages/rule-tester/src/RuleTester.ts Show resolved Hide resolved
packages/rule-tester/tests/eslint-base/eslint-base.test.js Outdated Show resolved Hide resolved
@auvred auvred added the awaiting response Issues waiting for a reply from the OP or another party label May 13, 2024
@Vinccool96 Vinccool96 force-pushed the feat/stricter-rule-test-validations branch from aca9d06 to bde1e6e Compare May 13, 2024 15:19
@Vinccool96
Copy link
Contributor Author

Vinccool96 commented May 13, 2024

I'm gonna need some help for the failing tests

Never mind, there was way less things to fix than I thought.

@Vinccool96 Vinccool96 force-pushed the feat/stricter-rule-test-validations branch from 901db33 to 6e71280 Compare May 13, 2024 20:15
@Vinccool96 Vinccool96 requested a review from auvred May 13, 2024 21:19
@github-actions github-actions bot removed the awaiting response Issues waiting for a reply from the OP or another party label May 13, 2024
@Vinccool96 Vinccool96 force-pushed the feat/stricter-rule-test-validations branch 2 times, most recently from 06d3edf to 5f55140 Compare May 26, 2024 17:09
@Vinccool96
Copy link
Contributor Author

@auvred Is everything good to merge?

@Vinccool96 Vinccool96 force-pushed the feat/stricter-rule-test-validations branch from 5f55140 to cbdf415 Compare May 27, 2024 14:07
@bradzacher bradzacher added the enhancement New feature or request label May 28, 2024
Copy link
Member

@auvred auvred left a comment

Choose a reason for hiding this comment

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

Left a few minor requests but overall looks great!


Btw, there is no need to ping individuals for review. We have a queue and we get to things when we can. https://typescript-eslint.io/contributing/pull-requests

packages/rule-tester/src/RuleTester.ts Outdated Show resolved Hide resolved
packages/rule-tester/src/RuleTester.ts Outdated Show resolved Hide resolved
packages/rule-tester/tests/eslint-base/eslint-base.test.js Outdated Show resolved Hide resolved
packages/rule-tester/tests/eslint-base/eslint-base.test.js Outdated Show resolved Hide resolved
@auvred auvred added the awaiting response Issues waiting for a reply from the OP or another party label May 30, 2024
@Vinccool96 Vinccool96 force-pushed the feat/stricter-rule-test-validations branch 3 times, most recently from 7ff0f76 to c13178a Compare June 3, 2024 13:39
@Vinccool96 Vinccool96 requested a review from auvred June 3, 2024 16:23
@github-actions github-actions bot removed the awaiting response Issues waiting for a reply from the OP or another party label Jun 3, 2024
@Vinccool96 Vinccool96 force-pushed the feat/stricter-rule-test-validations branch from a2715a0 to b121617 Compare June 4, 2024 18:02
@Vinccool96 Vinccool96 force-pushed the feat/stricter-rule-test-validations branch 3 times, most recently from 40ec555 to e761ee1 Compare June 6, 2024 14:45
@Vinccool96 Vinccool96 force-pushed the feat/stricter-rule-test-validations branch from e761ee1 to 271d694 Compare June 17, 2024 13:46
@Vinccool96 Vinccool96 force-pushed the feat/stricter-rule-test-validations branch from 271d694 to c94ed24 Compare June 25, 2024 14:30
@Vinccool96
Copy link
Contributor Author

Sorry for the force pushes, I'm used to do rebase updates

@Vinccool96 Vinccool96 requested a review from auvred June 27, 2024 13:40
@github-actions github-actions bot removed the awaiting response Issues waiting for a reply from the OP or another party label Jun 27, 2024
Copy link
Member

@auvred auvred left a comment

Choose a reason for hiding this comment

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

Did you check this comment? #9086 (comment)

We still miss this assertion

@Vinccool96
Copy link
Contributor Author

Vinccool96 commented Jun 27, 2024

@auvred
Copy link
Member

auvred commented Jun 27, 2024

On main there are two different assertions:

const unsubstitutedPlaceholders =
getUnsubstitutedMessagePlaceholders(
message.message,
rule.meta.messages[message.messageId],
error.data,
);
assert.ok(
unsubstitutedPlaceholders.length === 0,
`The reported message has ${unsubstitutedPlaceholders.length > 1 ? `unsubstituted placeholders: ${unsubstitutedPlaceholders.map(name => `'${name}'`).join(', ')}` : `an unsubstituted placeholder '${unsubstitutedPlaceholders[0]}'`}. Please provide the missing ${unsubstitutedPlaceholders.length > 1 ? 'values' : 'value'} via the 'data' property in the context.report() call.`,
);

const unsubstitutedPlaceholders =
getUnsubstitutedMessagePlaceholders(
actualSuggestion.desc,
rule.meta.messages[expectedSuggestion.messageId],
expectedSuggestion.data,
);
assert.ok(
unsubstitutedPlaceholders.length === 0,
`The message of the suggestion has ${unsubstitutedPlaceholders.length > 1 ? `unsubstituted placeholders: ${unsubstitutedPlaceholders.map(name => `'${name}'`).join(', ')}` : `an unsubstituted placeholder '${unsubstitutedPlaceholders[0]}'`}. Please provide the missing ${unsubstitutedPlaceholders.length > 1 ? 'values' : 'value'} via the 'data' property for the suggestion in the context.report() call.`,
);

@Vinccool96
Copy link
Contributor Author

Alright, let me plop it back in

@Vinccool96
Copy link
Contributor Author

The prodigal son has returned

@Vinccool96 Vinccool96 requested a review from auvred June 27, 2024 15:07
auvred
auvred previously approved these changes Jun 27, 2024
Copy link
Member

@auvred auvred left a comment

Choose a reason for hiding this comment

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

Thanks for working on this!

@auvred auvred added the 1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge label Jun 27, 2024
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.

The tests for this looked like a real slog, thanks so much for doing this! 🙌

Just a couple of teeny suggestions. Nothing major from me. We can apply them before merging if you don't get a chance before our Monday release.

packages/rule-tester/src/RuleTester.ts Outdated Show resolved Hide resolved
packages/rule-tester/src/RuleTester.ts Outdated Show resolved Hide resolved
@Vinccool96 Vinccool96 dismissed stale reviews from JoshuaKGoldberg and auvred via cc5a70b June 29, 2024 14:53
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! 🙌

@Vinccool96
Copy link
Contributor Author

Had to merge since the main branch had tests that would've failed with the stricter rule tester (tests added by me, what was I thinking!)

@auvred auvred merged commit 7e2b77d into typescript-eslint:main Jul 4, 2024
63 checks passed
@Vinccool96 Vinccool96 deleted the feat/stricter-rule-test-validations branch July 4, 2024 12:35
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1 approval >=1 team member has approved this PR; we're now leaving it open for more reviews before we merge enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enhancement(rule-tester): Stricter rule test validations
4 participants