alleyinteractive / alleyinteractive/alley-scripts

Add Duplication Rule to StyleLinter

未关闭
#661 0 条评论 0 个 reaction 已指派 1 人 已被 @renatonascalves 认领 在 GitHub 查看
css enhancement good first issue ux
主要语言
TypeScript
星标
10
派生
3
平均合并
4 天 22 小时
30 天内合并 PR
2

描述

### Description

In [Ally stylelint config](https://github.com/alleyinteractive/alley-scripts/tree/main/packages/stylelint-config), we should add an additional rule that would flag any duplication of properties.

![Screenshot 2024-06-14 at 4 23 41 PM](https://github.com/alleyinteractive/alley-scripts/assets/6392184/6b84c959-4bc5-4ac6-a01d-84a0d27ca84b)

It would involve adding` "declaration-block-no-duplicate-properties": true,` and `ignore: ["consecutive-duplicates-with-different-values"]` in the `.stylelintrc.json` settings.

StyleLinter Documentation found here https://stylelint.io/user-guide/rules/declaration-block-no-duplicate-properties/

### Use Case

When a developer is writing two identical properties in CSS, the linter should warn them that the first property will be overrided and effectively useless. If someone needs a duplicative property for a specific reason, they would have to disable stylelint for that line intentionally.

```
padding: 20px;
padding: 30px;
```

One concern is that it will start to flag css code that looks like:
```
.thing-that-renders-with-js {
/* critical:start */
opacity: 0;
/* critical:end */
opacity: 1;
}
```

Depending on how many errors like that are flagged, we may have to put a pin in this and have a broader discussion.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。