Skip to content

Commit

Permalink
fix: sonar scanner
Browse files Browse the repository at this point in the history
  • Loading branch information
wkylin committed Nov 6, 2024
1 parent 0cefe9a commit e539666
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ compilation-stats.json
public/bit
api/node_modules
webpack/profiling
stats.html
stats.html
/.scannerwork
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
"public/locales"
],
"sonarlint.connectedMode.project": {
"connectionId": "http-localhost-9000",
"connectionId": "http-localhost-9000-",
"projectKey": "pro-react-admin"
}
}
1 change: 1 addition & 0 deletions src/components/stateless/ReMarkdown/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const PreCode = (props) => {
<span className={styles.lang}>{langRef.current}</span>
<span
className={styles.copySpan}
role="button"
onClick={() => {
if (ref.current) {
const code = ref.current.innerText
Expand Down
1 change: 1 addition & 0 deletions src/components/stateless/StarRating/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const StarRating = ({ value }) => {
onMouseOut={() => hoverOver(null)}
onClick={(e) => setRating(e.target.getAttribute('data-star-id') || rating)}
onMouseOver={hoverOver}
role="button"
>
{Array.from({ length: 5 }, (v, i) => (
<Star starId={i + 1} key={`star_${i + 1}`} marked={selection ? selection >= i + 1 : rating >= i + 1} />
Expand Down
6 changes: 3 additions & 3 deletions src/pages/layout/proSider/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { MenuFoldOutlined, MenuUnfoldOutlined } from '@ant-design/icons'

import styles from './index.module.less'

const ProSider = (props) => {
const ProSider = ({ children }) => {
const [collapsed, setCollapsed] = useState(false)

const onCollapse = () => {
Expand All @@ -21,8 +21,8 @@ const ProSider = (props) => {
trigger={null}
className={styles.sider}
>
{props.children}
<div className={styles.proLink} onClick={onCollapse}>
{children}
<div className={styles.proLink} onClick={onCollapse} role="button">
{collapsed ? (
<MenuUnfoldOutlined style={{ fontSize: '16px', color: '#08c', cursor: 'pointer' }} />
) : (
Expand Down
12 changes: 5 additions & 7 deletions src/utils/aidFn.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,9 @@ export const getParamObject = (val) => {
export const reqStringify = (val) => stringify(val, { arrayFormat: 'repeat', strictNullHandling: true })

export const getType = (obj) => {
const type = typeof obj
if (type !== 'object') {
return type
}
return Object.prototype.toString.call(obj).replace(/^$/, '$1')
const typeString = Object.prototype.toString.call(obj)
const match = /\[object (.*?)\]/.exec(typeString)
return match ? match[1] : null
}

export const hidePhone = (phone) => phone?.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
Expand Down Expand Up @@ -112,7 +110,7 @@ export const isDecimal = (value) => {
export const limitDecimal = (val) => val.replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3')

export const passwordStrength = (pass) => {
const reg = /^(?=.*[A-Z])(?=.*[0-9])(?=.*[a-z]).{8,}$/
const reg = /^(?=.*[A-Z])(?=.*[\d])(?=.*[a-z]).{8,}$/
return reg.test(pass)
}

Expand Down Expand Up @@ -322,7 +320,7 @@ export const readFromFile = () =>
fileReader.onload = (e) => {
res(e.target.result)
}
fileReader.onerror = (e) => rej(e)
fileReader.onerror = (e) => rej(new Error(e))
fileReader.readAsText(file)
}

Expand Down

0 comments on commit e539666

Please sign in to comment.