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

Add info to docs on how to prevent using incorrect twMerge #259

Open
dcastil opened this issue Jun 21, 2023 · 2 comments
Open

Add info to docs on how to prevent using incorrect twMerge #259

dcastil opened this issue Jun 21, 2023 · 2 comments
Labels
context-v1 Related to tailwind-merge v1 feature request

Comments

@dcastil
Copy link
Owner

dcastil commented Jun 21, 2023

When configuring tailwind-merge, one creates their own twMerge function to call. I should add a guide on how to prevent to accidentally use import { twMerge } from 'tailwind-merge' instead of import { twMerge } from 'src/my-own-tailwind-merge' and explain the ESLint rule I use for that.

@dcastil dcastil added the context-v1 Related to tailwind-merge v1 label Oct 30, 2023
@IEdiong
Copy link

IEdiong commented Aug 16, 2024

Hi @dcastil, any thought on how to go about this?

@dcastil
Copy link
Owner Author

dcastil commented Aug 17, 2024

@IEdiong I typically use ESLint to do that, more specifically the no-restricted-imports rule.

This is my config for it:

{
    "rules": {
        "no-restricted-imports": [
            "error",
            {
                "paths": [
                    {
                        "importNames": ["twMerge"],
                        "name": "tailwind-merge",
                        "message": "Please import { twMerge } from 'path/to/my/own/tailwind-merge'."
                    }
                ]
            }
        ]
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
context-v1 Related to tailwind-merge v1 feature request
Projects
None yet
Development

No branches or pull requests

2 participants