Skip to content

Commit efbbb98

Browse files
Tatsiana KostsikavaTatsiana Kostsikava
authored andcommitted
fix lint
1 parent af24b4c commit efbbb98

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

docs/examples/BasicMulti.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default () => (
1212
className="basic-multi-select"
1313
classNamePrefix="select"
1414
dataAttributes={{
15-
'data-testid': 'basic-multi-select'
15+
'data-testid': 'basic-multi-select',
1616
}}
1717
/>
1818
);

docs/examples/BasicSingle.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default () => {
3131
name="color"
3232
options={colourOptions}
3333
dataAttributes={{
34-
'data-testid': 'basic-single-select'
34+
'data-testid': 'basic-single-select',
3535
}}
3636
/>
3737

packages/react-select/src/Select.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,11 @@ function buildCategorizedOptions<
407407
): CategorizedGroupOrOption<Option, Group>[] {
408408
return props.options
409409
.map((groupOrOption, groupOrOptionIndex) => {
410-
if ('options' in groupOrOption) {
410+
if (
411+
groupOrOption &&
412+
typeof groupOrOption === 'object' &&
413+
'options' in groupOrOption
414+
) {
411415
const categorizedOptions = groupOrOption.options
412416
.map((option, optionIndex) =>
413417
toCategorizedOption(props, option, selectValue, optionIndex)
@@ -2204,7 +2208,8 @@ export default class Select<
22042208
const { Control, IndicatorsContainer, SelectContainer, ValueContainer } =
22052209
this.getComponents();
22062210

2207-
const { className, id, isDisabled, menuIsOpen, dataAttributes } = this.props;
2211+
const { className, id, isDisabled, menuIsOpen, dataAttributes } =
2212+
this.props;
22082213
const { isFocused } = this.state;
22092214
const commonProps = (this.commonProps = this.getCommonProps());
22102215

packages/react-select/src/__tests__/Select.test.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2320,7 +2320,12 @@ cases(
23202320

23212321
cases(
23222322
'accessibility > passes through dataAttributes prop',
2323-
({ props = { ...BASIC_PROPS, dataAttributes: { 'data-testid': 'test-select' } } }) => {
2323+
({
2324+
props = {
2325+
...BASIC_PROPS,
2326+
dataAttributes: { 'data-testid': 'test-select' },
2327+
},
2328+
}) => {
23242329
let { container } = render(<Select {...props} />);
23252330
// The data attributes should be on the outermost div (SelectContainer)
23262331
const selectContainer = container.querySelector('div[data-testid]');

0 commit comments

Comments
 (0)