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: remove RuleTester in /utils in favour of the new /rule-tester package #6816

Merged
merged 5 commits into from Apr 28, 2023

Conversation

bradzacher
Copy link
Member

@bradzacher bradzacher commented Apr 2, 2023

BREAKING CHANGE:
Removes RuleTester from the @typescript-eslint/utils/eslint-utils package in favour of the new @typescript-eslint/rule-tester package.

PR Checklist

Overview

Migrates our codebase to use the package added in #6777 as a thorough test of the fork to make sure it works as expected.

  • Most changes were just to the file imports
  • Some tests I was able to remove the filename config. The old rule tester did file.tsx for JSX files - which actually didn't work at all because TS wouldn't pick up both file.ts and file.tsx.
  • I removed the batchedSingleLineTests util from some places - but it's probably worth removing it entirely in future (once I add snapshot tests we shouldn't need it)

@bradzacher bradzacher added the repo maintenance things to do with maintenance of the repo, and not with code/docs label Apr 2, 2023
@typescript-eslint
Copy link
Contributor

Thanks for the PR, @bradzacher!

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.

@nx-cloud
Copy link

nx-cloud bot commented Apr 2, 2023

☁️ Nx Cloud Report

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

📂 See all runs for this branch


✅ Successfully ran 32 targets

Sent with 💌 from NxCloud.

@JoshuaKGoldberg
Copy link
Member

JoshuaKGoldberg commented Apr 3, 2023

For future reviewing reference...

[...document.querySelectorAll(".file-header:has(.rgh-seen--11765709499)")]
    .filter(e => e.textContent.includes("packages/eslint-plugin/tests/rules/") && e.textContent.includes(".test.ts"))
    .forEach(e => e.querySelector("form label").click())

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.

🎊

} from '@typescript-eslint/utils/eslint-utils/rule-tester';

export { batchedSingleLineTests, getFixturesRootDir };
// TODO - migrate the codebase off of this utility
Copy link
Member

Choose a reason for hiding this comment

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

[Docs] Can you include a tracking GH issue?

@@ -63,6 +63,9 @@ function isDescribeWithSkip(
);
}

/**
* @deprecated use `@typescript-eslint/rule-tester` instead
Copy link
Member

Choose a reason for hiding this comment

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

[Docs] Can you also file a delection tracking issue & link to it here? I'm guessing it'll be a v7 breaking change.

Base automatically changed from fork-rule-tester to v6 April 27, 2023 03:12
@netlify
Copy link

netlify bot commented Apr 27, 2023

Deploy Preview for typescript-eslint ready!

Name Link
🔨 Latest commit a82d5e8
🔍 Latest deploy log https://app.netlify.com/sites/typescript-eslint/deploys/644b1cbe8f9d8a0007f476f6
😎 Deploy Preview https://deploy-preview-6816--typescript-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@bradzacher bradzacher added breaking change This change will require a new major version to be released and removed repo maintenance things to do with maintenance of the repo, and not with code/docs labels Apr 27, 2023
@bradzacher bradzacher changed the title chore: migrate codebase to use the new rule-tester package feat: remove RuleTester in /utils in favour of the new rule-tester package Apr 27, 2023
@bradzacher bradzacher changed the title feat: remove RuleTester in /utils in favour of the new rule-tester package feat: remove RuleTester in /utils in favour of the new rule-tester package Apr 27, 2023
@bradzacher
Copy link
Member Author

re-requesting reviews because I've made this a breaking change.
This completely removes RuleTester from /utils now - will update the blog post to point users at the new package

@bradzacher bradzacher changed the title feat: remove RuleTester in /utils in favour of the new rule-tester package feat: remove RuleTester in /utils in favour of the new /rule-tester package Apr 27, 2023
Comment on lines -277 to -290
errors: [
{
messageId: 'unsafeArraySpread',
line: 2,
column: 12,
endColumn: 25,
},
{
messageId: 'unsafeArraySpread',
line: 3,
column: 12,
endColumn: 28,
},
],
Copy link
Member

Choose a reason for hiding this comment

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

is there a reason why we are not preserving loine/col/endCol ?

its a good practice to add those to validate if error message is reported in correct place

Copy link
Member Author

Choose a reason for hiding this comment

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

because I couldn't be bothered remapping each one before and after the prettier format.
it already took long enough to extract and convert things away from the utility as it is.

soon™️ I'll implement snapshot testing in the fork which will snapshot an error underline and will make the line/col assertions unnecessary cruft anyways.

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.

Cute drawn Gengar-like creature dancing to the caption 'heck yes'

…v6-beta.md

Co-authored-by: Josh Goldberg ✨ <git@joshuakgoldberg.com>
@bradzacher bradzacher merged commit c33f497 into v6 Apr 28, 2023
44 of 46 checks passed
@bradzacher bradzacher deleted the v6-migrate-rule-tester branch April 28, 2023 04:10
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking change This change will require a new major version to be released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants