Lesson

Test Custom ESLint Rules with Vitest and RuleTester

Learn to test a Custom ESLint Rule using Vitest and RuleTester.

Access
Pro
Transcript
Available

Learn how to test custom ESLint rules with Vitest and RuleTester.

In the previous video, we created a custom eslint rule that gives us a warning when some of the class names don’t start with a lowercase letter.

Here, I'll show you how to test this or any other custom ESLint rule using unit tests without manually restarting the ESLint server or modifying production code to check if the rules work correctly. We'll look at the structure in which correct and incorrect code samples should be specific to RuleTester.

We'll also learn how to make our rule fixable and verify that the applied fix works as expected.