Skip to content
This repository was archived by the owner on Jan 2, 2025. It is now read-only.

Commit e6e12a6

Browse files
committed
feat: Add new rule
1. Detect all components and HTML elements in JSX, and if the element has no child elements, it will be automatically converted to a self-closing form.
1 parent caeaa4b commit e6e12a6

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

configs/.eslintrc.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ module.exports = {
4141
"error",
4242
{
4343
cases: {
44-
kebabCase: true, // 是否支持横杠 (-) 命名
45-
camelCase: false, // 是否支持小驼峰命名
46-
snakeCase: false, // 是否支持 (_) 下划线命名
47-
pascalCase: false, // 是否支持大坨峰命名
44+
kebabCase: true, // 支持横杠 (-) 命名
45+
camelCase: false, // 支持小驼峰命名
46+
snakeCase: false, // 支持 (_) 下划线命名
47+
pascalCase: false, // 支持大坨峰命名
4848
},
4949
},
5050
],
@@ -61,9 +61,10 @@ module.exports = {
6161
next: "*",
6262
},
6363
],
64-
"@typescript-eslint/no-var-requires": 0, // 关闭禁止使用 require 语句
64+
"@typescript-eslint/no-var-requires": 0, // (关闭) 禁止使用 require 语句
6565
"@sj-distributor/react/interface-name-prefix": ["error", "I"], // 默认强制 interface 大写 I 前缀
66-
"react/display-name": 0, // 关闭(不允许在 React 组件定义中缺少 displayName)
66+
"react/display-name": 0, // (关闭) 不允许在 React 组件定义中缺少 displayName
67+
"react/self-closing-comp": 2, // 检测 JSX 中的所有组件和 HTML 元素,如果元素没有子元素,就会自动转换为自闭合形式
6768
},
6869
// 共享配置,提供给每一个将被执行的规则
6970
settings: {

0 commit comments

Comments
 (0)