Skip to content

[BUG] no-unnecessary-arbitrary-value does not support color object syntax #407

@Grapedge

Description

@Grapedge

Describe the bug
When using the color-object-syntax, this plugin fails to correctly detect unnecessary arbitrary values.

To Reproduce

var config = [
  {
    config: {
      theme: {
        colors: {
          blue: {
            50: "#abcdef",
          },
          "blue-100": "#123456",
        },
      },
    },
  },
];

ruleTester.run("arbitrary-values", rule, {
  valid: [],
  invalid: [
    {
      // AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: []
      code: `<pre class="text-[#abcdef]">text-[#abcdef]</pre>`,
      options: config,
      output: `<pre class="text-blue-50">text-[#abcdef]</pre>`,
      errors: generateErrors(["text-[#abcdef]"], [["text-blue-50"]]),
    },
    {
      // This works correctly
      code: `<pre class="text-[#123456]">text-[#123456]</pre>`,
      options: config,
      output: `<pre class="text-blue-100">text-[#123456]</pre>`,
      errors: generateErrors(["text-[#123456]"], [["text-blue-100"]]),
    },
  ],
});

Screenshots

Image Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions