francoismassart / eslint-plugin-tailwindcss

ESLint plugin for Tailwind CSS usage
https://www.npmjs.com/package/eslint-plugin-tailwindcss
MIT License
1.47k stars 70 forks source link

Fix edge cases with whitespace in `enforces-shorthand` #308

Closed kachkaev closed 8 months ago

kachkaev commented 8 months ago

Description

I noticed a small bug when updating a side project to eslint-plugin-tailwindcss@3.14.0 and running pnpm fix:eslint. See commit history in https://github.com/kachkaev/website/pull/311.

Input:

<body className={`relative flex h-full w-full flex-col overflow-y-scroll px-5 pt-4 ${locale}`}>

Ouput:

<body className={`relative flex size-full flex-col overflow-y-scroll px-5 pt-4${locale}`}>

Expected output:

<body className={`relative flex size-full flex-col overflow-y-scroll px-5 pt-4 ${locale}`}>

This PR makes sure that a space is not removed between pt-4 and ${locale} when tailwindcss/enforces-shorthand does an autofix.

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

See new unit tests

Test Configuration:

CI

Checklist: