Skip to content

Commit c555280

Browse files
committed
lint
1 parent 95bea67 commit c555280

File tree

10 files changed

+56
-30
lines changed

10 files changed

+56
-30
lines changed

packages/template-retail-react-app/app/components/login/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const LoginForm = ({
4242
data-testid="sf-auth-modal-form"
4343
>
4444
{form.formState.errors?.global && (
45-
<Alert status="error" marginBottom={8} >
45+
<Alert status="error" marginBottom={8}>
4646
<AlertIcon color="red.500" boxSize={4} />
4747
<Text fontSize="sm" ml={3}>
4848
{form.formState.errors.global.message}

packages/template-retail-react-app/app/components/login/index.test.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,22 @@ describe('LoginForm', () => {
3232

3333
test('renders form errors when "Continue Securely" button is clicked', async () => {
3434
const mockPasswordlessLoginClick = jest.fn()
35-
const {user} = renderWithProviders(<WrapperComponent isPasswordlessEnabled={true} handlePasswordlessLoginClick={mockPasswordlessLoginClick}/>)
35+
const {user} = renderWithProviders(
36+
<WrapperComponent
37+
isPasswordlessEnabled={true}
38+
handlePasswordlessLoginClick={mockPasswordlessLoginClick}
39+
/>
40+
)
3641

3742
await user.click(screen.getByRole('button', {name: 'Continue Securely'}))
3843
expect(screen.getByText(/Please enter your email address./)).toBeInTheDocument()
3944
})
4045

4146
test('renders form errors when "Password" button is clicked', async () => {
4247
const mockSetLoginType = jest.fn()
43-
const {user} = renderWithProviders(<WrapperComponent isPasswordlessEnabled={true} setLoginType={mockSetLoginType}/>)
48+
const {user} = renderWithProviders(
49+
<WrapperComponent isPasswordlessEnabled={true} setLoginType={mockSetLoginType} />
50+
)
4451

4552
await user.click(screen.getByRole('button', {name: 'Password'}))
4653
expect(screen.getByText(/Please enter your email address./)).toBeInTheDocument()

packages/template-retail-react-app/app/components/passwordless-login/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ const PasswordlessLogin = ({
9090
handleForgotPasswordClick={handleForgotPasswordClick}
9191
hideEmail={true}
9292
/>
93-
)}
93+
)}
9494
</>
9595
)
9696
}

packages/template-retail-react-app/app/components/social-login/index.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ import {setSessionJSONItem, buildRedirectURI} from '@salesforce/retail-react-app
1818
// Icons
1919
import {AppleIcon, GoogleIcon} from '@salesforce/retail-react-app/app/components/icons'
2020

21-
import {API_ERROR_MESSAGE, FEATURE_UNAVAILABLE_ERROR_MESSAGE} from '@salesforce/retail-react-app/app/constants'
21+
import {
22+
API_ERROR_MESSAGE,
23+
FEATURE_UNAVAILABLE_ERROR_MESSAGE
24+
} from '@salesforce/retail-react-app/app/constants'
2225

2326
const IDP_CONFIG = {
2427
apple: {

packages/template-retail-react-app/app/constants.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ export const FEATURE_UNAVAILABLE_ERROR_MESSAGE = defineMessage({
100100
id: 'global.error.feature_unavailable'
101101
})
102102
export const CREATE_ACCOUNT_FIRST_ERROR_MESSAGE = defineMessage({
103-
defaultMessage: 'This feature is not currently available. You must create an account to access this feature.',
103+
defaultMessage:
104+
'This feature is not currently available. You must create an account to access this feature.',
104105
id: 'global.error.create_account'
105106
})
106107

@@ -260,7 +261,7 @@ export const PASSWORDLESS_LOGIN_LANDING_PATH = '/passwordless-login-landing'
260261
export const PASSWORDLESS_ERROR_MESSAGES = [
261262
/callback_uri doesn't match/i,
262263
/passwordless permissions error/i,
263-
/client secret is not provided/i,
264+
/client secret is not provided/i
264265
]
265266

266267
export const INVALID_TOKEN_ERROR = /invalid token/i

packages/template-retail-react-app/app/hooks/use-auth-modal.js

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@ import ResetPasswordForm from '@salesforce/retail-react-app/app/components/reset
3131
import RegisterForm from '@salesforce/retail-react-app/app/components/register'
3232
import PasswordlessEmailConfirmation from '@salesforce/retail-react-app/app/components/email-confirmation/index'
3333
import {noop} from '@salesforce/retail-react-app/app/utils/utils'
34-
import {API_ERROR_MESSAGE, FEATURE_UNAVAILABLE_ERROR_MESSAGE, CREATE_ACCOUNT_FIRST_ERROR_MESSAGE, LOGIN_TYPES, PASSWORDLESS_ERROR_MESSAGES} from '@salesforce/retail-react-app/app/constants'
34+
import {
35+
API_ERROR_MESSAGE,
36+
FEATURE_UNAVAILABLE_ERROR_MESSAGE,
37+
CREATE_ACCOUNT_FIRST_ERROR_MESSAGE,
38+
LOGIN_TYPES,
39+
PASSWORDLESS_ERROR_MESSAGES
40+
} from '@salesforce/retail-react-app/app/constants'
3541
import useNavigation from '@salesforce/retail-react-app/app/hooks/use-navigation'
3642
import {usePrevious} from '@salesforce/retail-react-app/app/hooks/use-previous'
3743
import {usePasswordReset} from '@salesforce/retail-react-app/app/hooks/use-password-reset'
@@ -102,10 +108,10 @@ export const AuthModal = ({
102108
} catch (error) {
103109
const message = /error getting user info/i.test(error.message)
104110
? formatMessage(CREATE_ACCOUNT_FIRST_ERROR_MESSAGE)
105-
: PASSWORDLESS_ERROR_MESSAGES.some(msg => msg.test(error.message))
106-
? formatMessage(FEATURE_UNAVAILABLE_ERROR_MESSAGE)
107-
: formatMessage(API_ERROR_MESSAGE)
108-
form.setError('global', { type: 'manual', message })
111+
: PASSWORDLESS_ERROR_MESSAGES.some((msg) => msg.test(error.message))
112+
? formatMessage(FEATURE_UNAVAILABLE_ERROR_MESSAGE)
113+
: formatMessage(API_ERROR_MESSAGE)
114+
form.setError('global', {type: 'manual', message})
109115
}
110116
}
111117

@@ -171,10 +177,11 @@ export const AuthModal = ({
171177
try {
172178
await getPasswordResetToken(data.email)
173179
} catch (e) {
174-
const message = e.response?.status === 400
175-
? formatMessage(FEATURE_UNAVAILABLE_ERROR_MESSAGE)
176-
: formatMessage(API_ERROR_MESSAGE)
177-
form.setError('global', { type: 'manual', message });
180+
const message =
181+
e.response?.status === 400
182+
? formatMessage(FEATURE_UNAVAILABLE_ERROR_MESSAGE)
183+
: formatMessage(API_ERROR_MESSAGE)
184+
form.setError('global', {type: 'manual', message})
178185
}
179186
},
180187
email: async () => {

packages/template-retail-react-app/app/hooks/use-password-reset.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ export const usePasswordReset = () => {
1919
const {formatMessage} = useIntl()
2020
const appOrigin = useAppOrigin()
2121
const config = getConfig()
22-
const resetPasswordCallback = config.app.login?.resetPassword?.callbackURI || '/reset-password-callback'
23-
const callbackURI = isAbsoluteURL(resetPassworCallback) ? resetPassworCallback : `${appOrigin}${resetPasswordCallback}`
22+
const resetPasswordCallback =
23+
config.app.login?.resetPassword?.callbackURI || '/reset-password-callback'
24+
const callbackURI = isAbsoluteURL(resetPasswordCallback)
25+
? resetPasswordCallback
26+
: `${appOrigin}${resetPasswordCallback}`
2427

2528
const getPasswordResetTokenMutation = useAuthHelper(AuthHelpers.GetPasswordResetToken)
2629
const resetPasswordMutation = useAuthHelper(AuthHelpers.ResetPassword)

packages/template-retail-react-app/app/pages/login/index.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import {
3333
LOGIN_TYPES,
3434
PASSWORDLESS_LOGIN_LANDING_PATH,
3535
PASSWORDLESS_ERROR_MESSAGES,
36-
CREATE_ACCOUNT_FIRST_ERROR_MESSAGE,
36+
CREATE_ACCOUNT_FIRST_ERROR_MESSAGE
3737
} from '@salesforce/retail-react-app/app/constants'
3838
import {usePrevious} from '@salesforce/retail-react-app/app/hooks/use-previous'
3939
import {isServer} from '@salesforce/retail-react-app/app/utils/utils'
@@ -113,10 +113,10 @@ const Login = ({initialView = LOGIN_VIEW}) => {
113113
} catch (error) {
114114
const message = /error getting user info/i.test(error.message)
115115
? formatMessage(CREATE_ACCOUNT_FIRST_ERROR_MESSAGE)
116-
: PASSWORDLESS_ERROR_MESSAGES.some(msg => msg.test(error.message))
117-
? formatMessage(FEATURE_UNAVAILABLE_ERROR_MESSAGE)
118-
: formatMessage(API_ERROR_MESSAGE)
119-
form.setError('global', { type: 'manual', message })
116+
: PASSWORDLESS_ERROR_MESSAGES.some((msg) => msg.test(error.message))
117+
? formatMessage(FEATURE_UNAVAILABLE_ERROR_MESSAGE)
118+
: formatMessage(API_ERROR_MESSAGE)
119+
form.setError('global', {type: 'manual', message})
120120
}
121121
}
122122

@@ -150,7 +150,7 @@ const Login = ({initialView = LOGIN_VIEW}) => {
150150
if (path === PASSWORDLESS_LOGIN_LANDING_PATH) {
151151
const token = queryParams.get('token')
152152

153-
const passwordlessLogin = async() => {
153+
const passwordlessLogin = async () => {
154154
try {
155155
await loginPasswordless.mutateAsync({pwdlessLoginToken: token})
156156
} catch (e) {

packages/template-retail-react-app/app/pages/reset-password/index.jsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ import useEinstein from '@salesforce/retail-react-app/app/hooks/use-einstein'
1818
import {useLocation} from 'react-router-dom'
1919
import {useRouteMatch} from 'react-router'
2020
import {usePasswordReset} from '@salesforce/retail-react-app/app/hooks/use-password-reset'
21-
import {RESET_PASSWORD_LANDING_PATH, API_ERROR_MESSAGE, FEATURE_UNAVAILABLE_ERROR_MESSAGE} from '@salesforce/retail-react-app/app/constants'
21+
import {
22+
RESET_PASSWORD_LANDING_PATH,
23+
API_ERROR_MESSAGE,
24+
FEATURE_UNAVAILABLE_ERROR_MESSAGE
25+
} from '@salesforce/retail-react-app/app/constants'
2226

2327
const ResetPassword = () => {
2428
const {formatMessage} = useIntl()
@@ -33,10 +37,11 @@ const ResetPassword = () => {
3337
try {
3438
await getPasswordResetToken(email)
3539
} catch (e) {
36-
const message = e.response?.status === 400
37-
? formatMessage(FEATURE_UNAVAILABLE_ERROR_MESSAGE)
38-
: formatMessage(API_ERROR_MESSAGE)
39-
form.setError('global', { type: 'manual', message });
40+
const message =
41+
e.response?.status === 400
42+
? formatMessage(FEATURE_UNAVAILABLE_ERROR_MESSAGE)
43+
: formatMessage(API_ERROR_MESSAGE)
44+
form.setError('global', {type: 'manual', message})
4045
}
4146
}
4247

packages/template-retail-react-app/app/pages/social-login-redirect/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const SocialLoginRedirect = () => {
5151
if (!searchParams.code) {
5252
return
5353
}
54-
const socialLogin = async() => {
54+
const socialLogin = async () => {
5555
try {
5656
await loginIDPUser.mutateAsync({
5757
code: searchParams.code,

0 commit comments

Comments
 (0)