Skip to content

Latest commit

 

History

History
123 lines (79 loc) · 3.69 KB

File metadata and controls

123 lines (79 loc) · 3.69 KB

Settings

Table of Contents



The settings object can be used to globally configure shared options across all rules. Global options will always be overridden by rule-specific options. To set the settings object, add a settings key to the eslint config.



// eslint.config.js
{
  // "plugins": {... },
  // "rules": { ... },
  "settings": {
    "better-tailwindcss": {
      // ...
    }
  }
}


entryPoint

The path to the entry file of the css based tailwind config (eg: src/global.css). If not specified, the plugin will fall back to the default configuration. Relative to the current working directory.
The tailwind config is used for various rules.

Type: string


tailwindConfig

The path to the tailwind.config.js file. If not specified, the plugin will try to find it automatically or falls back to the default configuration. Relative to the current working directory.
The tailwind config is used for various rules.

For Tailwind CSS v4 and the css based config, use the entryPoint option instead.

Type: string


tsconfig

The path to the tsconfig.json file. If not specified, the plugin will try to find it automatically.
Relative to the current working directory.

The tsconfig is used to resolve tsconfig path aliases.

Type: string
Default: undefined


cwd

The working directory used to resolve tailwindcss and related config files. This is useful for monorepos where linting runs from the repository root but each project has its own node_modules and Tailwind setup.

This path is resolved relative to the current working directory of the ESLint process. If not specified, it falls back to the current working directory of the ESLint process.

Type: string
Default: undefined


detectComponentClasses

Tailwind CSS v4 allows you to define custom component classes like card, btn, badge etc.

If you want to create such classes, you can set this option to true to allow the rule to detect those classes and not report them as unknown classes.

Type: boolean
Default: false


rootFontSize

The font size of the <html> element in pixels. By default, the root font size is 16px unless it is changed with CSS. If provided, this will be used to determine if arbitrary values can be replaced with predefined sizing scales.

Type: number | undefined
Default: undefined


messageStyle

Customize how linting messages are displayed.

"visual" visualizes whitespaces and line breaks for better readability.
"compact" displays visual message on a single line, better suitable for CI environments.
"raw" shows only the raw information without whitespace or line break visualization.

Type: "visual" | "compact" | "raw"
Default: "visual", "compact" in CI environments


selectors

Flat list of selectors that determines where Tailwind class strings are linted.

This controls what gets linted globally: only string literals matched by these selectors are treated as Tailwind class candidates.

Type: Array of Selectors
Default: See defaults API