-
Notifications
You must be signed in to change notification settings - Fork 31
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
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/growingio/gio-design/3g2X27z4fUgJ698PCk83Kgb6ftWa |
</Tabs.Tab> | ||
<Tabs.Tab value="" label="访问属性"> | ||
<List.Selection options={searchData2().reverse()} /> | ||
<Tabs.Tab value="visit" label="访问属性"> |
There was a problem hiding this comment.
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.
src/list/Item.tsx
Outdated
@@ -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 ( |
There was a problem hiding this comment.
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.
src/list/Item.tsx
Outdated
<BaseItem | ||
key={value} | ||
ref={ref} | ||
data-testid="list-item-base" | ||
label={label} | ||
value={value} | ||
disabled={disabled} | ||
{...rest} | ||
/> |
There was a problem hiding this comment.
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)
src/list/Item.tsx
Outdated
<BaseItem | ||
key={value} | ||
ref={ref} | ||
data-testid="list-item-base" | ||
label={label} | ||
value={value} | ||
disabled={disabled} | ||
{...rest} | ||
/> |
There was a problem hiding this comment.
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)
In src/list/Item.tsx:14-22It 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: In src/list/Item.tsx:27-35
Click a link below to tell your Security Team if this comment was: In src/list-picker/Trigger.tsx:43-53It 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: In src/list/Item.tsx:14-22
Click a link below to tell your Security Team if this comment was: In src/list/Item.tsx:27-35It 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: In src/select/Select.tsx:95-113
Click a link below to tell your Security Team if this comment was: In src/list-picker/demos/List-picker.stories.tsx:468-493It 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: In src/list-picker/Trigger.tsx:43-53
Click a link below to tell your Security Team if this comment was: |
...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); |
There was a problem hiding this comment.
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)
ff04bfd
to
5a0bcac
Compare
In src/list-picker/demos/List-picker.stories.tsx:469-494It 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: |
5a0bcac
to
7fe8d34
Compare
} | ||
return <BaseItem ref={ref} data-testid="list-item-base" label={label} value={value} disabled={disabled} {...rest} />; | ||
return <BaseItem {...defaultProps} data-testid="list-item-base" />; |
There was a problem hiding this comment.
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" />; |
There was a problem hiding this comment.
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)
src/list/Item.tsx
Outdated
{...rest} | ||
/> | ||
); | ||
return <CalcaderItem {...(defaultProps as any)} data-testid="list-item-cascader" />; |
There was a problem hiding this comment.
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)
7fe8d34
to
1f40d30
Compare
Code Climate has analyzed commit 1f40d30 and detected 0 issues on this pull request. View more on Code Climate. |
Kudos, SonarCloud Quality Gate passed! |
# [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))
🎉 This PR is included in version 22.8.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
No description provided.