tailwind-merge
tailwind-merge copied to clipboard
Add info to docs on how to prevent using incorrect `twMerge`
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.
Hi @dcastil, any thought on how to go about this?
@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'."
}
]
}
]
}
}