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

style: format code with Prettier and StandardJS #188

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.mjs
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
Loading