eslint-plugin-smarthr 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/package.json +2 -2
- package/rules/a11y-anchor-has-href-attribute/index.js +1 -1
- package/rules/a11y-input-has-name-attribute/index.js +1 -1
- package/rules/best-practice-for-layouts/README.md +47 -3
- package/rules/best-practice-for-layouts/index.js +107 -49
- package/test/a11y-input-has-name-attribute.js +1 -0
- package/test/best-practice-for-layouts.js +18 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [2.3.0](https://github.com/kufu/tamatebako/compare/eslint-plugin-smarthr-v2.2.1...eslint-plugin-smarthr-v2.3.0) (2025-12-01)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* best-practice-for-layout にHeading, FormControl, Fieldsetのタイトル部分でLayout系コンポーネントの仕様を制限するチェックを追加 ([#906](https://github.com/kufu/tamatebako/issues/906)) ([631aeca](https://github.com/kufu/tamatebako/commit/631aecaa20c834b6d603e31af95f2aaee9694bd0))
|
|
11
|
+
|
|
12
|
+
## [2.2.1](https://github.com/kufu/tamatebako/compare/eslint-plugin-smarthr-v2.2.0...eslint-plugin-smarthr-v2.2.1) (2025-11-18)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* a11y-anchor-has-href-attributeがhrefにメソッドが指定されている場合に誤検知することがある問題を修正 ([#905](https://github.com/kufu/tamatebako/issues/905)) ([6ebd6ec](https://github.com/kufu/tamatebako/commit/6ebd6ecc074a7088652697dcb6bfb60b63a13fc4))
|
|
18
|
+
* a11y-input-has-name-attributeでtemplate literalの場合、誤検知してしまう問題を修正 ([#904](https://github.com/kufu/tamatebako/issues/904)) ([d440e86](https://github.com/kufu/tamatebako/commit/d440e8675bf600dbe8a51e496d7076bcf617336f))
|
|
19
|
+
|
|
5
20
|
## [2.2.0](https://github.com/kufu/tamatebako/compare/eslint-plugin-smarthr-v2.1.0...eslint-plugin-smarthr-v2.2.0) (2025-11-07)
|
|
6
21
|
|
|
7
22
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-smarthr",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"author": "SmartHR",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "A sharable ESLint plugin for SmartHR",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"eslintplugin",
|
|
38
38
|
"smarthr"
|
|
39
39
|
],
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "18f89a924a8920722a1e71982a4d117db0c6a073"
|
|
41
41
|
}
|
|
@@ -91,7 +91,7 @@ module.exports = {
|
|
|
91
91
|
reporter(node)
|
|
92
92
|
}
|
|
93
93
|
},
|
|
94
|
-
[`${ANCHOR_ELEMENT}:has(${HREF_ATTRIBUTE}:matches([value=null],:has(Literal[value=/^(|#)$/])))`]: reporter,
|
|
94
|
+
[`${ANCHOR_ELEMENT}:has(${HREF_ATTRIBUTE}:matches([value=null],:has(>Literal[value=/^(|#)$/]),:has(>JSXExpressionContainer[expression.value=/^(|#)$/])))`]: reporter,
|
|
95
95
|
}
|
|
96
96
|
},
|
|
97
97
|
}
|
|
@@ -67,7 +67,7 @@ module.exports = {
|
|
|
67
67
|
- 適切に指定することで同じname属性を指定したinput[radio]とグループが確立され、適切なキーボード操作を行えるようになります${MESSAGE_UNDEFINED_NAME_PART}`,
|
|
68
68
|
})
|
|
69
69
|
},
|
|
70
|
-
[`${INPUT_ELEMENT}${notHasSpreadAttribute} ${NAME_ATTRIBUTE}:not([value.value=${INPUT_NAME_REGEX}])`]: (node) => {
|
|
70
|
+
[`${INPUT_ELEMENT}${notHasSpreadAttribute} ${NAME_ATTRIBUTE}[value.value]:not([value.value=${INPUT_NAME_REGEX}])`]: (node) => {
|
|
71
71
|
context.report({
|
|
72
72
|
node,
|
|
73
73
|
message: `${node.parent.name.name} のname属性の値(${node.value.value})はブラウザの自動補完が適切に行えない可能性があるため${MESSAGE_PART_FORMAT}`,
|
|
@@ -15,13 +15,28 @@
|
|
|
15
15
|
## ❌ Incorrect
|
|
16
16
|
|
|
17
17
|
```jsx
|
|
18
|
-
//
|
|
18
|
+
// Cluster, Stackは子要素が複数存在する場合に利用するべきもののため
|
|
19
|
+
// 要素が単一の場合エラーになる
|
|
19
20
|
<Cluster>
|
|
20
|
-
<
|
|
21
|
+
<div>
|
|
22
|
+
hoge
|
|
23
|
+
</div>
|
|
21
24
|
</Cluster>
|
|
22
25
|
<StyledStack>
|
|
23
|
-
|
|
26
|
+
<Any />
|
|
24
27
|
</StyledStack>
|
|
28
|
+
|
|
29
|
+
// Heading, FormControlのlabel, Fieldsetのlegendにsmarthr-ui/Layoutsに属するコンポーネントを設置するとエラー
|
|
30
|
+
<Heading><Cluster><AnyIcon /><Text /></Cluster></Heading>
|
|
31
|
+
<FormControl label={{
|
|
32
|
+
text: <Text prefixIcon={<AnyIcon />}>hoge</Cluster>
|
|
33
|
+
}} />
|
|
34
|
+
<Fieldset legend={
|
|
35
|
+
<Stack>
|
|
36
|
+
<Text />
|
|
37
|
+
<SubText />
|
|
38
|
+
</Stack>
|
|
39
|
+
} />
|
|
25
40
|
```
|
|
26
41
|
|
|
27
42
|
## ✅ Correct
|
|
@@ -50,4 +65,33 @@
|
|
|
50
65
|
<Any />
|
|
51
66
|
<Any />
|
|
52
67
|
</Cluster>
|
|
68
|
+
|
|
69
|
+
// Heading, FormControlのlabel, FieldsetのlegendにIconを設定したい場合はicon属性を利用する
|
|
70
|
+
<Heading icon={<AnyIcon />}><Text /></Heading>
|
|
71
|
+
<FormControl label={{
|
|
72
|
+
text: <Text />,
|
|
73
|
+
icon: <AnyIcon />,
|
|
74
|
+
}} />
|
|
75
|
+
// Stackはas="span"、もしくはforwardedAs="span"を指定すれば利用できる
|
|
76
|
+
<Fieldset legend={
|
|
77
|
+
<Stack as="span">
|
|
78
|
+
<Text />
|
|
79
|
+
<SubText />
|
|
80
|
+
</Stack>
|
|
81
|
+
} />
|
|
82
|
+
<FormControl label={{
|
|
83
|
+
text: (
|
|
84
|
+
<AnyStack forwardedAs="span">
|
|
85
|
+
<Text />
|
|
86
|
+
<SubText />
|
|
87
|
+
</AnyStack>
|
|
88
|
+
),
|
|
89
|
+
}} />
|
|
90
|
+
|
|
91
|
+
// FormControl、Fieldsetで見出しの右側の領域に要素を設置する場合、statusLabels, subActionAreaを利用する
|
|
92
|
+
<FormControl
|
|
93
|
+
label={<Text />}
|
|
94
|
+
statusLabels={<RequiredLabel />}
|
|
95
|
+
subActionArea={<HelpLink />}
|
|
96
|
+
/>
|
|
53
97
|
```
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
const MULTI_CHILDREN_REGEX = /(Cluster|Stack)$/
|
|
2
|
-
|
|
3
2
|
const REGEX_NLSP = /^\s*\n+\s*$/
|
|
4
3
|
const FLEX_END_REGEX = /^(flex-)?end$/
|
|
5
4
|
|
|
5
|
+
const TARGET_INVALID_COMPONENT_REGEX = /(Center|Cluster|Container|Reel|Sidebar)$/
|
|
6
|
+
const INVALID_ELEMENT = `JSXOpeningElement[name.name=${TARGET_INVALID_COMPONENT_REGEX}]`
|
|
7
|
+
const HEADING_ELEMENT = 'JSXElement[openingElement.name.name=/Heading$/]'
|
|
8
|
+
const STACK_ELEMENT_NOT_SPAN = 'JSXOpeningElement[name.name=/Stack$/]:not(:has(JSXAttribute[name.name=/^(as|forwardedAs)$/][value.value="span"]))'
|
|
9
|
+
const FORM_CONTROL_LABEL_ATTRIBUTE = 'JSXOpeningElement[name.name=/FormControl$/] JSXAttribute[name.name="label"]'
|
|
10
|
+
const FIELDSET_LEGEND_ATTRIBUTE = 'JSXOpeningElement[name.name=/Fieldset$/] JSXAttribute[name.name="legend"]'
|
|
11
|
+
const ICON_ELEMENT_WITH_TEXT = `JSXOpeningElement[name.name=/Icon$/]:has(JSXAttribute[name.name="text"])`
|
|
12
|
+
const TEXT_ELEMENT_WITH_PREFIX = 'JSXOpeningElement[name.name=/Text$/]:has(JSXAttribute[name.name="prefixIcon"])'
|
|
13
|
+
|
|
6
14
|
const filterFalsyJSXText = (cs) => cs.filter(checkFalsyJSXText)
|
|
7
15
|
const checkFalsyJSXText = (c) => (
|
|
8
16
|
!(
|
|
@@ -55,39 +63,35 @@ module.exports = {
|
|
|
55
63
|
},
|
|
56
64
|
create(context) {
|
|
57
65
|
return {
|
|
58
|
-
JSXOpeningElement: (node) => {
|
|
66
|
+
[`JSXOpeningElement[selfClosing=false][name.name=${MULTI_CHILDREN_REGEX}]`]: (node) => {
|
|
59
67
|
const nodeName = node.name.name;
|
|
68
|
+
const matcher = nodeName.match(MULTI_CHILDREN_REGEX)
|
|
69
|
+
const layoutType = matcher[1]
|
|
70
|
+
let justifyAttr = null
|
|
71
|
+
let alignAttr = null
|
|
72
|
+
let gapAttr = null
|
|
60
73
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
break
|
|
75
|
-
case 'align':
|
|
76
|
-
alignAttr = a
|
|
77
|
-
break
|
|
78
|
-
case 'gap':
|
|
79
|
-
gapAttr = a
|
|
80
|
-
break
|
|
81
|
-
}
|
|
82
|
-
})
|
|
74
|
+
node.attributes.forEach((a) => {
|
|
75
|
+
switch (a.name?.name) {
|
|
76
|
+
case 'justify':
|
|
77
|
+
justifyAttr = a
|
|
78
|
+
break
|
|
79
|
+
case 'align':
|
|
80
|
+
alignAttr = a
|
|
81
|
+
break
|
|
82
|
+
case 'gap':
|
|
83
|
+
gapAttr = a
|
|
84
|
+
break
|
|
85
|
+
}
|
|
86
|
+
})
|
|
83
87
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
if (layoutType === 'Stack') {
|
|
89
|
+
if (alignAttr && FLEX_END_REGEX.test(alignAttr.value.value)) {
|
|
90
|
+
return
|
|
91
|
+
} else if (gapAttr?.value.type === 'JSXExpressionContainer' && gapAttr.value.expression.value === 0) {
|
|
92
|
+
context.report({
|
|
93
|
+
node,
|
|
94
|
+
message: `${nodeName} に "gap={0}" が指定されており、smarthr-ui/${layoutType} の利用方法として誤っている可能性があります。以下の修正方法を検討してください。
|
|
91
95
|
- 方法1: 子要素を一つにまとめられないか検討してください
|
|
92
96
|
- 例: "<Stack gap={0}><p>hoge</p><p>fuga</p></Stack>" を "<p>hoge<br />fuga</p>" にするなど
|
|
93
97
|
- 方法2: 子要素のstyleを確認しgap属性を0以外にできないか検討してください
|
|
@@ -95,32 +99,86 @@ module.exports = {
|
|
|
95
99
|
- 方法3: 別要素でマークアップし直すか、${nodeName}を削除してください
|
|
96
100
|
- 親要素に smarthr-ui/Cluster, smarthr-ui/Stack などが存在している場合、div・spanなどで1要素にまとめる必要がある場合があります
|
|
97
101
|
- as, forwardedAsなどでSectioningContent系要素に変更している場合、対応するsmarthr-ui/Section, Aside, Nav, Article のいずれかに差し替えてください`
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
102
|
+
})
|
|
103
|
+
}
|
|
104
|
+
}
|
|
101
105
|
|
|
102
|
-
|
|
106
|
+
const children = node.parent.children.filter(checkFalsyJSXText)
|
|
103
107
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
+
if (children.length === 1) {
|
|
109
|
+
if (justifyAttr && FLEX_END_REGEX.test(justifyAttr.value.value)) {
|
|
110
|
+
return
|
|
111
|
+
}
|
|
108
112
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
if (searchChildren(children[0])) {
|
|
114
|
+
context.report({
|
|
115
|
+
node,
|
|
116
|
+
message:
|
|
117
|
+
(justifyAttr?.value.value === 'center' || alignAttr?.value.value === 'center')
|
|
118
|
+
? `${nodeName} は smarthr-ui/${layoutType} ではなく smarthr-ui/Center でマークアップしてください`
|
|
119
|
+
: `${nodeName}には子要素が一つしか無いため、${layoutType}でマークアップする意味がありません。
|
|
116
120
|
- styleを確認し、div・spanなど、別要素でマークアップし直すか、${nodeName}を削除してください
|
|
117
121
|
- as, forwardedAsなどでSectioningContent系要素に変更している場合、対応するsmarthr-ui/Section, Aside, Nav, Article のいずれかに差し替えてください`
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
}
|
|
122
|
+
})
|
|
121
123
|
}
|
|
122
124
|
}
|
|
123
125
|
},
|
|
126
|
+
[`${HEADING_ELEMENT} ${INVALID_ELEMENT}`]: (node) => {
|
|
127
|
+
const component = node.name.name.match(TARGET_INVALID_COMPONENT_REGEX)[1]
|
|
128
|
+
|
|
129
|
+
context.report({
|
|
130
|
+
node,
|
|
131
|
+
message: `Headingの子孫に${component}を置くことはできません。Headingの外で${component}を使用するようにマークアップを修正してください。`
|
|
132
|
+
})
|
|
133
|
+
},
|
|
134
|
+
[`${HEADING_ELEMENT} ${STACK_ELEMENT_NOT_SPAN}`]: (node) => {
|
|
135
|
+
context.report({
|
|
136
|
+
node,
|
|
137
|
+
message: 'Headingの子孫にStackを置く場合、as属性、もしくはforwardedAs属性に `span` を指定してください',
|
|
138
|
+
})
|
|
139
|
+
},
|
|
140
|
+
[`${HEADING_ELEMENT} :matches(${ICON_ELEMENT_WITH_TEXT},${TEXT_ELEMENT_WITH_PREFIX})`]: (node) => {
|
|
141
|
+
context.report({
|
|
142
|
+
node,
|
|
143
|
+
message: 'HeadingにIconを設定する場合 <Heading icon={<XxxIcon />}></Heading> のようにicon属性を利用してください',
|
|
144
|
+
})
|
|
145
|
+
},
|
|
146
|
+
[`${FORM_CONTROL_LABEL_ATTRIBUTE} ${INVALID_ELEMENT}`]: (node) => {
|
|
147
|
+
context.report({
|
|
148
|
+
node,
|
|
149
|
+
message: `FormControlのlabel属性に${node.name.name.match(TARGET_INVALID_COMPONENT_REGEX)[1]}を置くことはできません。ラベル用テキスト以外をstatusLabels、subActionArea、もしくはlabel属性のObjectとして '{ text: テキスト, icon: <XxxIcon /> }'に置き換えてください。`,
|
|
150
|
+
})
|
|
151
|
+
},
|
|
152
|
+
[`${FORM_CONTROL_LABEL_ATTRIBUTE} ${STACK_ELEMENT_NOT_SPAN}`]: (node) => {
|
|
153
|
+
context.report({
|
|
154
|
+
node,
|
|
155
|
+
message: 'FormControlのlabel属性にStackを置く場合、as属性、もしくはforwardedAs属性に `span` を指定してください',
|
|
156
|
+
})
|
|
157
|
+
},
|
|
158
|
+
[`${FORM_CONTROL_LABEL_ATTRIBUTE} :matches(${ICON_ELEMENT_WITH_TEXT},${TEXT_ELEMENT_WITH_PREFIX})`]: (node) => {
|
|
159
|
+
context.report({
|
|
160
|
+
node,
|
|
161
|
+
message: "FormControlのlabel属性にアイコンを設定する場合 <FormControl label={{ text: 'テキスト', icon: <XxxIcon /> }} /> のようにlabel.icon属性を利用してください",
|
|
162
|
+
})
|
|
163
|
+
},
|
|
164
|
+
[`${FIELDSET_LEGEND_ATTRIBUTE} ${INVALID_ELEMENT}`]: (node) => {
|
|
165
|
+
context.report({
|
|
166
|
+
node,
|
|
167
|
+
message: `Fieldsetのlegend属性に${node.name.name.match(TARGET_INVALID_COMPONENT_REGEX)[1]}を置くことはできません。ラベル用テキスト以外をstatusLabels、subActionArea、もしくはlabel属性のObjectとして '{ text: テキスト, icon: <XxxIcon /> }'に置き換えてください。`,
|
|
168
|
+
})
|
|
169
|
+
},
|
|
170
|
+
[`${FIELDSET_LEGEND_ATTRIBUTE} ${STACK_ELEMENT_NOT_SPAN}`]: (node) => {
|
|
171
|
+
context.report({
|
|
172
|
+
node,
|
|
173
|
+
message: 'Fieldsetのlegend属性にStackを置く場合、as属性、もしくはforwardedAs属性に `span` を指定してください',
|
|
174
|
+
})
|
|
175
|
+
},
|
|
176
|
+
[`${FIELDSET_LEGEND_ATTRIBUTE} :matches(${ICON_ELEMENT_WITH_TEXT},${TEXT_ELEMENT_WITH_PREFIX})`]: (node) => {
|
|
177
|
+
context.report({
|
|
178
|
+
node,
|
|
179
|
+
message: "Fieldsetのlegend属性にアイコンを設定する場合 <Fieldset legend={{ text: 'テキスト', icon: <XxxIcon /> }} /> のようにlegend.icon属性を利用してください",
|
|
180
|
+
})
|
|
181
|
+
},
|
|
124
182
|
}
|
|
125
183
|
},
|
|
126
184
|
}
|
|
@@ -26,6 +26,7 @@ ruleTester.run('a11y-input-has-name-attribute', rule, {
|
|
|
26
26
|
{ code: '<HogeTextarea name="hoge" />' },
|
|
27
27
|
{ code: '<select name="hoge" />' },
|
|
28
28
|
{ code: '<Select name="hoge[0][Fuga]" />' },
|
|
29
|
+
{ code: '<Select name={`ABC`} />' },
|
|
29
30
|
{ code: '<Input {...hoge} />', options: [{ checkType: 'allow-spread-attributes' }] },
|
|
30
31
|
{ code: '<Input {...args1} {...args2} />', options: [{ checkType: 'allow-spread-attributes' }] },
|
|
31
32
|
{ code: '<Input {...args} hoge="fuga" />', options: [{ checkType: 'allow-spread-attributes' }] },
|
|
@@ -58,6 +58,12 @@ ruleTester.run('best-practice-for-button-element', rule, {
|
|
|
58
58
|
{ code: `<Cluster>{a}</Cluster>` },
|
|
59
59
|
{ code: `<Cluster>{a.b}</Cluster>` },
|
|
60
60
|
{ code: `<Cluster>{a ? b : c}</Cluster>` },
|
|
61
|
+
{ code: `<Heading><Stack as="span"><Hoge /><Fuga /></Stack></Heading>` },
|
|
62
|
+
{ code: `<AnyHeading icon={<AnyIcon />}>hoge</AnyHeading>` },
|
|
63
|
+
{ code: `<FormControl label={<AnyStack as="span"><span>a</span><span>b</span></AnyStack>} />` },
|
|
64
|
+
{ code: `<AnyFormControl label={{ text: 'hoge', icon: <AnyIcon /> }} />` },
|
|
65
|
+
{ code: `<AnyFieldset legend={{ text: <AnyStack as="span"><span>a</span><span>b</span></AnyStack> }} />` },
|
|
66
|
+
{ code: `<Fieldset legend={{ text: 'hoge', icon: <AnyIcon /> }} />` },
|
|
61
67
|
],
|
|
62
68
|
invalid: [
|
|
63
69
|
{ code: `<Stack><Hoge /></Stack>`, errors: [ { message: errorMessage('Stack', 'Stack') } ] },
|
|
@@ -90,6 +96,18 @@ ruleTester.run('best-practice-for-button-element', rule, {
|
|
|
90
96
|
- 方法3: 別要素でマークアップし直すか、HogeStackを削除してください
|
|
91
97
|
- 親要素に smarthr-ui/Cluster, smarthr-ui/Stack などが存在している場合、div・spanなどで1要素にまとめる必要がある場合があります
|
|
92
98
|
- as, forwardedAsなどでSectioningContent系要素に変更している場合、対応するsmarthr-ui/Section, Aside, Nav, Article のいずれかに差し替えてください` } ] },
|
|
99
|
+
{ code: `<Heading><Cluster><Hoge /><Fuga /></Cluster></Heading>`, errors: [ { message: `Headingの子孫にClusterを置くことはできません。Headingの外でClusterを使用するようにマークアップを修正してください。` } ] },
|
|
100
|
+
{ code: `<AnyHeading><AnyStack><Hoge /><Fuga /></AnyStack></AnyHeading>`, errors: [ { message: `Headingの子孫にStackを置く場合、as属性、もしくはforwardedAs属性に \`span\` を指定してください` } ] },
|
|
101
|
+
{ code: `<Heading><AnyIcon text="hoge" /></Heading>`, errors: [ { message: `HeadingにIconを設定する場合 <Heading icon={<XxxIcon />}></Heading> のようにicon属性を利用してください` } ] },
|
|
102
|
+
{ code: `<AnyHeading><Text prefixIcon={<SomeIcon />}>hoge</Text></AnyHeading>`, errors: [ { message: `HeadingにIconを設定する場合 <Heading icon={<XxxIcon />}></Heading> のようにicon属性を利用してください` } ] },
|
|
103
|
+
{ code: `<AnyFormControl label={{ text: <Cluster><Hoge /><Fuga /></Cluster> }} />`, errors: [ { message: `FormControlのlabel属性にClusterを置くことはできません。ラベル用テキスト以外をstatusLabels、subActionArea、もしくはlabel属性のObjectとして '{ text: テキスト, icon: <XxxIcon /> }'に置き換えてください。` } ] },
|
|
104
|
+
{ code: `<FormControl label={<AnyStack><Hoge /><Fuga /></AnyStack>} />`, errors: [ { message: `FormControlのlabel属性にStackを置く場合、as属性、もしくはforwardedAs属性に \`span\` を指定してください` } ] },
|
|
105
|
+
{ code: `<AnyFormControl label={{ text: <AnyIcon text="hoge" /> }} />`, errors: [ { message: `FormControlのlabel属性にアイコンを設定する場合 <FormControl label={{ text: 'テキスト', icon: <XxxIcon /> }} /> のようにlabel.icon属性を利用してください` } ] },
|
|
106
|
+
{ code: `<FormControl label={{ text: <Text prefixIcon={<SomeIcon /> }>hoge</Text>}} />`, errors: [ { message: `FormControlのlabel属性にアイコンを設定する場合 <FormControl label={{ text: 'テキスト', icon: <XxxIcon /> }} /> のようにlabel.icon属性を利用してください` } ] },
|
|
107
|
+
{ code: `<Fieldset legend={<Cluster><Hoge /><Fuga /></Cluster>} />`, errors: [ { message: `Fieldsetのlegend属性にClusterを置くことはできません。ラベル用テキスト以外をstatusLabels、subActionArea、もしくはlabel属性のObjectとして '{ text: テキスト, icon: <XxxIcon /> }'に置き換えてください。` } ] },
|
|
108
|
+
{ code: `<AnyFieldset legend={{ text: <AnyStack><Hoge /><Fuga /></AnyStack> }} />`, errors: [ { message: `Fieldsetのlegend属性にStackを置く場合、as属性、もしくはforwardedAs属性に \`span\` を指定してください` } ] },
|
|
109
|
+
{ code: `<Fieldset legend={<AnyIcon text="hoge" />} />`, errors: [ { message: `Fieldsetのlegend属性にアイコンを設定する場合 <Fieldset legend={{ text: 'テキスト', icon: <XxxIcon /> }} /> のようにlegend.icon属性を利用してください` } ] },
|
|
110
|
+
{ code: `<AnyFieldset legend={{ text: <Text prefixIcon={<SomeIcon />}>hoge</Text>}} />`, errors: [ { message: `Fieldsetのlegend属性にアイコンを設定する場合 <Fieldset legend={{ text: 'テキスト', icon: <XxxIcon /> }} /> のようにlegend.icon属性を利用してください` } ] },
|
|
93
111
|
]
|
|
94
112
|
})
|
|
95
113
|
|