Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(list-picker): fix list-picker demo #1678

Merged
merged 1 commit into from
Dec 20, 2021
Merged

fix(list-picker): fix list-picker demo #1678

merged 1 commit into from
Dec 20, 2021

Conversation

berber1016
Copy link
Contributor

No description provided.

@vercel
Copy link

vercel bot commented Dec 15, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/growingio/gio-design/3g2X27z4fUgJ698PCk83Kgb6ftWa
✅ Preview: https://gio-design-git-fix-list-picker-growingio.vercel.app

</Tabs.Tab>
<Tabs.Tab value="" label="访问属性">
<List.Selection options={searchData2().reverse()} />
<Tabs.Tab value="visit" label="访问属性">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 4 locations. Consider refactoring.

@@ -33,7 +35,17 @@ export const InnerItem = WithRef<HTMLLIElement, ItemProps>((props, ref?) => {
/>
);
}
return <BaseItem ref={ref} data-testid="list-item-base" label={label} value={value} disabled={disabled} {...rest} />;
return (
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

Comment on lines 39 to 47
<BaseItem
key={value}
ref={ref}
data-testid="list-item-base"
label={label}
value={value}
disabled={disabled}
{...rest}
/>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ref usage found, refs give direct DOM access and may create a possibility for XSS

Click a link below to tell your Security Team if this comment was:
👍 useful
👎 not useful (false positive)
🤔 confusing

This comment is advisory. You do not need to address it before merging this pull request.
(typescript.react.security.audit.react-no-refs.react-no-refs from Rule board)

Comment on lines 39 to 47
<BaseItem
key={value}
ref={ref}
data-testid="list-item-base"
label={label}
value={value}
disabled={disabled}
{...rest}
/>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a good practice to avoid spreading for JSX attributes. This forces the code to be explicit about which props are given to the component. This avoids situations where warnings are caused by invalid HTML props passed to HTML elements, and further, it avoids passing unintentional extra props by malicious actors. Instead, consider explicitly passing props to the component.

Click a link below to tell your Security Team if this comment was:
👍 useful
👎 not useful (false positive)
🤔 confusing

This comment is advisory. You do not need to address it before merging this pull request.
(typescript.react.best-practice.react-props-spreading.react-props-spreading from Rule board)

@semgrep-app
Copy link

semgrep-app bot commented Dec 15, 2021

Semgrep was unable to comment inline on the following findings:

In src/list/Item.tsx:14-22

It is a good practice to avoid spreading for JSX attributes. This forces the code to be explicit about which props are given to the component. This avoids situations where warnings are caused by invalid HTML props passed to HTML elements, and further, it avoids passing unintentional extra props by malicious actors. Instead, consider explicitly passing props to the component.

Click a link below to tell your Security Team if this comment was:
👍 useful
👎 not useful (false positive)
🤔 confusing


In src/list/Item.tsx:27-35

ref usage found, refs give direct DOM access and may create a possibility for XSS

Click a link below to tell your Security Team if this comment was:
👍 useful
👎 not useful (false positive)
🤔 confusing


In src/list-picker/Trigger.tsx:43-53

It is a good practice to avoid spreading for JSX attributes. This forces the code to be explicit about which props are given to the component. This avoids situations where warnings are caused by invalid HTML props passed to HTML elements, and further, it avoids passing unintentional extra props by malicious actors. Instead, consider explicitly passing props to the component.

Click a link below to tell your Security Team if this comment was:
👍 useful
👎 not useful (false positive)
🤔 confusing


In src/list/Item.tsx:14-22

ref usage found, refs give direct DOM access and may create a possibility for XSS

Click a link below to tell your Security Team if this comment was:
👍 useful
👎 not useful (false positive)
🤔 confusing


In src/list/Item.tsx:27-35

It is a good practice to avoid spreading for JSX attributes. This forces the code to be explicit about which props are given to the component. This avoids situations where warnings are caused by invalid HTML props passed to HTML elements, and further, it avoids passing unintentional extra props by malicious actors. Instead, consider explicitly passing props to the component.

Click a link below to tell your Security Team if this comment was:
👍 useful
👎 not useful (false positive)
🤔 confusing


In src/select/Select.tsx:95-113

ref usage found, refs give direct DOM access and may create a possibility for XSS

Click a link below to tell your Security Team if this comment was:
👍 useful
👎 not useful (false positive)
🤔 confusing


In src/list-picker/demos/List-picker.stories.tsx:468-493

It is a good practice to avoid spreading for JSX attributes. This forces the code to be explicit about which props are given to the component. This avoids situations where warnings are caused by invalid HTML props passed to HTML elements, and further, it avoids passing unintentional extra props by malicious actors. Instead, consider explicitly passing props to the component.

Click a link below to tell your Security Team if this comment was:
👍 useful
👎 not useful (false positive)
🤔 confusing


In src/list-picker/Trigger.tsx:43-53

ref usage found, refs give direct DOM access and may create a possibility for XSS

Click a link below to tell your Security Team if this comment was:
👍 useful
👎 not useful (false positive)
🤔 confusing

How do I suppress this?

...rest
} = props;
const defaultPrefix = usePrefixCls(prefixCls);
const [visible, setVisible] = useControlledState(controlledVisible, false);
const [value, setValue] = useState(controlledValue || defaultValue);
const { options, setOptions, getOptionByValue, getLabelByValue, getOptionsByValue } = useCacheOptions();

const triggerRef = useRef<HTMLInputElement | undefined>(undefined);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ref usage found, refs give direct DOM access and may create a possibility for XSS

Click a link below to tell your Security Team if this comment was:
👍 useful
👎 not useful (false positive)
🤔 confusing

This comment is advisory. You do not need to address it before merging this pull request.
(typescript.react.security.audit.react-no-refs.react-no-refs from Rule board)

@semgrep-app
Copy link

semgrep-app bot commented Dec 15, 2021

Semgrep was unable to comment inline on the following findings:

In src/list-picker/demos/List-picker.stories.tsx:469-494

It is a good practice to avoid spreading for JSX attributes. This forces the code to be explicit about which props are given to the component. This avoids situations where warnings are caused by invalid HTML props passed to HTML elements, and further, it avoids passing unintentional extra props by malicious actors. Instead, consider explicitly passing props to the component.

Click a link below to tell your Security Team if this comment was:
👍 useful
👎 not useful (false positive)
🤔 confusing

How do I suppress this?

}
return <BaseItem ref={ref} data-testid="list-item-base" label={label} value={value} disabled={disabled} {...rest} />;
return <BaseItem {...defaultProps} data-testid="list-item-base" />;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a good practice to avoid spreading for JSX attributes. This forces the code to be explicit about which props are given to the component. This avoids situations where warnings are caused by invalid HTML props passed to HTML elements, and further, it avoids passing unintentional extra props by malicious actors. Instead, consider explicitly passing props to the component.

Click a link below to tell your Security Team if this comment was:
👍 useful
👎 not useful (false positive)
🤔 confusing

This comment is advisory. You do not need to address it before merging this pull request.
(typescript.react.best-practice.react-props-spreading.react-props-spreading from Rule board)

{...rest}
/>
);
return <CheckboxItem {...defaultProps} data-testid="list-item-checkbox" />;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a good practice to avoid spreading for JSX attributes. This forces the code to be explicit about which props are given to the component. This avoids situations where warnings are caused by invalid HTML props passed to HTML elements, and further, it avoids passing unintentional extra props by malicious actors. Instead, consider explicitly passing props to the component.

Click a link below to tell your Security Team if this comment was:
👍 useful
👎 not useful (false positive)
🤔 confusing

This comment is advisory. You do not need to address it before merging this pull request.
(typescript.react.best-practice.react-props-spreading.react-props-spreading from Rule board)

{...rest}
/>
);
return <CalcaderItem {...(defaultProps as any)} data-testid="list-item-cascader" />;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a good practice to avoid spreading for JSX attributes. This forces the code to be explicit about which props are given to the component. This avoids situations where warnings are caused by invalid HTML props passed to HTML elements, and further, it avoids passing unintentional extra props by malicious actors. Instead, consider explicitly passing props to the component.

Click a link below to tell your Security Team if this comment was:
👍 useful
👎 not useful (false positive)
🤔 confusing

This comment is advisory. You do not need to address it before merging this pull request.
(typescript.react.best-practice.react-props-spreading.react-props-spreading from Rule board)

@codeclimate
Copy link

codeclimate bot commented Dec 20, 2021

Code Climate has analyzed commit 1f40d30 and detected 0 issues on this pull request.

View more on Code Climate.

@berber1016 berber1016 merged commit a38017f into master Dec 20, 2021
@berber1016 berber1016 deleted the fix-list-picker branch December 20, 2021 03:36
@sonarcloud
Copy link

sonarcloud bot commented Dec 20, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

jack0pan pushed a commit that referenced this pull request Dec 20, 2021
# [22.8.0](v22.7.0...v22.8.0) (2021-12-20)

### Bug Fixes

* **input:** fix input console ([#1696](#1696)) ([7879bb4](7879bb4))
* **list-picker:** fix list-picker demo ([#1678](#1678)) ([a38017f](a38017f))
* **list:** support empty ([#1682](#1682)) ([c1500f6](c1500f6))
* **page:** fix page storybook and collapse parameters not show ([#1684](#1684)) ([b138552](b138552))
* **past-time-picker:** fix active style ([#1700](#1700)) ([c3c718c](c3c718c))
* **select:** fix select model prop error ([#1702](#1702)) ([a40b4a4](a40b4a4))
* **upload:** fix upload reSelect not invoke model ([#1698](#1698)) ([292f45a](292f45a))

### Features

* **dropdown:** set active status on Button or IconButton when visible ([#1697](#1697)) ([33d72d5](33d72d5))
* **link:** support `component` prop ([#1699](#1699)) ([0bb93f0](0bb93f0))
@jack0pan
Copy link
Member

🎉 This PR is included in version 22.8.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants