diff --git a/app.json b/app.json index e97aa74fdf..16e4f556fd 100644 --- a/app.json +++ b/app.json @@ -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": [ diff --git a/app/controllers/auth0_sign_in_callback.js b/app/controllers/auth0_sign_in_callback.js index c3a061a55a..bfa469b150 100644 --- a/app/controllers/auth0_sign_in_callback.js +++ b/app/controllers/auth0_sign_in_callback.js @@ -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 } diff --git a/app/db/migrations/20210506170155-update-user-profile-url.js b/app/db/migrations/20210506170155-update-user-profile-url.js index 558910063a..ab93d6d7f4 100644 --- a/app/db/migrations/20210506170155-update-user-profile-url.js +++ b/app/db/migrations/20210506170155-update-user-profile-url.js @@ -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 } + ) ]) }) } diff --git a/app/resources/services/images.js b/app/resources/services/images.js index 08187550e1..b0bc7035c8 100644 --- a/app/resources/services/images.js +++ b/app/resources/services/images.js @@ -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 } diff --git a/app/resources/services/integrations/coil.js b/app/resources/services/integrations/coil.js index 15ac8a8f7c..2f19a2fb5a 100644 --- a/app/resources/services/integrations/coil.js +++ b/app/resources/services/integrations/coil.js @@ -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 } ) @@ -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 diff --git a/app/resources/services/integrations/helpers.js b/app/resources/services/integrations/helpers.js index 6ff0e9347a..5a801d2feb 100644 --- a/app/resources/services/integrations/helpers.js +++ b/app/resources/services/integrations/helpers.js @@ -74,7 +74,7 @@ function addUserConnection (account, profile) { // be removed. await User.update( { - identities: identities + identities }, { where: { auth0Id: account.auth0Id }, returning: true, transaction: t } ) diff --git a/app/resources/v1/__tests__/flags.test.js b/app/resources/v1/__tests__/flags.test.js index b727e16185..d8745a604b 100644 --- a/app/resources/v1/__tests__/flags.test.js +++ b/app/resources/v1/__tests__/flags.test.js @@ -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') }) }) diff --git a/app/resources/v1/__tests__/translate.test.js b/app/resources/v1/__tests__/translate.test.js index ce4a35e72e..398cc9812c 100644 --- a/app/resources/v1/__tests__/translate.test.js +++ b/app/resources/v1/__tests__/translate.test.js @@ -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.' + ) }) }) diff --git a/app/resources/v1/geo.js b/app/resources/v1/geo.js index 32f26bd0b9..b063b5b42e 100644 --- a/app/resources/v1/geo.js +++ b/app/resources/v1/geo.js @@ -32,7 +32,7 @@ exports.get = async function (req, res) { type: 'Feature', geometry: { type: 'Point', - coordinates: coordinates + coordinates }, properties: result } diff --git a/app/resources/v1/street_images.js b/app/resources/v1/street_images.js index fe23d4c6b8..dd3fbe8560 100644 --- a/app/resources/v1/street_images.js +++ b/app/resources/v1/street_images.js @@ -53,7 +53,7 @@ exports.post = async function (req, res) { const details = { public_id: publicId, street_type: streetType, - creatorId: creatorId, + creatorId, edit_count: editCount } diff --git a/app/resources/v1/streets.js b/app/resources/v1/streets.js index 3882d25cc0..c7bc3e9264 100644 --- a/app/resources/v1/streets.js +++ b/app/resources/v1/streets.js @@ -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 } }) } @@ -376,7 +376,7 @@ exports.find = async function (req, res) { self: selfUri } }, - streets: streets + streets } if (start > 0) { diff --git a/app/resources/v1/users.js b/app/resources/v1/users.js index 84df343e0e..2814cc5911 100644 --- a/app/resources/v1/users.js +++ b/app/resources/v1/users.js @@ -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 diff --git a/app/resources/v1/users_streets.js b/app/resources/v1/users_streets.js index 201e4faa9f..0da0c3659c 100644 --- a/app/resources/v1/users_streets.js +++ b/app/resources/v1/users_streets.js @@ -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 diff --git a/app/resources/v1/votes.js b/app/resources/v1/votes.js index 7c3b27b3fb..12d9ad95ee 100644 --- a/app/resources/v1/votes.js +++ b/app/resources/v1/votes.js @@ -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) { @@ -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) } diff --git a/assets/scripts/app/DateTimeRelative.jsx b/assets/scripts/app/DateTimeRelative.jsx index 76fc7c9c82..f10ec4747b 100644 --- a/assets/scripts/app/DateTimeRelative.jsx +++ b/assets/scripts/app/DateTimeRelative.jsx @@ -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() ) } @@ -28,7 +28,10 @@ export default function DateTimeRelative (props) { if (diff < SECONDS_AGO) { return ( ) } @@ -36,7 +39,10 @@ export default function DateTimeRelative (props) { if (diff < MINUTES_AGO) { return ( ) } @@ -90,11 +96,7 @@ export default function DateTimeRelative (props) { if (now.getFullYear() === date.getFullYear()) { return ( ) } @@ -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] + + '`' ) } }, diff --git a/assets/scripts/app/Flash.jsx b/assets/scripts/app/Flash.jsx index 2283317147..a34ed202e7 100644 --- a/assets/scripts/app/Flash.jsx +++ b/assets/scripts/app/Flash.jsx @@ -38,9 +38,7 @@ const Flash = (props) => { } }) - return ( -
- ) + return } export default Flash diff --git a/assets/scripts/app/StreetView.jsx b/assets/scripts/app/StreetView.jsx index 2e5627582f..7647feb742 100644 --- a/assets/scripts/app/StreetView.jsx +++ b/assets/scripts/app/StreetView.jsx @@ -124,7 +124,7 @@ class StreetView extends React.Component { ) if (marginUpdated) { - this.setState({ resizeType: resizeType }) + this.setState({ resizeType }) } } diff --git a/assets/scripts/app/StreetViewDirt.jsx b/assets/scripts/app/StreetViewDirt.jsx index 7d8c6e8b92..25b6bbc721 100644 --- a/assets/scripts/app/StreetViewDirt.jsx +++ b/assets/scripts/app/StreetViewDirt.jsx @@ -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` diff --git a/assets/scripts/app/WelcomePanel.jsx b/assets/scripts/app/WelcomePanel.jsx index 4920834047..81f3d0aaf1 100644 --- a/assets/scripts/app/WelcomePanel.jsx +++ b/assets/scripts/app/WelcomePanel.jsx @@ -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( diff --git a/assets/scripts/app/__mocks__/load_resources.js b/assets/scripts/app/__mocks__/load_resources.js index 21b2c0bab4..3e0a9a4d23 100644 --- a/assets/scripts/app/__mocks__/load_resources.js +++ b/assets/scripts/app/__mocks__/load_resources.js @@ -6,16 +6,17 @@ const loadImages = (id) => { const width = 96 const height = 96 const viewBox = '0 0 96 96' - const symbolHTML = '
-
{message}
))} + {messages.map((message) => ( +{message}
+ ))}