Skip to content

SW01003: Invalid lint configuration

A lint rule has an option value that the compiler cannot use.

This error occurs when a lint rule has an option value that the compiler cannot use, such as an unknown unit or an empty list that the rule requires. The message names the rule and the value.

Reported

stillwind.config.ts
import { defineConfig } from "stillwind/config";

export default defineConfig({
  projects: [
    {
      css: "./src/stillwind.css",
      files: ["src/**/*.tsx"],
      lint: {
        rules: {
          "no-restricted-length-units": {
            severity: "warn",
            rules: [{ properties: ["width"], disallow: ["pixels"] }],
          },
        },
      },
    },
  ],
});

SW01003: invalid `no-restricted-length-units` lint configuration: rules require property patterns and valid CSS length units

Fixed

stillwind.config.tsts
import { defineConfig } from "stillwind/config";

export default defineConfig({
  projects: [
    {
      css: "./src/stillwind.css",
      files: ["src/**/*.tsx"],
      lint: {
        rules: {
          "no-restricted-length-units": {
            severity: "warn",
            rules: [{ properties: ["width"], disallow: ["px"] }],
          },
        },
      },
    },
  ],
});

How to fix

  • Correct the value named in the message. In the example, the unit is px, not pixels.
  • Give the rules that need a list, such as no-restricted-theme-tokens, at least one entry.

Each lint rule page describes its options.