Skip to content

@linaria/postcss-linaria: stylelint --fix drops the leading dot from an interpolated class selector #1501

Description

@aki05162525

Environment

  • @linaria/postcss-linaria: 8.1.1
  • Stylelint: 17.14.1
  • PostCSS: 8.5.23
  • Node.js: 24.16.0
  • OS: macOS

Description

stylelint --fix drops the . in front of an interpolated class selector, turning a class selector into a type selector:

- .${a} { color: red; }
+ ${a} { color: red; }

This reproduces with zero Stylelint rules configured, so the corruption happens during the parse/stringify round trip. Nothing is reported, and the compiled CSS silently targets a different element.

Reproduction

.stylelintrc.mjs:

export default {
  customSyntax: '@linaria/postcss-linaria',
  rules: {},
};

sample.style.ts:

import { css } from '@linaria/core';

const a = 'some-class';

export const style = css`
  .${a} { color: red; }
`;

Run:

stylelint --config .stylelintrc.mjs --fix sample.style.ts

Expected:

.${a} { color: red; }

Actual:

${a} { color: red; }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug report 🦗Issue is probably a bug, but it needs to be checkedneeds: complete repro 🖥️Issue need to have complete repro provided

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions