Skip to content

Commit

Permalink
style: format code with Prettier and StandardJS
Browse files Browse the repository at this point in the history
This commit fixes the style issues introduced in f89b004 according to the output
from Prettier and StandardJS.

Details: #180
  • Loading branch information
deepsource-autofix[bot] authored Sep 8, 2024
1 parent f89b004 commit 70acd8c
Show file tree
Hide file tree
Showing 53 changed files with 1,954 additions and 1,952 deletions.
86 changes: 43 additions & 43 deletions client/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,48 +8,48 @@ import reactRefresh from 'eslint-plugin-react-refresh'
import eslintConfigPrettier from 'eslint-config-prettier'

export default [
js.configs.recommended,
{
files: ['**/*.{js,jsx}'],
ignores: ['dist/**/*', 'old/**/*'],
js.configs.recommended,
{
files: ['**/*.{js,jsx}'],
ignores: ['dist/**/*', 'old/**/*'],

languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parser: eslintParser,
parserOptions: {
babelrc: false,
configFile: false,
// your babel options
presets: ['@babel/preset-env'],
},
},
settings: { react: { version: '18.3' } },
plugins: {
react,
require,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...js.configs.recommended.rules,
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
...reactHooks.configs.recommended.rules,
'no-unused-vars': [
'warn',
{
vars: 'all',
args: 'after-used',
caughtErrors: 'all',
ignoreRestSiblings: false,
reportUsedIgnorePattern: false,
},
],
'react/jsx-no-target-blank': 'off',
'react/prop-types': 'off',
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
},
},
eslintConfigPrettier,
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parser: eslintParser,
parserOptions: {
babelrc: false,
configFile: false,
// your babel options
presets: ['@babel/preset-env']
}
},
settings: { react: { version: '18.3' } },
plugins: {
react,
require,
'react-hooks': reactHooks,
'react-refresh': reactRefresh
},
rules: {
...js.configs.recommended.rules,
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
...reactHooks.configs.recommended.rules,
'no-unused-vars': [
'warn',
{
vars: 'all',
args: 'after-used',
caughtErrors: 'all',
ignoreRestSiblings: false,
reportUsedIgnorePattern: false
}
],
'react/jsx-no-target-blank': 'off',
'react/prop-types': 'off',
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }]
}
},
eslintConfigPrettier
]
18 changes: 9 additions & 9 deletions client/prettier.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
* @type {import("prettier").Config}
*/
const config = {
$schema: 'http://json.schemastore.org/prettierrc',
bracketSpacing: true,
printWidth: 500,
proseWrap: 'always',
semi: false,
singleQuote: true,
tabWidth: 4,
trailingComma: 'es5',
useTabs: true,
$schema: 'http://json.schemastore.org/prettierrc',
bracketSpacing: true,
printWidth: 500,
proseWrap: 'always',
semi: false,
singleQuote: true,
tabWidth: 4,
trailingComma: 'es5',
useTabs: true
}

export default config
48 changes: 24 additions & 24 deletions client/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,34 @@ import { SnackbarProvider, ThemeProvider } from './providers'
// import { GoogleOAuthProvider } from '@react-oauth/google'

const MemoriesApp = () => {
// [System.Environment]::SetEnvironmentVariable("NODE_ENV","development","User")
const appEnviromnent = import.meta.env.MODE || 'development'
// [System.Environment]::SetEnvironmentVariable("NODE_ENV","development","User")
const appEnviromnent = import.meta.env.MODE || 'development'

console.log(`App Environment: ${appEnviromnent}\n`, import.meta.env)
return (
<Provider store={store}>
<BrowserRouter>
<Navbar />
<AppRouter />
<Snackbar />
<ScrollToTop />
{!(appEnviromnent === 'production') && <PlaygroundFab />}
</BrowserRouter>
</Provider>
)
console.log(`App Environment: ${appEnviromnent}\n`, import.meta.env)
return (
<Provider store={store}>
<BrowserRouter>
<Navbar />
<AppRouter />
<Snackbar />
<ScrollToTop />
{!(appEnviromnent === 'production') && <PlaygroundFab />}
</BrowserRouter>
</Provider>
)
}

const App = () => {
return (
<ThemeProvider>
<CssBaseline />
{/* <GoogleOAuthProvider clientId={import.meta.env.VITE_GOOGLE_CLIENT_ID}> */}
<SnackbarProvider>
<MemoriesApp />
</SnackbarProvider>
{/* </GoogleOAuthProvider> */}
</ThemeProvider>
)
return (
<ThemeProvider>
<CssBaseline />
{/* <GoogleOAuthProvider clientId={import.meta.env.VITE_GOOGLE_CLIENT_ID}> */}
<SnackbarProvider>
<MemoriesApp />
</SnackbarProvider>
{/* </GoogleOAuthProvider> */}
</ThemeProvider>
)
}

export default App
90 changes: 45 additions & 45 deletions client/src/actions/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,60 @@ import { AUTH } from '../constants/actionTypes'
import * as api from '../api'

export const signin = (formData, history, snackBar) => async (dispatch) => {
try {
// log in the user ...
const { data } = await api.signIn(formData)
dispatch({ type: AUTH, data })
snackBar('success', 'Logged in Successfully')
history('/')
} catch (error) {
snackBar('error', error.response.data.message)
}
try {
// log in the user ...
const { data } = await api.signIn(formData)
dispatch({ type: AUTH, data })
snackBar('success', 'Logged in Successfully')
history('/')
} catch (error) {
snackBar('error', error.response.data.message)
}
}
export const googleSignIn = (formData, history, snackBar) => async (dispatch) => {
try {
await api.googleSignIn(formData.result)
dispatch({ type: AUTH, data: formData })
history('/')
snackBar('success', 'Logged in Successfully')
} catch (error) {
snackBar('error', error.response.data.message)
}
try {
await api.googleSignIn(formData.result)
dispatch({ type: AUTH, data: formData })
history('/')
snackBar('success', 'Logged in Successfully')
} catch (error) {
snackBar('error', error.response.data.message)
}
}

export const signup = (formData, history, snackBar) => async (dispatch) => {
try {
// sign up the user ...
const { data } = await api.signUp(formData)
dispatch({ type: AUTH, data })
snackBar('success', 'Registration Successful ! Welcome to memories')
history('/')
} catch (error) {
snackBar('error', error.response.data.message)
}
try {
// sign up the user ...
const { data } = await api.signUp(formData)
dispatch({ type: AUTH, data })
snackBar('success', 'Registration Successful ! Welcome to memories')
history('/')
} catch (error) {
snackBar('error', error.response.data.message)
}
}

export const forgotPassword = (formData, history, snackBar, setLoading) => async () => {
try {
await api.sendResetLink(formData)
snackBar('success', 'Reset Link sent to your Email. Now Reset Password')
setLoading(false)
history('/')
} catch (error) {
snackBar('error', error.response.data.message)
console.log(`error: ${error.response.data.error}`)
}
setLoading(false)
try {
await api.sendResetLink(formData)
snackBar('success', 'Reset Link sent to your Email. Now Reset Password')
setLoading(false)
history('/')
} catch (error) {
snackBar('error', error.response.data.message)
console.log(`error: ${error.response.data.error}`)
}
setLoading(false)
}

export const setNewPassword = (formData, history, snackBar, setLoading) => async () => {
try {
await api.setNewPassword(formData)
snackBar('success', 'Password was successfully reset. Now Log in')
setLoading(false)
history('/')
} catch (error) {
snackBar('error', error.response.data.message)
}
setLoading(false)
try {
await api.setNewPassword(formData)
snackBar('success', 'Password was successfully reset. Now Log in')
setLoading(false)
history('/')
} catch (error) {
snackBar('error', error.response.data.message)
}
setLoading(false)
}
Loading

0 comments on commit 70acd8c

Please sign in to comment.