Skip to content

Commit 3540428

Browse files
author
amazon-meaisiah
committedMar 13, 2021
Fix ESLint warnings and errors from updating
1 parent b4a3943 commit 3540428

File tree

15 files changed

+81
-61
lines changed

15 files changed

+81
-61
lines changed
 

‎.eslintignore

+4-10
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1+
# because ESLint configs frequently need to be JS.
2+
13
# top-level and lambda function specific
2-
/node_modules
4+
**/node_modules
35
/coverage
46
/lambdas/static-asset-uploader/build/
57
/lambdas/coverage/
6-
/lambdas/backend/node_modules/
7-
/lambdas/catalog-updater/node_modules/
8-
/lambdas/cfn-cognito-user-pools-client-settings/node_modules/
9-
/lambdas/cfn-cognito-user-pools-domain/node_modules/
10-
/lambdas/cognito-user-pools-confirmation-strategy/node_modules/
11-
/lambdas/dump-v3-account-data/node_modules/
12-
/lambdas/listener/node_modules/
13-
/lambdas/shared/node_modules/
14-
/lambdas/static-asset-uploader/node_modules/
8+
!/lambdas/common-layer/nodejs/node_modules
159

1610
# devportal specific
1711

‎dev-portal/.eslintrc.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,15 @@
22

33
module.exports = {
44
extends: ['react-app', '../.eslintrc.js'],
5-
}
5+
overrides: [
6+
{
7+
files: ['.eslintrc.js', './*.js'],
8+
parserOptions: {
9+
sourceType: 'script'
10+
},
11+
rules: {
12+
strict: ['warn', 'global']
13+
}
14+
}
15+
]
16+
}

‎dev-portal/example-deployer.config.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Here's how you set this up:
2-
//
2+
//
33
// 1. Replace YOUR_LAMBDA_ARTIFACTS_BUCKET_NAME with the name of the bucket you created in step 3
44
// of the dev setup.
55
// 2. Replace 'CUSTOM_PREFIX' in the properties that have it with your name, your org name, or some
@@ -9,11 +9,11 @@
99
// 3. Set any other optional parameters as desired. For the DynamoDB tables, their names must be
1010
// unique to all DynamoDB tables within your account.
1111
// 4. Save the file.
12-
//
12+
//
1313
// Note: these configuration parameters are *not* the same as the SAM template parameters - the names differ and the behavior in many areas also differ. Furthermore, some SAM template parameters like `StaticAssetsRebuildToken` are handled automatically internally and cannot be configured.
14-
//
14+
//
1515
// See the "Deployer configuration" section of `BUILDING.md` for documentation on each of the parameters.
16-
"use strict"
16+
'use strict'
1717

1818
module.exports = {
1919
// Optional, but recommended if you have multiple active AWS CLI profiles.
@@ -24,7 +24,7 @@ module.exports = {
2424
stackName: 'CUSTOM_PREFIX-dev-portal',
2525
siteAssetsBucket: 'CUSTOM_PREFIX-dev-portal-static-assets',
2626
apiAssetsBucket: 'CUSTOM_PREFIX-dev-portal-artifacts',
27-
cognitoDomainName: 'CUSTOM_PREFIX-auth',
27+
cognitoDomainName: 'CUSTOM_PREFIX-auth'
2828

2929
// Optional, but highly encouraged if you have such a domain ready. Not all of these may apply.
3030
// customDomainName: 'developer.domain.example',
@@ -36,4 +36,4 @@ module.exports = {
3636
// Toggle this any time the edge lambda or its replicator lambda need updated. You will be told in
3737
// the migration instructions to do so if you need to.
3838
// edgeLambdaResetToken: 'reset',
39-
}
39+
}

‎dev-portal/example-dev-deployer.config.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// See `example-deployer.config.js` in this directory for setup instructions and the "Deployer
22
// configuration" section of `BUILDING.md` for documentation on each of the parameters.
3-
//
3+
//
44
// It's recommended you track your live deployments here. You can change this any time you want to
55
// do a fresh deployment.
66
// Live: 0
7-
"use strict"
7+
'use strict'
88

99
const n = 0
1010

@@ -30,10 +30,10 @@ module.exports = {
3030
staticAssetRebuildMode: 'overwrite-content',
3131

3232
// Set development mode for local use.
33-
developmentMode: true,
33+
developmentMode: true
3434

3535
// Toggle this any time the edge lambda or its replicator lambda are updated. In general, unless
3636
// either you're modifying them yourself or they were changed upstream and you just pulled those
3737
// changes, you shouldn't need to do anything about this value.
3838
// edgeLambdaResetToken: 'reset',
39-
}
39+
}

‎dev-portal/src/components/Admin/Accounts/AccountsTable.jsx

+2
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export const AccountsTable = ({
8787
directionIndex: 0
8888
})
8989

90+
/* eslint-disable brace-style */
9091
useEffect(() => {
9192
const filterableColumns = columns.filter(column => column.filtering)
9293
setFilterableColumns(filterableColumns)
@@ -109,6 +110,7 @@ export const AccountsTable = ({
109110
setFilter(filter => ({ ...filter, column: NO_FILTER_COLUMN }))
110111
}
111112
}, [columns, filter])
113+
/* eslint-enable brace-style */
112114

113115
/**
114116
* Sets `accountsView` to the filtered and sorted subset of `props.accounts`.

‎dev-portal/src/components/MessageList.jsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,24 @@ export const MessageList = ({ messages }) =>
1919
export const useMessages = () => {
2020
const [state, setState] = useState({
2121
messages: [],
22-
nextId: 0,
22+
nextId: 0
2323
})
2424

2525
const sendMessage = renderWithDismiss => {
2626
const id = state.nextId
2727
const dismiss = () => {
2828
setState(state => ({
2929
...state,
30-
messages: state.messages.filter(message => message.id !== id),
30+
messages: state.messages.filter(message => message.id !== id)
3131
}))
3232
}
3333
const newMessage = {
3434
render: () => renderWithDismiss(dismiss),
35-
id: state.nextId,
35+
id: state.nextId
3636
}
3737
setState(state => ({
3838
messages: [...state.messages, newMessage],
39-
nextId: state.nextId + 1,
39+
nextId: state.nextId + 1
4040
}))
4141
}
4242

‎dev-portal/src/pages/Admin/Accounts/AdminAccounts.jsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const AdminAccounts = () => {
1212

1313
const refreshAccounts = () =>
1414
AccountService.fetchAdminAccounts().then(accounts =>
15-
setAccounts(accounts),
15+
setAccounts(accounts)
1616
)
1717

1818
// Initial load
@@ -21,7 +21,7 @@ const AdminAccounts = () => {
2121
}, [])
2222

2323
const onSelectAccount = useCallback(account => setSelectedAccount(account), [
24-
setSelectedAccount,
24+
setSelectedAccount
2525
])
2626

2727
return (
@@ -32,7 +32,7 @@ const AdminAccounts = () => {
3232
columns={[
3333
AccountsTableColumns.EmailAddress,
3434
AccountsTableColumns.DatePromoted,
35-
AccountsTableColumns.Promoter,
35+
AccountsTableColumns.Promoter
3636
]}
3737
loading={loading}
3838
selectedAccount={selectedAccount}

‎dev-portal/src/pages/Admin/Accounts/PendingInvites.jsx

+13-13
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
Header,
66
Input,
77
Message,
8-
Modal,
8+
Modal
99
} from 'semantic-ui-react'
1010

1111
import * as MessageList from 'components/MessageList'
@@ -20,21 +20,21 @@ const PendingInvites = () => {
2020
const [loading, setLoading] = useState(true)
2121
const [selectedAccount, setSelectedAccount] = useState(undefined)
2222
const [isCreateModalOpen, openCreateModal, closeCreateModal] = useBoolean(
23-
false,
23+
false
2424
)
2525
const [isDeleteModalOpen, openDeleteModal, closeDeleteModal] = useBoolean(
26-
false,
26+
false
2727
)
2828
const [messages, sendMessage] = MessageList.useMessages()
2929
const [
3030
createModalMessages,
3131
sendCreateModalMessage,
32-
clearCreateModalMessages,
32+
clearCreateModalMessages
3333
] = MessageList.useMessages()
3434

3535
const refreshAccounts = () =>
3636
AccountService.fetchPendingInviteAccounts().then(accounts =>
37-
setAccounts(accounts),
37+
setAccounts(accounts)
3838
)
3939

4040
// Initial load
@@ -44,7 +44,7 @@ const PendingInvites = () => {
4444

4545
const onSelectAccount = useCallback(
4646
account => setSelectedAccount(account),
47-
[],
47+
[]
4848
)
4949

5050
const onConfirmCreate = useCallback(
@@ -77,8 +77,8 @@ const PendingInvites = () => {
7777
sendMessage,
7878
sendCreateModalMessage,
7979
clearCreateModalMessages,
80-
closeCreateModal,
81-
],
80+
closeCreateModal
81+
]
8282
)
8383

8484
const onConfirmResend = useCallback(async () => {
@@ -128,7 +128,7 @@ const PendingInvites = () => {
128128
columns={[
129129
AccountsTableColumns.EmailAddress,
130130
AccountsTableColumns.DateInvited,
131-
AccountsTableColumns.Inviter,
131+
AccountsTableColumns.Inviter
132132
]}
133133
loading={loading}
134134
selectedAccount={selectedAccount}
@@ -166,7 +166,7 @@ const TableActions = ({
166166
canResend,
167167
onClickResend,
168168
canDelete,
169-
onClickDelete,
169+
onClickDelete
170170
}) => (
171171
<Button.Group>
172172
<Button
@@ -186,7 +186,7 @@ const TableActions = ({
186186
// - The whole regexp was made case-insensitive to avoid the need for `A-Za-z` in classes.
187187
// - As we're only testing, I replaced all the non-capturing groups with capturing ones.
188188
const validEmailRegex =
189-
/^[\w.!#$%&'*+\/=?^`{|}~-]+@[^_\W]([a-z\d-]{0,61}[^_\W])?(\.[^_\W]([a-z\d-]{0,61}[^_\W])?)*$/i
189+
/^[\w.!#$%&'*+/=?^`{|}~-]+@[^_\W]([a-z\d-]{0,61}[^_\W])?(\.[^_\W]([a-z\d-]{0,61}[^_\W])?)*$/i
190190

191191
/*
192192
* Note: `onConfirm` should return a boolean indicating whether the creation
@@ -198,7 +198,7 @@ const CreateInviteModal = ({ onConfirm, open, onClose, messages }) => {
198198
const isEmailValid = useMemo(() => validEmailRegex.test(email), [email])
199199
const onChangeEmailAddress = useCallback(
200200
(_event, { value }) => setEmail(value),
201-
[],
201+
[]
202202
)
203203
const onClickCreate = useCallback(async () => {
204204
setLoading(true)
@@ -210,7 +210,7 @@ const CreateInviteModal = ({ onConfirm, open, onClose, messages }) => {
210210
setLoading(false)
211211
}
212212
}, [onConfirm, email])
213-
213+
214214
// If the user stops typing, but the email is invalid, show the invalid email message as a hint
215215
// for why they can't proceed. Don't make the timeout so short that it'd annoy a slow typer,
216216
// though.

‎dev-portal/src/pages/Admin/SideNav.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { isAdmin } from 'services/self'
77

88
import { observer } from 'mobx-react'
99

10-
import { Link } from 'react-router-dom'
1110
import { Menu } from 'semantic-ui-react'
1211
import Sidebar from 'components/Sidebar/Sidebar'
1312
import SidebarHeader from 'components/Sidebar/SidebarHeader'

0 commit comments

Comments
 (0)
Please sign in to comment.