-
-
Notifications
You must be signed in to change notification settings - Fork 18
Description
Over the past few months, I've been working on a major overhaul of the eslint-plugin-better-tailwindcss plugin. This new version brings a lot of improvements, some new features, and some breaking changes to enhance the experience with TailwindCSS linting.
There is still a bit of work to be done, but my goal is to release the new version before the end of the year.
You can help by testing the beta version and provide feedback in this issue.
npm i eslint-plugin-better-tailwindcss@betaYou can also support my work via GitHub Sponsors. I truly appreciate everyone who has supported me so far!
Changes
All changes are listed in the CHANGELOG. Here are the most important ones:
Features:
- New rule:
enforce-canonical-classes(#232) - New options for
enforce-consistent-class-orderto sort "component classes" and "unknown classes" (#263)detectComponentClasses:booleancomponentClassOrder:"asc" | "desc" | "preserve"componentClassPosition:"start" | "end"unknownClassOrder:"asc" | "desc" | "preserve"unknownClassPosition:"start" | "end"
- Better Performance
⚠️ Breaking Changes
First of all, the minimum required Node.js version is has changed to support v23.0.0, v22.12.0, v20.19.0 to support require(esm)
- This allowed me to remove the
CommonJSbuild (#264)
Some rules have been renamed to better reflect their intentions:
- Renamed rule
no-unregistered-classestono-unknown-classes - Renamed rule
sort-classestoenforce-consistent-class-order - Renamed rule
multilinetoenforce-consistent-line-wrapping
For some rules, the options have been renamed or changed:
- Options for
better-tailwindcss/enforce-consistent-variable-syntaxhave been renamed toshorthandandvariable. - The default for
enforce-consistent-important-positionis now alwaysrecommended.
If you are on tailwindcss v3 need to manually set it tolegacyto keep it working for tailwindcss v3. - Renamed the
improvedsorting order forenforce-consistent-class-ordertostrict(#245)improvedis no longer the default option as most people expect the order to match the official order from tailwind.- the
improvedorder got renamed tostrictto better describe its intentions. - the logic of the
strictorder has changed:- Classes that share the same base variants get grouped together.
- Classes with less variants come before classes with more variants.
- Classes with arbitrary variants come last.
- The
enforce-consistent-line-wrappingrule now groups variants more strictly. Previously it only grouped classes by their first variant. Now all variants are ordered correctly.
The configs have been renamed and updated to match the recommended shape of ESLint.
- Renamed configs (#244)
- The following configs are now exposed:
recommendedrecommended-warnrecommended-errorstylisticstylistic-warnstylistic-errorcorrectnesscorrectness-warncorrectness-errorlegacy-recommendedlegacy-recommended-warnlegacy-recommended-errorlegacy-stylisticlegacy-stylistic-warnlegacy-stylistic-errorlegacy-correctnesslegacy-correctness-warnlegacy-correctness-error
- Please check the updated Parser Documentation to see the recommended way to set up the plugin with your parser.
- The following configs are now exposed:
Other changes:
- Function
getDefaultIgnoredUnregisteredClasses()has been removed. - Removed rule regex matchers
- Preserve normal quotes whenever possible (#246)