Skip to content

feat: add rules to ensure Tailwind CSS is used properly

Paul Gascou-Vaillancourt requested to merge tailwind-interpolation into main

Adds the tailwind and vue-tailwind rules to ensure we are using Tailwind CSS properly across our codebases. At the moment, this prevents utility class names from being built using string interpolation which would confuse Tailwind's parser. In the future, this will be extended to disallow some features that might cause the CSS bundle size from growing out of control.

Screenshots

Offences in Js code
Screenshot_2024-08-27_at_5.10.38_PM
Offence in Vue template
Screenshot_2024-08-27_at_5.17.45_PM
Offence in Vue template
Screenshot_2024-08-27_at_5.18.42_PM

How to test this locally?

  1. Install yalc if you haven't already: https://github.com/wclr/yalc
  2. Checkout this branch and publish it with yalc:
    yalc publish
  3. In your GitLab repo or any other consumer you'd like to test this in, install the published development package:
    yalc add @gitlab/eslint-plugin
  4. In the project's .eslintrc, configure to rules to error out when offences are detected:
    '@gitlab/tailwind': error
    '@gitlab/vue-tailwind': error
Edited by Paul Gascou-Vaillancourt

Merge request reports

Loading