43081j / 43081j/postcss-styled-components

Declarations that use interpolations with Props seem to be ignored

オープン
#8 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
12
フォーク
1
PR マージ指標
30日以内にマージされた PR はありません

説明

Emotion allows changing styles based on Props ( https://emotion.sh/docs/styled#changing-based-on-props ).
Right now declarations using this synthax seem to be ignored by the linter.

I think that for example the following cases should result in an error:

Example 1:
https://stylelint.io/user-guide/rules/declaration-block-no-duplicate-properties

```
const Button = styled.button`
color: ${props => (props.primary ? 'hotpink' : 'turquoise')};
color: ${props => (props.primary ? 'hotpink' : 'turquoise')};
`
```

Example 2:
https://stylelint.io/user-guide/rules/color-no-invalid-hex

```
const Button = styled.button`
color: ${(props) => (props.primary ? '#f00' : '#00')};
`;
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

この issue は、styled-components で Props を使う補間を含むスタイル宣言を linter が無視することに関するものです。postcss-styled-components syntax plugin の parser を調べ、template literal の補間を現在どのように処理しているかを確認してください。Props が使われている場合に、重複プロパティと無効な16進カラーのルールが検出されることを検証するテストケースを追加してください。styled-components のパースに関する既存の例がないか、テストスイートを確認してください。

索引モデルが issue の本文から書いたものです。

評価

領域
devtools, testing-qa
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
55/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。