1.0.5 • Published 2 years ago
@arabasta/eslint-plugin-no-testing-library-without-cleanup v1.0.5
@arabasta/eslint-plugin-no-testing-library-without-cleanup
ESLint plugin that enforces the usage of the cleanup function when importing from Testing Library.
Installation
Assuming you already have ESLint installed, run:
# npm
npm install --save-dev @arabasta/eslint-plugin-no-testing-library-without-cleanup
# yarn
yarn add --dev @arabasta/eslint-plugin-no-testing-library-without-cleanup
# pnpm
pnpm add --save-dev @arabasta/eslint-plugin-no-testing-library-without-cleanupUsage
Flat config (eslint.config.js)
// ...
import noTestingLibraryWithoutCleanup from '@arabasta/eslint-plugin-no-testing-library-without-cleanup';
export default [
// ...
noTestingLibraryWithoutCleanup.configs.recommended,
];Legacy config (.eslintrc)
{
"extends": [
// ...
"plugin:@arabasta/no-testing-library-without-cleanup/recommended-legacy"
]
}Rules
✅ Set in the recommended configuration
| Rule | Description | ✅ |
|---|---|---|
| no-testing-library-without-cleanup | Enforce the usage of the cleanup function when importing from Testing Library | ✅ |
no-testing-library-without-cleanup
Examples of incorrect code for this rule:
import { renderHook } from '@testing-library/react';
renderHook();Examples of correct code for this rule:
import { cleanup, renderHook } from '@testing-library/react';
cleanup();
renderHook();License
MIT