Enforces canonical Tailwind CSS class spellings with --fix support. Same suggestions as the Tailwind language server, applied repo-wide via oxlint --fix.

Only rewrites the spelling of individual classes. Does not reorder, dedupe, or collapse utilities (use oxfmt sortTailwindcss for that).

npm install --save-dev oxlint oxlint-plugin-tailwind-canonical tailwindcssRequires Tailwind CSS v4 and Node 22+.

In oxlint.config.ts:

import { defineConfig } from 'oxlint';

export default defineConfig({

jsPlugins: [

{

name: 'tailwind-canonical',

specifier: 'oxlint-plugin-tailwind-canonical',

},

],

rules: {

'tailwind-canonical/canonical-class-names': [

'warn',

{ cssPath: './src/styles.css' },

],

},

});Then run oxlint --fix.

Options:

- cssPath(required) — Tailwind v4 entry CSS, absolute or relative to cwd.

- rootFontSize— px value for- remnormalization. Default- 16.

- attributes— JSX attributes treated as class lists. Default- ["class", "className"].

- calleeFunctions— helpers whose string args are treated as class lists. Default- ["cn", "clsx", "cva", "twMerge", "tw", "classNames", "cx"].

Strings with ${} interpolations are skipped.

MIT