43081j / 43081j/eslint-plugin-lit
Consider exception to `no-attribute-value` if type is checkbox/radio
- 主要语言
- TypeScript
- 星标
- 138
- 派生
- 26
- 平均合并
- 23 小时 29 分钟
- 30 天内合并 PR
- 4
描述
Checkboxes and radios are unique in that they have a default value of `"on"`. If you use property binding, you cannot take advantage of this:
```js
html`` // will submit as string "undefined"
html`` // will submit as empty string ""
html`` // will submit as empty string ""
```
Whereas if you use the attribute binding, you can conditionally render the attribute and fallback to the default:
```js
html`` // will submit as "on"
```
In my testing this works correctly even if a value is initially set, and later changed, or if attribute is later removed.
Happy to attempt a PR if you don't object
贡献指南
这个仓库没有索引到贡献指南
调研方向
查看 eslint-plugin-lit 的 codebase 中的 'no-attribute-value' 规则,可能位于 src/rules/。了解它目前如何标记属性绑定。变更涉及为 type 为 'checkbox' 或 'radio' 的 input 元素添加例外。检查该规则如何分析 AST 节点以识别元素类型和属性。通过运行现有测试并为 checkbox/radio 情况添加新测试来测试该更改。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript
- 领域
- devtools, testing-qa
- Issue 类型
- 功能
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 55/100