Skip to content

Commit

Permalink
Bulk update dependencies (#2402)
Browse files Browse the repository at this point in the history
* chore(deps): remove @babel/plugin-proposal-class-properties

* chore: update fontawesome

* chore: update octicons, auth and monitoring packages

* chore(deps): update husky@8.x, skip install on heroku

* chore: bump commitlint

* test(PaletteContainer): update snapshot from upgrading fontawesome

* chore: update eslint

* chore: bump prettier

* chore: prettier formatting

* chore: update stylelint, remove use of optimizeLegibility css

* chore: update browserslist

* chore: update testing-library packages

* chore: update jest@28 and others

- must now install jest-environment-jsdom manually
- add resolver config to work around uuid/nanoid export incompatibility with jest
- jsdom now handles native form input validation, so we remove manual validation code
  • Loading branch information
louh committed Jul 9, 2022
1 parent 00830ef commit 741e73b
Show file tree
Hide file tree
Showing 66 changed files with 8,400 additions and 9,981 deletions.
4 changes: 4 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
"CYPRESS_INSTALL_BINARY": {
"description": "Skip installing Cypress in deployment environments. See https://docs.cypress.io/guides/getting-started/installing-cypress.html#Skipping-installation",
"value": "0"
},
"HUSKY": {
"description": "Skip installing Husky (v8+).",
"value": "0"
}
},
"addons": [
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/auth0_sign_in_callback.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ exports.get = function (req, res) {
grant_type: 'authorization_code',
client_id: process.env.AUTH0_CLIENT_ID,
client_secret: process.env.AUTH0_CLIENT_SECRET,
code: code,
code,
redirect_uri: redirectUri
}

Expand Down
20 changes: 14 additions & 6 deletions app/db/migrations/20210506170155-update-user-profile-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,24 @@ module.exports = {
//
// Apologies for the raw SQL. If Sequelize has an interface for this query,
// please do replace.
return queryInterface.sequelize.transaction(t => {
return queryInterface.sequelize.transaction((t) => {
return Promise.all([
queryInterface.sequelize.query(`
queryInterface.sequelize.query(
`
UPDATE "Users"
SET profile_image_url = profile_image_url::varchar(255)
WHERE CHAR_LENGTH(profile_image_url) > 255
`, { transaction: t }),
queryInterface.changeColumn('Users', 'profile_image_url', {
type: Sequelize.STRING
}, { transaction: t })
`,
{ transaction: t }
),
queryInterface.changeColumn(
'Users',
'profile_image_url',
{
type: Sequelize.STRING
},
{ transaction: t }
)
])
})
}
Expand Down
2 changes: 1 addition & 1 deletion app/resources/services/images.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ exports.get = async function (req, res) {
}

const payload = {
signature: signature,
signature,
timestamp: query.timestamp,
api_key: process.env.CLOUDINARY_API_KEY
}
Expand Down
4 changes: 2 additions & 2 deletions app/resources/services/integrations/coil.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ exports.BTPTokenCheck = async (req, res, next) => {
addOrUpdateByProviderName(identities, coilData)
await User.update(
{
identities: identities
identities
},
{ where: { auth0Id: userData.auth0Id }, returning: true }
)
Expand Down Expand Up @@ -186,7 +186,7 @@ const refreshAccessToken = async (refreshToken) => {
Authorization: `Basic ${encodedAuth}`,
'content-type': 'application/x-www-form-urlencoded'
},
data: data
data
}
const response = await axios(requestConfig)
return response.data.access_token
Expand Down
2 changes: 1 addition & 1 deletion app/resources/services/integrations/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function addUserConnection (account, profile) {
// be removed.
await User.update(
{
identities: identities
identities
},
{ where: { auth0Id: account.auth0Id }, returning: true, transaction: t }
)
Expand Down
4 changes: 3 additions & 1 deletion app/resources/v1/__tests__/flags.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ describe('get api/v1/flags', function () {
.get('/api/v1/flags')
.then((response) => {
expect(response.statusCode).toEqual(200)
expect(response.get('Content-Type').toLowerCase()).toEqual('application/json; charset=utf-8')
expect(response.get('Content-Type').toLowerCase()).toEqual(
'application/json; charset=utf-8'
)
expect(response.body.GEOTAG.label).toEqual('UI — Geotagging')
})
})
Expand Down
8 changes: 6 additions & 2 deletions app/resources/v1/__tests__/translate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ describe('get api/v1/translate', function () {
.get('/api/v1/translate/en/main')
.then((response) => {
expect(response.statusCode).toEqual(200)
expect(response.get('Content-Type').toLowerCase()).toEqual('application/json; charset=utf-8')
expect(response.body.dialogs.welcome.heading).toEqual('Welcome to Streetmix.')
expect(response.get('Content-Type').toLowerCase()).toEqual(
'application/json; charset=utf-8'
)
expect(response.body.dialogs.welcome.heading).toEqual(
'Welcome to Streetmix.'
)
})
})

Expand Down
2 changes: 1 addition & 1 deletion app/resources/v1/geo.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ exports.get = async function (req, res) {
type: 'Feature',
geometry: {
type: 'Point',
coordinates: coordinates
coordinates
},
properties: result
}
Expand Down
2 changes: 1 addition & 1 deletion app/resources/v1/street_images.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ exports.post = async function (req, res) {
const details = {
public_id: publicId,
street_type: streetType,
creatorId: creatorId,
creatorId,
edit_count: editCount
}

Expand Down
6 changes: 3 additions & 3 deletions app/resources/v1/streets.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,13 +305,13 @@ exports.find = async function (req, res) {
throw new Error(ERRORS.USER_NOT_FOUND)
}
return Street.findOne({
where: { namespacedId: namespacedId, creatorId: user.id }
where: { namespacedId, creatorId: user.id }
})
} // END function - findStreetWithCreatorId

const findStreetWithNamespacedId = async function (namespacedId) {
return Street.findOne({
where: { namespacedId: namespacedId, creatorId: null }
where: { namespacedId, creatorId: null }
})
}

Expand Down Expand Up @@ -376,7 +376,7 @@ exports.find = async function (req, res) {
self: selfUri
}
},
streets: streets
streets
}

if (start > 0) {
Expand Down
2 changes: 1 addition & 1 deletion app/resources/v1/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ exports.post = async function (req, res) {
} else {
const id = generateId(credentials.nickname)
const newUserData = {
id: id,
id,
auth0Id: credentials.auth0Id,
email: credentials.email,
profileImageUrl: credentials.profileImageUrl
Expand Down
2 changes: 1 addition & 1 deletion app/resources/v1/users_streets.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ exports.get = async function (req, res) {
} // END function - handleFindUserstreets

const handleFindUserStreets = function (streets) {
const json = { streets: streets }
const json = { streets }
res.status(200).json(json).end()
} // END function - handleFindUserStreets

Expand Down
4 changes: 2 additions & 2 deletions app/resources/v1/votes.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ exports.put = async function (req, res) {
return
}
const ballot = await Vote.findOne({
where: { id: id, voter_id: user.id }
where: { id, voter_id: user.id }
})

if (!ballot) {
Expand Down Expand Up @@ -295,7 +295,7 @@ exports.post = async function (req, res) {
res.status(500).json({ status: 500, msg: 'Error filling ballot.' })
return
}
const payload = { ballot, savedBallot, updates: updates }
const payload = { ballot, savedBallot, updates }

res.status(200).json(payload)
}
42 changes: 27 additions & 15 deletions assets/scripts/app/DateTimeRelative.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ const SECONDS_AGO = 1000 * 60
*/
function isSameDay (a, b) {
return (
(a.getFullYear() === b.getFullYear()) &&
(a.getMonth() === b.getMonth()) &&
(a.getDate() === b.getDate())
a.getFullYear() === b.getFullYear() &&
a.getMonth() === b.getMonth() &&
a.getDate() === b.getDate()
)
}

Expand All @@ -28,15 +28,21 @@ export default function DateTimeRelative (props) {
if (diff < SECONDS_AGO) {
return (
<time dateTime={props.value} title={props.value}>
<FormattedMessage id="datetime.seconds-ago" defaultMessage="A few seconds ago" />
<FormattedMessage
id="datetime.seconds-ago"
defaultMessage="A few seconds ago"
/>
</time>
)
}

if (diff < MINUTES_AGO) {
return (
<time dateTime={props.value} title={props.value}>
<FormattedMessage id="datetime.minutes-ago" defaultMessage="A few minutes ago" />
<FormattedMessage
id="datetime.minutes-ago"
defaultMessage="A few minutes ago"
/>
</time>
)
}
Expand Down Expand Up @@ -90,11 +96,7 @@ export default function DateTimeRelative (props) {
if (now.getFullYear() === date.getFullYear()) {
return (
<time dateTime={props.value} title={props.value}>
<FormattedDate
value={props.value}
month="long"
day="numeric"
/>
<FormattedDate value={props.value} month="long" day="numeric" />
</time>
)
}
Expand All @@ -114,12 +116,22 @@ export default function DateTimeRelative (props) {
DateTimeRelative.propTypes = {
// prop should match an ISO date string, e.g. "2018-04-24T23:37:55.21Z"
value: (props, propName, componentName) => {
if (!/^\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+Z$/.test(props[propName]) &&
typeof props[propName] !== 'undefined') {
if (
!/^\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+Z$/.test(
props[propName]
) &&
typeof props[propName] !== 'undefined'
) {
return new Error(
'Invalid prop `' + propName + '` supplied to' +
' `' + componentName + '`. It should be an ISO date string.' +
' Validation failed. Value: `' + props[propName] + '`'
'Invalid prop `' +
propName +
'` supplied to' +
' `' +
componentName +
'`. It should be an ISO date string.' +
' Validation failed. Value: `' +
props[propName] +
'`'
)
}
},
Expand Down
4 changes: 1 addition & 3 deletions assets/scripts/app/Flash.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ const Flash = (props) => {
}
})

return (
<div className="flash" ref={el} />
)
return <div className="flash" ref={el} />
}

export default Flash
2 changes: 1 addition & 1 deletion assets/scripts/app/StreetView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class StreetView extends React.Component {
)

if (marginUpdated) {
this.setState({ resizeType: resizeType })
this.setState({ resizeType })
}
}

Expand Down
4 changes: 2 additions & 2 deletions assets/scripts/app/StreetViewDirt.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ function getDirtElementHeight () {

const StreetViewDirt = ({ buildingWidth }) => {
const dirtStyle = {
marginLeft: (-buildingWidth) + 'px',
marginRight: (-buildingWidth) + 'px',
marginLeft: -buildingWidth + 'px',
marginRight: -buildingWidth + 'px',
height: getDirtElementHeight() + 'px'
}
const width = `${buildingWidth}px`
Expand Down
6 changes: 2 additions & 4 deletions assets/scripts/app/WelcomePanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ const LOCAL_STORAGE_RETURNING_USER = 'settings-welcome-dismissed'

function WelcomePanel (props) {
const { readOnly, everythingLoaded } = useSelector((state) => state.app)
const {
welcomePanelVisible: isVisible,
welcomePanelDismissed: isDismissed
} = useSelector((state) => state.ui)
const { welcomePanelVisible: isVisible, welcomePanelDismissed: isDismissed } =
useSelector((state) => state.ui)
const dispatch = useDispatch()
const [welcomeType, setWelcomeType] = useState(WELCOME_NONE)
const [isReturningUser, setIsReturningUser] = useState(
Expand Down
9 changes: 5 additions & 4 deletions assets/scripts/app/__mocks__/load_resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ const loadImages = (id) => {
const width = 96
const height = 96
const viewBox = '0 0 96 96'
const symbolHTML = '<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 96" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" id="image-markings--straight-inbound"><path d="M53.538 53.253V19.865H42.862v33.388H31.7l16.5 23.682 16.5-23.682H53.538z" fill="#fff" fill-rule="nonzero"/></symbol></svg>'
const symbolHTML =
'<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 96" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" id="image-markings--straight-inbound"><path d="M53.538 53.253V19.865H42.862v33.388H31.7l16.5 23.682 16.5-23.682H53.538z" fill="#fff" fill-rule="nonzero"/></symbol></svg>'
const svgHTML = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="${viewBox}" width="${width}" height="${height}">${symbolHTML}</svg>`
const src = 'data:image/svg+xml;base64,' + window.btoa(svgHTML)

const img = new window.Image()
img.src = src
images.set(id, {
img: img,
width: width,
height: height
img,
width,
height
})
}
loadImages('markings--straight-inbound')
Expand Down
2 changes: 1 addition & 1 deletion assets/scripts/app/__tests__/BlockingError.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ERRORS } from '../errors'
function getInitialState (errorType) {
return {
errors: {
errorType: errorType
errorType
},
street: {
creatorId: 'foo'
Expand Down
3 changes: 1 addition & 2 deletions assets/scripts/app/__tests__/NotificationBar.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import NotificationBar from '../NotificationBar'
const TEST_NOTIFICATION = {
display: true,
lede: 'Heads up!',
text:
'Streetmix will be offline for maintainance on January 1, 2025 at 19:00 GMT.',
text: 'Streetmix will be offline for maintainance on January 1, 2025 at 19:00 GMT.',
link: 'https://twitter.com/streetmix/',
linkText: 'Follow us on Twitter for updates.'
}
Expand Down
7 changes: 1 addition & 6 deletions assets/scripts/app/__tests__/StreetEditable.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,7 @@ describe('StreetEditable', () => {
describe('too large', () => {
it('Pressing `+` does not increase the width of the segment', async () => {
const street = { width: 400, segments: [segment] }
const {
getByTestId,
store,
container,
asFragment
} = render(
const { getByTestId, store, container, asFragment } = render(
<StreetEditable
setBuildingWidth={setBuildingWidth}
updatePerspective={updatePerspective}
Expand Down
10 changes: 8 additions & 2 deletions assets/scripts/app/blocking_shield.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
export function showBlockingShield (mode = 'load') {
window.dispatchEvent(new window.CustomEvent('stmx:show_blocking_shield', { detail: { mode } }))
window.dispatchEvent(
new window.CustomEvent('stmx:show_blocking_shield', { detail: { mode } })
)
}

export function darkenBlockingShield (showCancel = false) {
window.dispatchEvent(new window.CustomEvent('stmx:darken_blocking_shield', { detail: { showCancel: !!showCancel } }))
window.dispatchEvent(
new window.CustomEvent('stmx:darken_blocking_shield', {
detail: { showCancel: !!showCancel }
})
)
}

export function hideBlockingShield () {
Expand Down
4 changes: 2 additions & 2 deletions assets/scripts/app/load_resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ function cacheSVGObject (id, svg, svgHTML) {
// Store properties on svg cache, using its simplified id as the key
images.set(id, {
el: svg,
src: src,
img: img,
src,
img,
width: svg.viewBox.baseVal.width,
height: svg.viewBox.baseVal.height
})
Expand Down
Loading

0 comments on commit 741e73b

Please sign in to comment.