Skip to content

Commit

Permalink
Switch to eslint-plugin-simple-import-sort
Browse files Browse the repository at this point in the history
  • Loading branch information
swansontec committed Nov 7, 2019
1 parent 2feb1ec commit e341805
Show file tree
Hide file tree
Showing 73 changed files with 141 additions and 317 deletions.
5 changes: 3 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"fetch": true
},
"parser": "babel-eslint",
"plugins": ["flowtype", "react-native", "react", "standard"],
"plugins": ["flowtype", "react-native", "react", "simple-import-sort", "standard"],
"rules": {
"camelcase": "warn",
"flowtype/generic-spacing": "off",
Expand All @@ -14,6 +14,7 @@
"no-var": "error",
"prefer-const": "error",
"react-native/no-inline-styles": 0,
"react-native/no-raw-text": ["error", { "skip": ["FormattedText", "T", "B"] }],
"react-native/no-unused-styles": 0,
"react-native/split-platform-components": 2,
"react/jsx-indent-props": ["error", 2],
Expand All @@ -23,7 +24,7 @@
"react/no-typos": "error",
"react/prop-types": 0,
"react/self-closing-comp": ["error", { "component": true }],
"react-native/no-raw-text": ["error", { "skip": ["FormattedText", "T", "B"] }]
"simple-import-sort/sort": "error"
},
"settings": {
"react": { "pragma": "React", "version": "16.8.0", "flowVersion": "0.66" }
Expand Down
13 changes: 2 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"flow": "flow",
"flow-coverage": "flow-coverage-report",
"flow:0": "flow; exit 0",
"format": "import-sort -l --write '*.js' 'src/**/*.js' 'test/**/*.js'; prettier-eslint --write '*.js' 'src/**/*.js' 'test/**/*.js'",
"format": "prettier-eslint --write '*.js' 'src/**/*.js' 'test/**/*.js'",
"postinstall": "sh ./postinstall.sh",
"ios:run": "react-native run-ios",
"lint": "eslint '*.js' 'src/**/*.js' 'test/**/*.js'",
Expand Down Expand Up @@ -60,7 +60,6 @@
"linters": {
"*.js": [
"eslint",
"import-sort --list-different",
"prettier-eslint --list-different"
]
}
Expand Down Expand Up @@ -190,14 +189,12 @@
"eslint-plugin-promise": "^3.6.0",
"eslint-plugin-react": "^7.3.0",
"eslint-plugin-react-native": "^3.0.1",
"eslint-plugin-simple-import-sort": ">=4.0.0",
"eslint-plugin-standard": "^3.0.1",
"express": "^4.16.2",
"flow-bin": "^0.75.0",
"flow-coverage-report": "^0.4.1",
"husky": "^1.3.1",
"import-sort-cli": "^5.0.0",
"import-sort-parser-babylon": "^5.0.0",
"import-sort-style-module": "^5.0.0",
"jest": "^24.9.0",
"jest-junit": "^9.0.0",
"jsonfile": "^4.0.0",
Expand Down Expand Up @@ -282,12 +279,6 @@
"json"
]
},
"importSort": {
".js, .es": {
"parser": "babylon",
"style": "module"
}
},
"jest-junit": {
"outputDirectory": "./coverage",
"outputName": "junit.xml"
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/passwordReminderReducer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

/* globals test describe expect */

import { MAX_NON_PASSWORD_DAYS_LIMIT, MAX_NON_PASSWORD_LOGINS_LIMIT, initialState, untranslatedReducer as uut } from '../reducers/PasswordReminderReducer.js'
import { MILLISECONDS_PER_DAY, daysBetween } from '../util/utils.js'
import { initialState, MAX_NON_PASSWORD_DAYS_LIMIT, MAX_NON_PASSWORD_LOGINS_LIMIT, untranslatedReducer as uut } from '../reducers/PasswordReminderReducer.js'
import { daysBetween, MILLISECONDS_PER_DAY } from '../util/utils.js'

const dummyAction: any = { type: 'DUMMY_ACTION_PLEASE_IGNORE' }

Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
/* globals describe test expect */

import {
MILLISECONDS_PER_DAY,
autoCorrectDate,
convertDisplayToNative,
convertNativeToDenomination,
Expand All @@ -23,6 +22,7 @@ import {
isTooFarBehind,
isValidInput,
mergeTokens,
MILLISECONDS_PER_DAY,
msToSeconds,
secondsToMs,
truncateDecimals
Expand Down
4 changes: 2 additions & 2 deletions src/actions/ScanActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ import {
EXCHANGE_SCENE,
EXCLAMATION,
FA_MONEY_ICON,
getSpecialCurrencyInfo,
ION_ICONS,
KEY_ICON,
MATERIAL_COMMUNITY,
MATERIAL_ICONS,
PLUGIN_LIST,
SEND_CONFIRMATION,
SHOPPING_CART,
getSpecialCurrencyInfo
SHOPPING_CART
} from '../constants/indexConstants.js'
import s from '../locales/strings.js'
import * as CORE_SELECTORS from '../modules/Core/selectors.js'
Expand Down
2 changes: 1 addition & 1 deletion src/actions/SettingsActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import * as SETTINGS_ACTIONS from '../modules/Settings/SettingsActions.js'
import { Icon } from '../modules/UI/components/Icon/Icon.ui.js'
import { convertCurrency } from '../modules/UI/selectors.js'
import { newSpendingLimits } from '../reducers/SpendingLimitsReducer.js'
import { THEME, colors } from '../theme/variables/airbitz.js'
import { colors, THEME } from '../theme/variables/airbitz.js'
import type { Dispatch, GetState, State } from '../types/reduxTypes.js'
import { disableOtp, keepOtp } from './OtpActions.js'

Expand Down
2 changes: 1 addition & 1 deletion src/actions/WalletOptionsActions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow

import { Icon, createInputModal, createSecureTextModal, createSimpleConfirmModal } from 'edge-components'
import { createInputModal, createSecureTextModal, createSimpleConfirmModal, Icon } from 'edge-components'
import React from 'react'
import { Actions } from 'react-native-router-flux'
import FAIcon from 'react-native-vector-icons/FontAwesome'
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/AddressTextWithBlockExplorerModal.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// @flow

import { createYesNoModal } from 'edge-components'
import React from 'react'
import type { Node } from 'react'
import React from 'react'
import { Alert, Linking, TouchableOpacity } from 'react-native'
import { sprintf } from 'sprintf-js'

Expand Down
2 changes: 1 addition & 1 deletion src/components/common/Airship.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow

import React, { Component, type ComponentType, type Node } from 'react'
import React, { type ComponentType, type Node, Component } from 'react'
import { StyleSheet, View } from 'react-native'

/**
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/AirshipDropdown.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow

import React, { Component, type Node } from 'react'
import React, { type Node, Component } from 'react'
import { Animated, Dimensions, StyleSheet, TouchableWithoutFeedback, View } from 'react-native'

import { THEME } from '../../theme/variables/airbitz.js'
Expand Down
4 changes: 2 additions & 2 deletions src/components/common/AirshipModal.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// @flow

import React, { Component, type Node } from 'react'
import React, { type Node, Component } from 'react'
import { Animated, BackHandler, Dimensions, StyleSheet, TouchableWithoutFeedback } from 'react-native'

import { THEME } from '../../theme/variables/airbitz.js'
import { scale } from '../../util/scaling.js'
import { type AirshipBallast } from './Airship.js'
import { KeyboardTracker } from './KeyboardTracker.js'
import { LayoutContext, type SafeAreaGap } from './LayoutContext.js'
import { type SafeAreaGap, LayoutContext } from './LayoutContext.js'

type Props = {
bridge: AirshipBallast,
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/FullScreenTransition.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow

import React, { Component } from 'react'
import type { Node } from 'react'
import React, { Component } from 'react'
import { Animated, View } from 'react-native'

import Gradient from '../../modules/UI/components/Gradient/Gradient.ui'
Expand Down
4 changes: 2 additions & 2 deletions src/components/common/KeyboardTracker.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow

import { type ChildrenArray, Component, type Node } from 'react'
import { Animated, Keyboard, type KeyboardEvent, Platform } from 'react-native'
import { type ChildrenArray, type Node, Component } from 'react'
import { type KeyboardEvent, Animated, Keyboard, Platform } from 'react-native'

type Props = {
children: (animation: Animated.Value, layout: number) => ChildrenArray<Node>,
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/LadderLayout.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow

import React, { Fragment, type Node } from 'react'
import React, { type Node, Fragment } from 'react'
import { Image, Text, View } from 'react-native'

type Props = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/LayoutContext.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow

import { type ChildrenArray, Component, type Node } from 'react'
import { type ChildrenArray, type Node, Component } from 'react'
import { Dimensions, Platform, StatusBar } from 'react-native'
// $FlowFixMe See https://github.com/react-native-community/react-native-safe-area-view/pull/77
import { getInset } from 'react-native-safe-area-view'
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/RadioRows.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow

import React, { Component } from 'react'
import type { Node } from 'react'
import React, { Component } from 'react'
import { View } from 'react-native'

export type Props = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/RowRadio.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow

import React, { Component } from 'react'
import type { Node } from 'react'
import React, { Component } from 'react'
import { TouchableOpacity, View } from 'react-native'
import IonIcon from 'react-native-vector-icons/Ionicons'

Expand Down
6 changes: 3 additions & 3 deletions src/components/common/SceneWrapper.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// @flow

import React, { Component, type Node } from 'react'
import React, { type Node, Component } from 'react'
import { Animated, StyleSheet, View } from 'react-native'

import { Gradient } from '../../modules/UI/components/Gradient/Gradient.ui.js'
import { THEME, getHeaderHeight } from '../../theme/variables/airbitz.js'
import { getHeaderHeight, THEME } from '../../theme/variables/airbitz.js'
import { KeyboardTracker } from './KeyboardTracker.js'
import { LayoutContext, type SafeAreaGap } from './LayoutContext.js'
import { type SafeAreaGap, LayoutContext } from './LayoutContext.js'

type BackgroundOptions =
| 'header' // Header area covers the screen (default)
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/SettingsRow.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow

import React, { Component } from 'react'
import type { Node } from 'react'
import React, { Component } from 'react'
import { TouchableHighlight, View } from 'react-native'
import IonIcon from 'react-native-vector-icons/Ionicons'

Expand Down
2 changes: 1 addition & 1 deletion src/components/modals/HelpModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { WebView } from 'react-native-webview'

import s from '../../locales/strings.js'
import { Airship } from '../services/AirshipInstance.js'
import { type AirshipBridge, AirshipModal, ContentArea, IconCircle, ModalCloseArrow, THEME, dayText, textSize } from './modalParts.js'
import { type AirshipBridge, AirshipModal, ContentArea, dayText, IconCircle, ModalCloseArrow, textSize, THEME } from './modalParts.js'

const buildNumber = DeviceInfo.getBuildNumber()
const versionNumber = DeviceInfo.getVersion()
Expand Down
2 changes: 1 addition & 1 deletion src/components/modals/SimpleConfirmationModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import React, { Component } from 'react'
import { Text } from 'react-native'
import EntypoIcon from 'react-native-vector-icons/Entypo'

import { type AirshipBridge, AirshipModal, ContentArea, IconCircle, THEME, dayText } from './modalParts.js'
import { type AirshipBridge, AirshipModal, ContentArea, dayText, IconCircle, THEME } from './modalParts.js'

type Props = {
bridge: AirshipBridge<void>,
Expand Down
2 changes: 1 addition & 1 deletion src/components/modals/SwapVerifyShapeshiftModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Image, Linking, Text } from 'react-native'
import { swapPluginIcons, swapPluginLogos } from '../../assets/images/exchange'
import s from '../../locales/strings'
import { PrimaryButton } from '../../modules/UI/components/Buttons/index'
import { type AirshipBridge, AirshipModal, ContentArea, IconCircle, ModalCloseArrow, THEME, dayText } from './modalParts.js'
import { type AirshipBridge, AirshipModal, ContentArea, dayText, IconCircle, ModalCloseArrow, THEME } from './modalParts.js'

type Props = {
bridge: AirshipBridge<boolean>
Expand Down
2 changes: 1 addition & 1 deletion src/components/modals/SwapVerifyTermsModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { swapPluginIcons } from '../../assets/images/exchange'
import s from '../../locales/strings.js'
import { PrimaryButton, SecondaryButton } from '../../modules/UI/components/Buttons/index'
import { Airship } from '../services/AirshipInstance.js'
import { type AirshipBridge, AirshipModal, ContentArea, IconCircle, THEME, dayText } from './modalParts.js'
import { type AirshipBridge, AirshipModal, ContentArea, dayText, IconCircle, THEME } from './modalParts.js'

export async function swapVerifyTerms (swapConfig: EdgeSwapConfig, links: Array<{ text: string, uri: string }>): Promise<boolean> {
if (swapConfig.userSettings && swapConfig.userSettings.agreedToTerms) {
Expand Down
2 changes: 1 addition & 1 deletion src/components/modals/TwoButtonSimpleConfirmationModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import React, { Component } from 'react'
import { Text, TouchableOpacity } from 'react-native'
import EntypoIcon from 'react-native-vector-icons/Entypo'

import { type AirshipBridge, AirshipModal, ContentArea, IconCircle, THEME, dayText } from './modalParts.js'
import { type AirshipBridge, AirshipModal, ContentArea, dayText, IconCircle, THEME } from './modalParts.js'

type Props = {
bridge: AirshipBridge<boolean>,
Expand Down
2 changes: 1 addition & 1 deletion src/components/navigation/AlertDropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import EntypoIcon from 'react-native-vector-icons/Entypo'

import s from '../../locales/strings.js'
import { B, nightText } from '../../styles/common/textStyles.js'
import { THEME, getHeaderHeight } from '../../theme/variables/airbitz.js'
import { getHeaderHeight, THEME } from '../../theme/variables/airbitz.js'
import { type AirshipBridge } from '../common/Airship.js'
import { AirshipDropdown } from '../common/AirshipDropdown.js'

Expand Down
2 changes: 1 addition & 1 deletion src/components/scenes/ChangeMiningFeeScene.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow

import { type EdgeCurrencyWallet } from 'edge-core-js/types'
import React, { Component, type Node } from 'react'
import React, { type Node, Component } from 'react'
import { ScrollView, Text, TouchableWithoutFeedback, View } from 'react-native'
import EntypoIcon from 'react-native-vector-icons/Entypo'
import { connect } from 'react-redux'
Expand Down
2 changes: 1 addition & 1 deletion src/components/scenes/ManageTokensScene.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import React, { Component } from 'react'
import { ActivityIndicator, FlatList, View } from 'react-native'
import { Actions } from 'react-native-router-flux'

import { PREFERRED_TOKENS, getSpecialCurrencyInfo } from '../../constants/WalletAndCurrencyConstants.js'
import { getSpecialCurrencyInfo, PREFERRED_TOKENS } from '../../constants/WalletAndCurrencyConstants.js'
import s from '../../locales/strings.js'
import { PrimaryButton, SecondaryButton } from '../../modules/UI/components/Buttons/index'
import Text from '../../modules/UI/components/FormattedText/index'
Expand Down
2 changes: 1 addition & 1 deletion src/components/scenes/RequestScene.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import { sprintf } from 'sprintf-js'
import * as Constants from '../../constants/indexConstants'
import s from '../../locales/strings.js'
import ExchangeRate from '../../modules/UI/components/ExchangeRate/index.js'
import { ExchangedFlipInput } from '../../modules/UI/components/FlipInput/ExchangedFlipInput2.js'
import type { ExchangedFlipInputAmounts } from '../../modules/UI/components/FlipInput/ExchangedFlipInput2.js'
import { ExchangedFlipInput } from '../../modules/UI/components/FlipInput/ExchangedFlipInput2.js'
import { Icon } from '../../modules/UI/components/Icon/Icon.ui.js'
import QRCode from '../../modules/UI/components/QRCode/index.js'
import RequestStatus from '../../modules/UI/components/RequestStatus/index.js'
Expand Down
2 changes: 1 addition & 1 deletion src/components/scenes/ScanScene.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import Ionicon from 'react-native-vector-icons/Ionicons'
import SecondaryModal from '../../connectors/SecondaryModalConnector.js'
import * as Constants from '../../constants/indexConstants'
import s from '../../locales/strings.js'
import { PermissionStatusStrings } from '../../modules/PermissionsManager.js'
import type { PermissionStatus } from '../../modules/PermissionsManager.js'
import { PermissionStatusStrings } from '../../modules/PermissionsManager.js'
import T from '../../modules/UI/components/FormattedText/index'
import WalletListModal from '../../modules/UI/components/WalletListModal/WalletListModalConnector'
import styles, { styles as styleRaw } from '../../styles/scenes/ScaneStyle'
Expand Down
2 changes: 1 addition & 1 deletion src/components/scenes/WalletListScene.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import { buyMultipleCryptoStyle } from '../../styles/components/BuyCryptoStyle.j
import { TwoButtonModalStyle } from '../../styles/indexStyles.js'
import styles from '../../styles/scenes/WalletListStyle'
import THEME from '../../theme/variables/airbitz'
import { type DeviceDimensions } from '../../types/types.js'
import type { GuiWalletType } from '../../types/types.js'
import { type DeviceDimensions } from '../../types/types.js'
import { scale } from '../../util/scaling.js'
import { getFiatSymbol, getObjectDiff, getTotalFiatAmountFromExchangeRates } from '../../util/utils'
import FullWalletListRow from '../common/FullWalletListRow.js'
Expand Down
2 changes: 1 addition & 1 deletion src/connectors/CurrencySettingsTitleConnector.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import type { EdgeCurrencyInfo } from 'edge-core-js'
import { connect } from 'react-redux'

import { CurrencySettingsTitle } from '../components/common/CurrencySettingsTitle.js'
import type { CurrencySettingsTitleOwnProps } from '../components/common/CurrencySettingsTitle.js'
import { CurrencySettingsTitle } from '../components/common/CurrencySettingsTitle.js'
import { getPluginInfo } from '../modules/Settings/selectors.js'
import type { State } from '../types/reduxTypes.js'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { StyleSheet } from 'react-native'
import { connect } from 'react-redux'

import s from '../../locales/strings.js'
import { CryptoExchangeMessageBoxComponent, type Props } from '../../modules/UI/components/CryptoExchangeMessageBox/CryptoExchangeMessageBoxComponent'
import { type Props, CryptoExchangeMessageBoxComponent } from '../../modules/UI/components/CryptoExchangeMessageBox/CryptoExchangeMessageBoxComponent'
import type { State } from '../../types/reduxTypes.js'

type OwnProps = {
Expand Down
2 changes: 1 addition & 1 deletion src/connectors/components/HeaderMenuExchangeConnector.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { exchangeMax } from '../../actions/indexActions'
import { showHelpModal } from '../../components/modals/HelpModal.js'
import * as Constants from '../../constants/indexConstants'
import s from '../../locales/strings.js'
import { type DispatchProps, MenuDropDown, type StateProps } from '../../modules/UI/components/MenuDropDown/MenuDropDown.ui.js'
import { type DispatchProps, type StateProps, MenuDropDown } from '../../modules/UI/components/MenuDropDown/MenuDropDown.ui.js'
import * as Styles from '../../styles/indexStyles'
import THEME from '../../theme/variables/airbitz'
import type { Dispatch, State } from '../../types/reduxTypes.js'
Expand Down
2 changes: 1 addition & 1 deletion src/connectors/scenes/AddTokenConnector.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import { connect } from 'react-redux'

import * as ADD_TOKEN_ACTIONS from '../../actions/AddTokenActions.js'
import { AddToken } from '../../components/scenes/AddTokeScene.js'
import type { AddTokenDispatchProps, AddTokenOwnProps, AddTokenStateProps } from '../../components/scenes/AddTokeScene.js'
import { AddToken } from '../../components/scenes/AddTokeScene.js'
import { getWallet } from '../../modules/UI/selectors.js'
import type { Dispatch, State } from '../../types/reduxTypes.js'

Expand Down
Loading

0 comments on commit e341805

Please sign in to comment.