You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[New] label-has-associated-control: allow labelComponents to contain globs
Add ability for `labelComponents` within the `label-has-associated-control` to use the same glob checking mechanism as `controlComponents`.
- Ensure existing tests pass and update unit tests for new behaviour
- Add extra tests for documented `???Foo` syntax for component glob matching
- Update documentation to have appropriate examples for label/control glob usage
Closes#972
Copy file name to clipboardExpand all lines: docs/rules/label-has-associated-control.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -103,11 +103,11 @@ This rule takes one optional object argument of type object:
103
103
}
104
104
```
105
105
106
-
`labelComponents` is a list of custom React Component names that should be checked for an associated control.
106
+
`labelComponents` is a list of custom React Component names that should be checked for an associated control.[Glob format](https://linuxhint.com/bash_globbing_tutorial/) is also supported for specifying names (e.g., `Label*` matches `LabelComponent` but not `CustomLabel`, `????Label` matches `LinkLabel` but not `CustomLabel`).
107
107
108
108
`labelAttributes` is a list of attributes to check on the label component and its children for a label. Use this if you have a custom component that uses a string passed on a prop to render an HTML `label`, for example.
109
109
110
-
`controlComponents` is a list of custom React Components names that will output an input element. [Glob format](https://linuxhint.com/bash_globbing_tutorial/) is also supported for specifying names (e.g., `Label*` matches `LabelComponent` but not `CustomLabel`, `????Label` matches `LinkLabel` but not `CustomLabel`).
110
+
`controlComponents` is a list of custom React Components names that will output an input element. [Glob format](https://linuxhint.com/bash_globbing_tutorial/) is also supported for specifying names (e.g., `Input*` matches `InputCustom` but not `CustomInput`, `????Input` matches `TextInput` but not `CustomInput`).
111
111
112
112
`assert` asserts that the label has htmlFor, a nested label, both or either. Available options: `'htmlFor', 'nesting', 'both', 'either'`.
0 commit comments