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

FIXES: fix lint issues Fixes: #1106

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
15 changes: 14 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,24 @@
"xdescribe": false,
"xit": false
},
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"settings": {
"react": {
"version": "detect" // Automatically detect the React version
}
},
"rules": {
"no-mixed-operators": 0,
"import/first": 0,
"prefer-promise-reject-errors": 0,
"react/prop-types": 0,
"react/jsx-no-bind": 0
"react/jsx-no-bind": 0,
"react/jsx-indent-props": ["error", 2] // Enforce 2-space indentation for JSX props
}
}
4 changes: 2 additions & 2 deletions config/passport.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,8 @@ passport.use(
return done(null, false)
}
catch (err) {
console.log('err', err)
return done(err)
// console.log('err', err)
// return done(err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're commenting here a line that can affect the tests besides the console, please don't do so.

You can remove the console and keep the line with the return

};
})
)
Expand Down
4 changes: 2 additions & 2 deletions cron.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ const dailyJob = new CronJob({
// Seconds: 0-59 Minutes: 0-59 Hours: 0-23 Day of Month: 1-31 Months: 0-11 (Jan-Dec) Day of Week: 0-6 (Sun-Sat)
cronTime: '0 0 0 * * *', // everyday at 12:00AM
onTick: () => {
//TaskCron.rememberDeadline()
//OrderCron.verify()
// TaskCron.rememberDeadline()
// OrderCron.verify()
OrderCron.checkExpiredPaypalOrders()
}
})
Expand Down
36 changes: 18 additions & 18 deletions cron/orderCron.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ const OrderCron = {
},
checkExpiredPaypalOrders: async () => {
const orders = await models.Order.findAll({ where: {
status: {
[Op.eq]: 'succeeded'
},
provider: {
[Op.eq]: 'paypal'
},
paid: {
[Op.eq]: true
}
status: {
[Op.eq]: 'succeeded'
},
provider: {
[Op.eq]: 'paypal'
},
include: [ models.User, models.Task ]
paid: {
[Op.eq]: true
}
},
include: [ models.User, models.Task ]
})
if (orders[0]) {
try {
Expand Down Expand Up @@ -81,27 +81,27 @@ const OrderCron = {
}).then(result => {
return JSON.parse(result)
}).catch(e => {
console.log('error on order details', e.error)
// console.log('error on order details', e.error)
return JSON.parse(e.error)
})
const orderDetailsResult = await orderDetails()
if(orderDetailsResult["name"] === 'RESOURCE_NOT_FOUND') {
const orderDetailsResult = await orderDetails()
if (orderDetailsResult['name'] === 'RESOURCE_NOT_FOUND') {
return models.Order.update({ status: 'expired', paid: false }, { where: { id: o.dataValues.id } }).then(orderUpdated => {
if(orderUpdated[0] === 1) {
if (orderUpdated[0] === 1) {
orderMail.expiredOrders(order)
return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you removed a return statement needed here

}
})
}
}
}
})
} catch (e) {
console.log('error', e)
}
catch (e) {
// console.log('error', e)
}
}
return orders
}
}

module.exports = OrderCron
module.exports = OrderCron
1 change: 0 additions & 1 deletion frontend/src/actions/orderActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ const updateOrderError = error => {
return { type: UPDATE_ORDER_ERROR, completed: true, error: error }
}


/*
* Order pay
*/
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/components/notification/notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
import Close from '@material-ui/icons/Close'

class Notification extends Component {

getActions = () => {
let actions = [
<IconButton
Expand All @@ -21,10 +20,10 @@ class Notification extends Component {
<Close />
</IconButton>
]
if(this.props.link) {
if (this.props.link) {
actions = [this.getLink(), actions]
}

return actions
}

Expand Down
102 changes: 51 additions & 51 deletions frontend/src/components/profile/country-codes.js
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
export const countryCodes = [
{ country: 'Australia', code: 'AU', image: 'australia' },
{ country: 'Austria', code: 'AT', image: 'austria' },
{ country: 'Belgium', code: 'BE', image: 'belgium' },
{ country: 'Brazil ', code: 'BR', image: 'brazil' },
{ country: 'Bulgaria', code: 'BG', image: 'bulgaria' },
{ country: 'Canada', code: 'CA', image: 'canada' },
{ country: 'Croatia', code: 'HR', image: 'croatia' },
{ country: 'Cyprus', code: 'CY', image: 'cyprus' },
{ country: 'Czech Republic', code: 'CZ', image: 'czech-republic' },
{ country: 'Denmark', code: 'DK', image: 'denmark' },
{ country: 'Estonia', code: 'EE', image: 'estonia' },
{ country: 'Finland', code: 'FI', image: 'finland' },
{ country: 'France', code: 'FR', image: 'france' },
{ country: 'Germany', code: 'DE', image: 'germany' },
{ country: 'Ghana', code: 'GH', image: 'ghana'},
{ country: 'Gibraltar', code: 'GI', image: 'gibraltar' },
{ country: 'Greece', code: 'GR', image: 'greece' },
{ country: 'Hong Kong', code: 'HK', image: 'hong-kong' },
{ country: 'Hungary', code: 'HU', image: 'hungary' },
{ country: 'India', code: 'IN', image: 'india'},
//{ country: 'Indonesia', code: 'ID', image: 'indonesia'}, invite only
{ country: 'Ireland', code: 'IE', image: 'ireland' },
{ country: 'Italy', code: 'IT', image: 'italy' },
{ country: 'Japan', code: 'JP', image: 'japan' },
{ country: 'Kenya', code: 'KE', image: 'kenya' },
{ country: 'Latvia', code: 'LV', image: 'latvia' },
{ country: 'Liechtenstein', code: 'LI', image: 'liechtenstein'},
{ country: 'Lithuania', code: 'LT', image: 'lithuania' },
{ country: 'Luxembourg', code: 'LU', image: 'luxembourg' },
{ country: 'Malaysia', code: 'MY', image: 'malaysia' },
{ country: 'Malta', code: 'MT', image: 'malta' },
{ country: 'Mexico ', code: 'MX', image: 'mexico' },
{ country: 'Netherlands', code: 'NL', image: 'netherlands' },
{ country: 'New Zealand', code: 'NZ', image: 'new-zealand' },
{ country: 'Nigeria', code: 'NG', image: 'nigeria' },
{ country: 'Norway', code: 'NO', image: 'norway' },
{ country: 'Poland', code: 'PL', image: 'poland'},
{ country: 'Portugal', code: 'PT', image: 'portugal' },
{ country: 'Romania', code: 'RO', image: 'romania' },
{ country: 'Singapore', code: 'SG', image: 'singapore' },
{ country: 'Slovakia', code: 'SK', image: 'slovakia' },
{ country: 'Slovenia', code: 'SI', image: 'slovenia' },
{ country: 'South Africa', code: 'ZA', image: 'south-africa' },
{ country: 'Spain', code: 'ES', image: 'spain' },
{ country: 'Sweden', code: 'SE', image: 'sweden' },
{ country: 'Switzerland', code: 'CH', image: 'switzerland' },
{ country: 'Thailand', code: 'TH', image: 'thailand' },
{ country: 'United Arab Emirates', code: 'AE', image: 'united-arab-emirates'},
{ country: 'United Kingdom', code: 'GB', image: 'united-kingdom' },
{ country: 'United States', code: 'US', image: 'united-states-of-america' }
]
{ country: 'Australia', code: 'AU', image: 'australia' },
{ country: 'Austria', code: 'AT', image: 'austria' },
{ country: 'Belgium', code: 'BE', image: 'belgium' },
{ country: 'Brazil ', code: 'BR', image: 'brazil' },
{ country: 'Bulgaria', code: 'BG', image: 'bulgaria' },
{ country: 'Canada', code: 'CA', image: 'canada' },
{ country: 'Croatia', code: 'HR', image: 'croatia' },
{ country: 'Cyprus', code: 'CY', image: 'cyprus' },
{ country: 'Czech Republic', code: 'CZ', image: 'czech-republic' },
{ country: 'Denmark', code: 'DK', image: 'denmark' },
{ country: 'Estonia', code: 'EE', image: 'estonia' },
{ country: 'Finland', code: 'FI', image: 'finland' },
{ country: 'France', code: 'FR', image: 'france' },
{ country: 'Germany', code: 'DE', image: 'germany' },
{ country: 'Ghana', code: 'GH', image: 'ghana' },
{ country: 'Gibraltar', code: 'GI', image: 'gibraltar' },
{ country: 'Greece', code: 'GR', image: 'greece' },
{ country: 'Hong Kong', code: 'HK', image: 'hong-kong' },
{ country: 'Hungary', code: 'HU', image: 'hungary' },
{ country: 'India', code: 'IN', image: 'india' },
// { country: 'Indonesia', code: 'ID', image: 'indonesia'}, invite only
{ country: 'Ireland', code: 'IE', image: 'ireland' },
{ country: 'Italy', code: 'IT', image: 'italy' },
{ country: 'Japan', code: 'JP', image: 'japan' },
{ country: 'Kenya', code: 'KE', image: 'kenya' },
{ country: 'Latvia', code: 'LV', image: 'latvia' },
{ country: 'Liechtenstein', code: 'LI', image: 'liechtenstein' },
{ country: 'Lithuania', code: 'LT', image: 'lithuania' },
{ country: 'Luxembourg', code: 'LU', image: 'luxembourg' },
{ country: 'Malaysia', code: 'MY', image: 'malaysia' },
{ country: 'Malta', code: 'MT', image: 'malta' },
{ country: 'Mexico ', code: 'MX', image: 'mexico' },
{ country: 'Netherlands', code: 'NL', image: 'netherlands' },
{ country: 'New Zealand', code: 'NZ', image: 'new-zealand' },
{ country: 'Nigeria', code: 'NG', image: 'nigeria' },
{ country: 'Norway', code: 'NO', image: 'norway' },
{ country: 'Poland', code: 'PL', image: 'poland' },
{ country: 'Portugal', code: 'PT', image: 'portugal' },
{ country: 'Romania', code: 'RO', image: 'romania' },
{ country: 'Singapore', code: 'SG', image: 'singapore' },
{ country: 'Slovakia', code: 'SK', image: 'slovakia' },
{ country: 'Slovenia', code: 'SI', image: 'slovenia' },
{ country: 'South Africa', code: 'ZA', image: 'south-africa' },
{ country: 'Spain', code: 'ES', image: 'spain' },
{ country: 'Sweden', code: 'SE', image: 'sweden' },
{ country: 'Switzerland', code: 'CH', image: 'switzerland' },
{ country: 'Thailand', code: 'TH', image: 'thailand' },
{ country: 'United Arab Emirates', code: 'AE', image: 'united-arab-emirates' },
{ country: 'United Kingdom', code: 'GB', image: 'united-kingdom' },
{ country: 'United States', code: 'US', image: 'united-states-of-america' }
]
4 changes: 2 additions & 2 deletions frontend/src/components/profile/country-picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ class CountryPicker extends Component {
const imageModule = require(`../../images/countries/${item.image}.png`)
const countryImageSrc = imageModule.default || imageModule
return (
<Button style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }} variant={ this.state.currentCountryCode === item.code ? 'outlined' : '' } onClick={ (e) => this.handleCountry(e, item) } className={ classes.countryItem }>
<img width='48' style={{marginRight: 10}} src={ countryImageSrc } onLoad={() => {}} />
<Button style={ { display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center' } } variant={ this.state.currentCountryCode === item.code ? 'outlined' : '' } onClick={ (e) => this.handleCountry(e, item) } className={ classes.countryItem }>
<img width='48' style={ { marginRight: 10 } } src={ countryImageSrc } onLoad={ () => {} } />
<Typography component='span' gutterBottom>
{ item.country }
</Typography>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/profile/payments.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const Payments = ({ classes, tasks, orders, order, user, logged, listOrders, get
const retryPaypalPayment = (e, item) => {
e.preventDefault()
const { payment_url: paymentUrl, status } = item
if(status === 'expired') {
if (status === 'expired') {
return updateOrder({ id: item.id }).then(order => {
if (order.order.payment_url) {
window.location.href = order.order.payment_url
Expand All @@ -137,7 +137,7 @@ const Payments = ({ classes, tasks, orders, order, user, logged, listOrders, get
*/

const retryPaypalPaymentButton = (item) => {
const { payment_url: paymentUrl } = item
// const { payment_url: paymentUrl } = item
return (
<Button style={ { marginTop: 10, paddingTop: 2, paddingBottom: 2, width: 'auto' } } variant='contained' size='small' color='primary' className={ classes.button } onClick={ (e) => {
retryPaypalPayment(e, item)
Expand Down
29 changes: 14 additions & 15 deletions frontend/src/components/profile/payouts.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from '@material-ui/core'
import CustomPaginationActionsTable from './payout-table'

//Define messages for internationalization
// Define messages for internationalization
const payoutMessages = defineMessages({
title: {
id: 'profile.payouts.title',
Expand All @@ -31,9 +31,9 @@ const payoutMessages = defineMessages({
id: 'profile.payouts.headerCreated',
defaultMessage: 'Created'
}
});
})

//Map for currency symbols
// Map for currency symbols
const currencyMap = {
usd: '$', // US Dollar
eur: '€', // Euro
Expand All @@ -49,25 +49,25 @@ const currencyMap = {
hkd: 'HK$', // Hong Kong Dollar
sgd: 'S$', // Singapore Dollar
krw: '₩', // South Korean Won
};
}

//Function to convert currency code to symbol
function currencyCodeToSymbol(code) {
return currencyMap[code.toLowerCase()] || code;
// Function to convert currency code to symbol
function currencyCodeToSymbol (code) {
return currencyMap[code.toLowerCase()] || code
}

//Function to format amount from cents to decimal format
function formatStripeAmount(amountInCents) {
// Function to format amount from cents to decimal format
function formatStripeAmount (amountInCents) {
// Convert to a number in case it's a string
let amount = Number(amountInCents);
let amount = Number(amountInCents)

// Check if the conversion result is a valid number
if (isNaN(amount)) {
return 'Invalid amount';
return 'Invalid amount'
}

// Convert cents to a decimal format and fix to 2 decimal places
return (amount / 100).toFixed(2);
return (amount / 100).toFixed(2)
}

const styles = theme => ({
Expand All @@ -85,7 +85,6 @@ const styles = theme => ({
})

const Payouts = ({ searchPayout, payouts, user, intl }) => {

useEffect(() => {
const getPayouts = async () => await searchPayout({ userId: user.user.id })
getPayouts().then(t => {})
Expand All @@ -95,7 +94,7 @@ const Payouts = ({ searchPayout, payouts, user, intl }) => {
<div style={ { margin: '40px 0' } }>
<Container>
<Typography variant='h5' gutterBottom>
<FormattedMessage {...payoutMessages.title} />
<FormattedMessage { ...payoutMessages.title } />
</Typography>
<div>
<CustomPaginationActionsTable
Expand All @@ -111,7 +110,7 @@ const Payouts = ({ searchPayout, payouts, user, intl }) => {
data: payouts.data.map(t => [
<Chip label={ t.status } />,
<Typography variant='body2'>
{t.method}
{ t.method }
</Typography>,
`${currencyCodeToSymbol(t.currency)} ${t.method === 'stripe' ? formatStripeAmount(t.amount) : t.amount}`,
moment(t.createdAt).format('LLL')
Expand Down
10 changes: 1 addition & 9 deletions frontend/src/components/profile/profile-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,19 @@ import { injectIntl, FormattedMessage } from 'react-intl'
import { Link } from 'react-router-dom'

import {
Avatar,
Typography,
Button,
CardActions,
CardContent,
withStyles,
Chip,
withStyles
} from '@material-ui/core'

import {
Alert, AlertTitle
} from '@material-ui/lab'

import {
Person
} from '@material-ui/icons'

import { Card, CardList, CardMedia } from './ProfileStyles'
import WelcomeUser from '../session/welcome-user'

const organizationIcon = require('../../images/icons/noun_project management_3063542.svg')
const toolsIcon = require('../../images/icons/noun_project management_3063515.svg')
const preferencesIcon = require('../../images/icons/noun_project management_3063532.svg')
const generalSettingsIcon = require('../../images/icons/noun_project management_3063521.svg')
Expand Down
Loading