Skip to content

AndreyYolkin/stylelint-unocss-plugin

Repository files navigation

stylelint-unocss-plugin

Set (in the future) of rules to extend unocss support in stylelint

Install

pnpm install stylelint-unocss-plugin
npm install stylelint-unocss-plugin
yarn add stylelint-unocss-plugin

Usage

Default

/** @type {import('stylelint').Config} */
export default {
  plugins: ['stylelint-unocss-plugin'],
  rules: {
    'stylelint-unocss-plugin/no-missconfigured-theme-fn': true,
  },
}

With options

/** @type {import('stylelint').Config} */
export default {
  plugins: ['stylelint-unocss-plugin'],
  rules: {
    'stylelint-unocss-plugin/no-missconfigured-theme-fn': [
      true,
      {
        cwd: 'path/to/projectRoot',
        path: 'uno.config.ts',
      },
    ],
  },
}

Currently, only cwd and path options are supported.

See: UnoCSS Config

Rules

no-missconfigured-theme-fn

Highlights errors, caused by utilizing absent token inside theme() functions

Normal

image

Error

image

VS Code limitations

vscode-stylelint doesn't watch for changes in the uno file, so you'll need to restart Stylelint after changing the config.

To do this, you can press Ctrl+Shift+P and select Stylelint: Restart Stylelint Server.

About

Set (in the future) of rules to extend unocss support in stylelint

Resources

License

Stars

Watchers

Forks

Packages

No packages published