43081j / 43081j/postcss-styled-components
Autofix generates invalid code with nested style blocks
- 主要言語
- TypeScript
- スター
- 12
- フォーク
- 1
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Test case 1:
```tsx
const Div = styled.div`
${css`
color: blue;
`}
`;
```
This code yields the error `Skipping template… as it included either invalid syntax or complex expressions the plugin could not interpret`, as described at #7.
Test case 2:
```tsx
const Div = styled.div`
${css`
color: blue;
`}
div {
position: absolute;
}
`;
```
This yields the error `Unexpected unknown type selector "POSTCSS_styled-components_0" (selector-type-no-unknown)` on the `${}` line. But what's really strange is what happens if you run stylelint with `--fix`. The output is this invalid code:
```tsx
const Div = styled.div`
${css`
color: blue;
`}
div {
position: absolute;
}
color: blue;
`}
div {
position: absolute;
}
`;
```
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
Look at the parser in src/syntax.js and the transformer in src/transformer.js. The bug occurs when nested template literals with css blocks are processed. Start by reproducing the error with the given test cases, then trace how the plugin handles interpolation and nested style blocks. Check the output after autofix to see where duplication happens.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- developer-experience, tooling
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 55/100