1.0.5 • Published 1 year ago

@arabasta/eslint-plugin-no-testing-library-without-cleanup v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@arabasta/eslint-plugin-no-testing-library-without-cleanup

NPM Version NPM License

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-cleanup

Usage

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

RuleDescription
no-testing-library-without-cleanupEnforce 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

1.0.5

1 year ago

1.0.4

1 year ago

1.0.2

1 year ago

1.0.3

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago