43081j / 43081j/postcss-styled-components

Declarations that use interpolations with Props seem to be ignored

Đang mở
#8 4 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
12
Fork
1
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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')};
`;
```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Issue này liên quan đến việc linter bỏ qua các khai báo style sử dụng interpolation với Props trong styled-components. Hãy xem parser trong plugin cú pháp postcss-styled-components để biết hiện tại nó xử lý các interpolation của template literal như thế nào. Cần thêm các test case để xác minh rằng các rule về property trùng lặp và màu hex không hợp lệ được bắt khi sử dụng Props. Kiểm tra test suite để tìm các ví dụ hiện có về việc parse styled-components.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Lĩnh vực
devtools, testing-qa
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
55/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.