Skip to content

Commit

Permalink
Merge pull request #6279 from Expensify/marcaaron-standardizeImports
Browse files Browse the repository at this point in the history
Standardize imports
  • Loading branch information
marcaaron authored Nov 24, 2021
2 parents 654740a + 5baa0be commit 2b7d6d0
Show file tree
Hide file tree
Showing 172 changed files with 1,616 additions and 1,774 deletions.
28 changes: 14 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
"electron-notarize": "^1.0.0",
"electron-reloader": "^1.2.0",
"eslint": "^7.6.0",
"eslint-config-expensify": "^2.0.18",
"eslint-config-expensify": "2.0.19",
"eslint-loader": "^4.0.2",
"eslint-plugin-detox": "^1.0.0",
"eslint-plugin-jest": "^24.1.0",
Expand Down
12 changes: 6 additions & 6 deletions src/CONFIG.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import lodashGet from 'lodash/get';
import {Platform} from 'react-native';
import Config from 'react-native-config';
import getPlatform from './libs/getPlatform/index';
import {addTrailingForwardSlash} from './libs/Url';
import * as Url from './libs/Url';
import CONST from './CONST';

// Set default values to contributor friendly values to make development work out of the box without an .env file
const ENVIRONMENT = lodashGet(Config, 'ENVIRONMENT', CONST.ENVIRONMENT.DEV);
const expensifyCashURL = addTrailingForwardSlash(lodashGet(Config, 'EXPENSIFY_URL_CASH', 'https://new.expensify.com/'));
const expensifyURL = addTrailingForwardSlash(lodashGet(Config, 'EXPENSIFY_URL_COM', 'https://www.expensify.com/'));
const ngrokURL = addTrailingForwardSlash(lodashGet(Config, 'NGROK_URL', ''));
const secureNgrokURL = addTrailingForwardSlash(lodashGet(Config, 'SECURE_NGROK_URL', ''));
const expensifyURLSecure = addTrailingForwardSlash(lodashGet(
const expensifyCashURL = Url.addTrailingForwardSlash(lodashGet(Config, 'EXPENSIFY_URL_CASH', 'https://new.expensify.com/'));
const expensifyURL = Url.addTrailingForwardSlash(lodashGet(Config, 'EXPENSIFY_URL_COM', 'https://www.expensify.com/'));
const ngrokURL = Url.addTrailingForwardSlash(lodashGet(Config, 'NGROK_URL', ''));
const secureNgrokURL = Url.addTrailingForwardSlash(lodashGet(Config, 'SECURE_NGROK_URL', ''));
const expensifyURLSecure = Url.addTrailingForwardSlash(lodashGet(
Config, 'EXPENSIFY_URL_SECURE', 'https://secure.expensify.com/',
));
const useNgrok = lodashGet(Config, 'USE_NGROK', 'false') === 'true';
Expand Down
40 changes: 19 additions & 21 deletions src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,27 +509,25 @@ const CONST = {
PREFIX: '__predefined_',
SELF_SELECT: '__predefined_selfSelect',
},
get EXPENSIFY_EMAILS() {
return [
this.EMAIL.CONCIERGE,
this.EMAIL.HELP,
this.EMAIL.RECEIPTS,
this.EMAIL.CHRONOS,
this.EMAIL.QA,
this.EMAIL.CONTRIBUTORS,
this.EMAIL.FIRST_RESPONDER,
this.EMAIL.QA_TRAVIS,
this.EMAIL.BILLS,
this.EMAIL.STUDENT_AMBASSADOR,
this.EMAIL.ACCOUNTING,
this.EMAIL.PAYROLL,
this.EMAIL.SVFG,
this.EMAIL.INTEGRATION_TESTING_CREDS,
this.EMAIL.ADMIN,
];
},
};

const EXPENSIFY_EMAILS = [
CONST.EMAIL.CONCIERGE,
CONST.EMAIL.HELP,
CONST.EMAIL.RECEIPTS,
CONST.EMAIL.CHRONOS,
CONST.EMAIL.QA,
CONST.EMAIL.CONTRIBUTORS,
CONST.EMAIL.FIRST_RESPONDER,
CONST.EMAIL.QA_TRAVIS,
CONST.EMAIL.BILLS,
CONST.EMAIL.STUDENT_AMBASSADOR,
CONST.EMAIL.ACCOUNTING,
CONST.EMAIL.PAYROLL,
CONST.EMAIL.SVFG,
CONST.EMAIL.INTEGRATION_TESTING_CREDS,
CONST.EMAIL.ADMIN,
];

export {
EXPENSIFY_EMAILS,
};
export default CONST;
4 changes: 2 additions & 2 deletions src/Expensify.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import PushNotification from './libs/Notification/PushNotification';
import UpdateAppModal from './components/UpdateAppModal';
import Visibility from './libs/Visibility';
import GrowlNotification from './components/GrowlNotification';
import {growlRef} from './libs/Growl';
import * as Growl from './libs/Growl';
import StartupTimer from './libs/StartupTimer';
import Log from './libs/Log';

Expand Down Expand Up @@ -144,7 +144,7 @@ class Expensify extends PureComponent {
}
return (
<>
<GrowlNotification ref={growlRef} />
<GrowlNotification ref={Growl.growlRef} />
{/* We include the modal for showing a new update at the top level so the option is always present. */}
{this.props.updateAvailable ? <UpdateAppModal /> : null}
<NavigationRoot authenticated={Boolean(this.getAuthToken())} />
Expand Down
4 changes: 2 additions & 2 deletions src/ROUTES.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import lodashGet from 'lodash/get';
import {addTrailingForwardSlash} from './libs/Url';
import * as Url from './libs/Url';

/**
* This is a file containing constants for all of the routes we want to be able to go to
Expand Down Expand Up @@ -102,7 +102,7 @@ export default {
* @returns {Object}
*/
parseReportRouteParams: (route) => {
if (!route.startsWith(addTrailingForwardSlash(REPORT))) {
if (!route.startsWith(Url.addTrailingForwardSlash(REPORT))) {
return {};
}

Expand Down
18 changes: 6 additions & 12 deletions src/components/AddPlaidBankAccount.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@ import lodashGet from 'lodash/get';
import {withOnyx} from 'react-native-onyx';
import Log from '../libs/Log';
import PlaidLink from './PlaidLink';
import {
clearPlaidBankAccountsAndToken,
fetchPlaidLinkToken,
getPlaidBankAccounts,
setBankAccountFormValidationErrors,
showBankAccountErrorModal,
} from '../libs/actions/BankAccounts';
import * as BankAccounts from '../libs/actions/BankAccounts';
import ONYXKEYS from '../ONYXKEYS';
import styles from '../styles/styles';
import themeColors from '../styles/themes/default';
Expand Down Expand Up @@ -106,8 +100,8 @@ class AddPlaidBankAccount extends React.Component {
}

componentDidMount() {
clearPlaidBankAccountsAndToken();
fetchPlaidLinkToken();
BankAccounts.clearPlaidBankAccountsAndToken();
BankAccounts.fetchPlaidLinkToken();
}

/**
Expand All @@ -127,13 +121,13 @@ class AddPlaidBankAccount extends React.Component {
if (_.isUndefined(this.state.selectedIndex)) {
errors.selectedBank = true;
}
setBankAccountFormValidationErrors(errors);
BankAccounts.setBankAccountFormValidationErrors(errors);
return _.size(errors) === 0;
}

selectAccount() {
if (!this.validate()) {
showBankAccountErrorModal();
BankAccounts.showBankAccountErrorModal();
return;
}

Expand Down Expand Up @@ -165,7 +159,7 @@ class AddPlaidBankAccount extends React.Component {
token={this.props.plaidLinkToken}
onSuccess={({publicToken, metadata}) => {
Log.info('[PlaidLink] Success!');
getPlaidBankAccounts(publicToken, metadata.institution.name);
BankAccounts.getPlaidBankAccounts(publicToken, metadata.institution.name);
this.setState({institution: metadata.institution});
}}
onError={(error) => {
Expand Down
16 changes: 8 additions & 8 deletions src/components/AddressSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import withLocalize, {withLocalizePropTypes} from './withLocalize';
import styles from '../styles/styles';
import ExpensiTextInput from './ExpensiTextInput';
import Log from '../libs/Log';
import {getAddressComponent, isAddressValidForVBA} from '../libs/GooglePlacesUtils';
import * as GooglePlacesUtils from '../libs/GooglePlacesUtils';

// The error that's being thrown below will be ignored until we fork the
// react-native-google-places-autocomplete repo and replace the
Expand Down Expand Up @@ -51,17 +51,17 @@ const AddressSearch = (props) => {

const saveLocationDetails = (details) => {
const addressComponents = details.address_components;
if (isAddressValidForVBA(addressComponents)) {
if (GooglePlacesUtils.isAddressValidForVBA(addressComponents)) {
// Gather the values from the Google details
const streetNumber = getAddressComponent(addressComponents, 'street_number', 'long_name');
const streetName = getAddressComponent(addressComponents, 'route', 'long_name');
let city = getAddressComponent(addressComponents, 'locality', 'long_name');
const streetNumber = GooglePlacesUtils.getAddressComponent(addressComponents, 'street_number', 'long_name');
const streetName = GooglePlacesUtils.getAddressComponent(addressComponents, 'route', 'long_name');
let city = GooglePlacesUtils.getAddressComponent(addressComponents, 'locality', 'long_name');
if (!city) {
city = getAddressComponent(addressComponents, 'sublocality', 'long_name');
city = GooglePlacesUtils.getAddressComponent(addressComponents, 'sublocality', 'long_name');
Log.hmmm('[AddressSearch] Replacing missing locality with sublocality: ', {address: details.formatted_address, sublocality: city});
}
const state = getAddressComponent(addressComponents, 'administrative_area_level_1', 'short_name');
const zipCode = getAddressComponent(addressComponents, 'postal_code', 'long_name');
const state = GooglePlacesUtils.getAddressComponent(addressComponents, 'administrative_area_level_1', 'short_name');
const zipCode = GooglePlacesUtils.getAddressComponent(addressComponents, 'postal_code', 'long_name');

// Trigger text change events for each of the individual fields being saved on the server
props.onChangeText('addressStreet', `${streetNumber} ${streetName}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import lodashGet from 'lodash/get';
import Text from '../../Text';
import {propTypes, defaultProps} from '../anchorForCommentsOnlyPropTypes';
import PressableWithSecondaryInteraction from '../../PressableWithSecondaryInteraction';
import {showContextMenu} from '../../../pages/home/report/ContextMenu/ReportActionContextMenu';
import {CONTEXT_MENU_TYPES} from '../../../pages/home/report/ContextMenu/ContextMenuActions';
import * as ReportActionContextMenu from '../../../pages/home/report/ContextMenu/ReportActionContextMenu';
import * as ContextMenuActions from '../../../pages/home/report/ContextMenu/ContextMenuActions';
import AttachmentView from '../../AttachmentView';
import fileDownload from '../../../libs/fileDownload';

Expand Down Expand Up @@ -34,8 +34,8 @@ const BaseAnchorForCommentsOnly = (props) => {
<PressableWithSecondaryInteraction
onSecondaryInteraction={
(event) => {
showContextMenu(
CONTEXT_MENU_TYPES.LINK,
ReportActionContextMenu.showContextMenu(
ContextMenuActions.CONTEXT_MENU_TYPES.LINK,
event,
props.href,
lodashGet(linkRef, 'current'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {propTypes, defaultProps} from '../anchorForCommentsOnlyPropTypes';
import fileDownload from '../../../libs/fileDownload';
import Text from '../../Text';
import PressableWithSecondaryInteraction from '../../PressableWithSecondaryInteraction';
import {showContextMenu} from '../../../pages/home/report/ContextMenu/ReportActionContextMenu';
import {CONTEXT_MENU_TYPES} from '../../../pages/home/report/ContextMenu/ContextMenuActions';
import * as ReportActionContextMenu from '../../../pages/home/report/ContextMenu/ReportActionContextMenu';
import * as ContextMenuActions from '../../../pages/home/report/ContextMenu/ContextMenuActions';
import AttachmentView from '../../AttachmentView';
import styles from '../../../styles/styles';

Expand Down Expand Up @@ -37,8 +37,8 @@ const BaseAnchorForCommentsOnly = (props) => {
<PressableWithSecondaryInteraction
onSecondaryInteraction={
(event) => {
showContextMenu(
CONTEXT_MENU_TYPES.LINK,
ReportActionContextMenu.showContextMenu(
ContextMenuActions.CONTEXT_MENU_TYPES.LINK,
event,
props.href,
lodashGet(linkRef, 'current'),
Expand Down
6 changes: 3 additions & 3 deletions src/components/AttachmentPicker/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import CONST from '../../CONST';
import * as attachmentPickerPropTypes from './attachmentPickerPropTypes';
import {propTypes, defaultProps} from './attachmentPickerPropTypes';

/**
* Returns acceptable FileTypes based on ATTACHMENT_PICKER_TYPE
Expand Down Expand Up @@ -54,6 +54,6 @@ class AttachmentPicker extends React.Component {
}
}

AttachmentPicker.propTypes = attachmentPickerPropTypes.propTypes;
AttachmentPicker.defaultProps = attachmentPickerPropTypes.defaultProps;
AttachmentPicker.propTypes = propTypes;
AttachmentPicker.defaultProps = defaultProps;
export default AttachmentPicker;
8 changes: 4 additions & 4 deletions src/components/AttachmentPicker/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {propTypes as basePropTypes, defaultProps} from './attachmentPickerPropTy
import styles from '../../styles/styles';
import Popover from '../Popover';
import MenuItem from '../MenuItem';
import {Camera, Gallery, Paperclip} from '../Icon/Expensicons';
import * as Expensicons from '../Icon/Expensicons';
import withWindowDimensions, {windowDimensionsPropTypes} from '../withWindowDimensions';
import withLocalize, {withLocalizePropTypes} from '../withLocalize';
import compose from '../../libs/compose';
Expand Down Expand Up @@ -86,12 +86,12 @@ class AttachmentPicker extends Component {

this.menuItemData = [
{
icon: Camera,
icon: Expensicons.Camera,
textTranslationKey: 'attachmentPicker.takePhoto',
pickAttachment: () => this.showImagePicker(launchCamera),
},
{
icon: Gallery,
icon: Expensicons.Gallery,
textTranslationKey: 'attachmentPicker.chooseFromGallery',
pickAttachment: () => this.showImagePicker(launchImageLibrary),
},
Expand All @@ -102,7 +102,7 @@ class AttachmentPicker extends Component {
if (this.props.type !== CONST.ATTACHMENT_PICKER_TYPE.IMAGE) {
this.menuItemData.push(
{
icon: Paperclip,
icon: Expensicons.Paperclip,
textTranslationKey: 'attachmentPicker.chooseDocument',
pickAttachment: () => this.showDocumentPicker(),
},
Expand Down
6 changes: 3 additions & 3 deletions src/components/AttachmentView.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import styles from '../styles/styles';
import PDFView from './PDFView';
import ImageView from './ImageView';
import Icon from './Icon';
import {Paperclip, Download} from './Icon/Expensicons';
import * as Expensicons from './Icon/Expensicons';
import withLocalize, {withLocalizePropTypes} from './withLocalize';
import compose from '../libs/compose';
import Text from './Text';
Expand Down Expand Up @@ -60,13 +60,13 @@ const AttachmentView = (props) => {
style={styles.defaultAttachmentView}
>
<View style={styles.mr2}>
<Icon src={Paperclip} />
<Icon src={Expensicons.Paperclip} />
</View>
<Text style={[styles.textStrong, styles.flexShrink1]}>{props.file && props.file.name}</Text>
{props.shouldShowDownloadIcon && (
<View style={styles.ml2}>
<Tooltip text={props.translate('common.download')}>
<Icon src={Download} />
<Icon src={Expensicons.Download} />
</Tooltip>
</View>
)}
Expand Down
Loading

0 comments on commit 2b7d6d0

Please sign in to comment.