Skip to content

Rules do not work with custom name library name #173

Closed
@stefcameron

Description

@stefcameron

I love the no-debug rule, however, it doesn't work if you're using a custom local library name in order to, for example, provide a custom render function to the rest of your code.

I agree that the library name is no longer @testing-library/react, for example, and could be anything, so the rule doesn't find a match, but because customizing the render function is in the docs, and I presume quite standard practice, it makes this rule an immediate non-starter, which is a shame since the rule would be really nice to have.

Seems like the rule needs an option, similar to the existing renderFunctions option, that we can use to specify the name of our import. In my case, it's import ... from 'testingUtility'.

import { screen } from '@testing-library/react';
...
screen.debug(); // IS a lint error

however,

import { screen } from 'testingUtility';
...
screen.debug(); // is NOT a lint error -- and should be

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions