From eef15521c3b566cba2e87d71ca987d4ab405765e Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Sun, 30 Jul 2023 06:15:50 +0000 Subject: [PATCH] style: format code with prettier and standardjs Format code with prettier and standardjs This commit fixes the style issues introduced in 68c8221 according to the output from Prettier and StandardJS. Details: https://app.deepsource.com/gh/wkylin/pro-react-admin/transform/4a2c915f-7fd9-4fe6-bd2b-e25b3aef3e2e/ --- .../container/musicPlayer/Controls.jsx | 24 ++++++++++--------- src/service/fetch.js | 24 +++++++++---------- src/utils/aidFn.js | 12 +++++----- 3 files changed, 31 insertions(+), 29 deletions(-) diff --git a/src/components/container/musicPlayer/Controls.jsx b/src/components/container/musicPlayer/Controls.jsx index b15d8acc..e4bbb062 100644 --- a/src/components/container/musicPlayer/Controls.jsx +++ b/src/components/container/musicPlayer/Controls.jsx @@ -11,31 +11,33 @@ const Controls = ({ currentSongs, handlePlayPause, handlePrevSong, - handleNextSong, + handleNextSong }) => ( -
+
setRepeat((prev) => !prev)} - className="hidden sm:block cursor-pointer" + className='hidden sm:block cursor-pointer' /> {currentSongs?.length > 0 && ( - - )} - {isPlaying ? ( - - ) : ( - + )} + {isPlaying + ? ( + + ) + : ( + + )} {currentSongs?.length > 0 && ( - + )} setShuffle((prev) => !prev)} - className="hidden sm:block cursor-pointer" + className='hidden sm:block cursor-pointer' />
) diff --git a/src/service/fetch.js b/src/service/fetch.js index cfc1b0e8..75b7c85b 100644 --- a/src/service/fetch.js +++ b/src/service/fetch.js @@ -30,11 +30,11 @@ const initOptions = { method: 'GET', // POST, *GET, PUT, DELETE, PATCH, [HEAD, CONNECT, OPTIONS, TRACE] headers: { // Accept: 'application/json', - 'Content-Type': 'application/json;charset=utf-8', // text/plain;charset=UTF-8 *application/json;charset=utf-8 application/x-www-form-urlencoded + 'Content-Type': 'application/json;charset=utf-8' // text/plain;charset=UTF-8 *application/json;charset=utf-8 application/x-www-form-urlencoded // Authorization: getToken() ? `Bearer ${getToken()}` : null, }, signal: null, - credentials: 'include', // include *same-origin + credentials: 'include' // include *same-origin // mode: 'cors', // no-cors, cors, *same-origin // redirect: 'follow', // manual, *follow, error // referrer: 'no-referrer', // no-referrer *client, @@ -92,7 +92,7 @@ const handleFetchData = (url, options) => { fetch('http://localhost:5200/apis', { method: 'POST', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ url: url.split('?')[0], delay }), + body: JSON.stringify({ url: url.split('?')[0], delay }) }) .then((res) => res.json()) .then((data) => console.log(data)) @@ -116,7 +116,7 @@ const handleFetchData = (url, options) => { .arrayBuffer() .then((resBuffer) => { const blob = new Blob([resBuffer], { - type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }) const disposition = response.headers.get('content-disposition') const fileName = decodeURI(disposition?.split('=')[1].replace(/'/g, '')).replace("utf-8''", '') || '' @@ -163,7 +163,7 @@ export const reqFetch = ( headers = null, isShowError = true, timeout = 20000, - controller = null, + controller = null } = params const defaultOptions = { @@ -171,11 +171,11 @@ export const reqFetch = ( method, headers: { ...initOptions.headers, - ...headers, + ...headers }, controller, timeout, - isShowError, + isShowError } // POST, *GET, PUT, DELETE, PATCH, [HEAD, CONNECT, OPTIONS, TRACE] @@ -199,29 +199,29 @@ export const reqFetch = ( export const getFetch = (url, params) => reqFetch(url, { method: 'GET', - ...params, + ...params }) export const postFetch = (url, params) => reqFetch(url, { method: 'POST', - ...params, + ...params }) export const putFetch = (url, params) => reqFetch(url, { method: 'PUT', - ...params, + ...params }) export const deleteFetch = (url, params) => reqFetch(url, { method: 'DELETE', - ...params, + ...params }) export const patchFetch = (url, params) => reqFetch(url, { method: 'PATCH', - ...params, + ...params }) diff --git a/src/utils/aidFn.js b/src/utils/aidFn.js index 6f2034e7..1eb4f8d0 100644 --- a/src/utils/aidFn.js +++ b/src/utils/aidFn.js @@ -65,7 +65,7 @@ export const getImgsUrl = (html) => { export const customizeTimer = { intervalTimer: null, timeoutTimer: null, - setTimeout(cb, interval) { + setTimeout (cb, interval) { const { now } = Date const stime = now() let etime = stime @@ -80,10 +80,10 @@ export const customizeTimer = { this.timeoutTimer = requestAnimationFrame(loop) return this.timeoutTimer }, - clearTimeout() { + clearTimeout () { cancelAnimationFrame(this.timeoutTimer) }, - setInterval(cb, interval) { + setInterval (cb, interval) { const { now } = Date let stime = now() let etime = stime @@ -99,9 +99,9 @@ export const customizeTimer = { this.intervalTimer = requestAnimationFrame(loop) return this.intervalTimer }, - clearInterval() { + clearInterval () { cancelAnimationFrame(this.intervalTimer) - }, + } } export const isDecimal = (value) => { @@ -208,7 +208,7 @@ export const hasFocus = (element) => element === document.activeElement export const isEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b) export const randomString = () => Math.random().toString(36).slice(2) export const escape = (str) => - str.replace(/[&<>"']/g, (m) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[m])) + str.replace(/[&<>"']/g, (m) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[m]) export const toCamelCase = (str) => str.trim().replace(/[-_\s]+(.)?/g, (_, c) => (c ? c.toUpperCase() : '')) export const random = (min, max) => Math.floor(Math.random() * (max - min + 1) + min) export const randomColor = () => `#${Math.random().toString(16).slice(2, 8).padEnd(6, '0')}`