Skip to content

Commit

Permalink
fix: prettier update
Browse files Browse the repository at this point in the history
  • Loading branch information
KagamiChan committed Nov 30, 2019
1 parent e9a3ab7 commit 5c50a99
Show file tree
Hide file tree
Showing 19 changed files with 241 additions and 298 deletions.
19 changes: 14 additions & 5 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,20 @@ gulp.task('getVersion', done => {
})
})

gulp.task('build', gulp.series('getVersion', () => build(poiVersion)))

gulp.task('build_plugins', gulp.series('getVersion', () => installPlugins(poiVersion)))

gulp.task('pack_win_release', gulp.series('getVersion', () => packWinRelease(poiVersion)))
gulp.task(
'build',
gulp.series('getVersion', () => build(poiVersion)),
)

gulp.task(
'build_plugins',
gulp.series('getVersion', () => installPlugins(poiVersion)),
)

gulp.task(
'pack_win_release',
gulp.series('getVersion', () => packWinRelease(poiVersion)),
)

gulp.task('deploy_nightlies', () => deployNightlies())

Expand Down
5 changes: 4 additions & 1 deletion views/components/info/map-reminder.es
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ const MapRoutes = connect(state => ({
const locHistory = spotHistory.map(i => mapspots[get(maproutes, `${i}.1`)] || [-1, -1])
const lineHistory = histLen
? zip(locHistory.slice(0, histLen - 1), locHistory.slice(1))
: [[-1, -1], [-1, -1]]
: [
[-1, -1],
[-1, -1],
]
const SCALE = 1 / 6
return (
<MapRouteContainer className="map-route-container">
Expand Down
32 changes: 13 additions & 19 deletions views/components/main/parts/admiral-panel.es
Original file line number Diff line number Diff line change
Expand Up @@ -371,26 +371,20 @@ const CountdownContent = ({ moments }) => (
</div>
)

const admiralInfoSelector = createSelector(
[basicSelector],
basic => ({
level: get(basic, 'api_level', -1),
nickname: get(basic, 'api_nickname', ''),
rank: get(basic, 'api_rank', 0),
maxShip: get(basic, 'api_max_chara', 0),
maxSlotitem: get(basic, 'api_max_slotitem', 0),
}),
)
const admiralInfoSelector = createSelector([basicSelector], basic => ({
level: get(basic, 'api_level', -1),
nickname: get(basic, 'api_nickname', ''),
rank: get(basic, 'api_rank', 0),
maxShip: get(basic, 'api_max_chara', 0),
maxSlotitem: get(basic, 'api_max_slotitem', 0),
}))

const numCheckSelector = createSelector(
[configSelector],
config => ({
shipNumCheck: get(config, 'poi.mapStartCheck.ship.enable', false),
minShipNum: get(config, 'poi.mapStartCheck.ship.minFreeSlots', 4),
slotNumCheck: get(config, 'poi.mapStartCheck.item.enable', false),
minSlotNum: get(config, 'poi.mapStartCheck.item.minFreeSlots', 10),
}),
)
const numCheckSelector = createSelector([configSelector], config => ({
shipNumCheck: get(config, 'poi.mapStartCheck.ship.enable', false),
minShipNum: get(config, 'poi.mapStartCheck.ship.minFreeSlots', 4),
slotNumCheck: get(config, 'poi.mapStartCheck.item.enable', false),
minSlotNum: get(config, 'poi.mapStartCheck.item.minFreeSlots', 10),
}))

export const AdmiralPanel = withNamespaces(['main'])(
connect(state => ({
Expand Down
15 changes: 4 additions & 11 deletions views/components/main/parts/expedition-panel.es
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,11 @@ export const ExpeditionName = styled.span`
`}
`

const fleetsExpeditionSelector = createSelector(
fleetsSelector,
fleets => map(fleets, 'api_mission'),
)
const fleetsNamesSelector = createSelector(
fleetsSelector,
fleets => map(fleets, 'api_name'),
)
const fleetInBattleSelector = createSelector(
fleetInBattleSelectorFactory,
inBattle => inBattle,
const fleetsExpeditionSelector = createSelector(fleetsSelector, fleets =>
map(fleets, 'api_mission'),
)
const fleetsNamesSelector = createSelector(fleetsSelector, fleets => map(fleets, 'api_name'))
const fleetInBattleSelector = createSelector(fleetInBattleSelectorFactory, inBattle => inBattle)

const FleetStatus = withNamespaces(['main'])(
connect((state, { fleetId }) => {
Expand Down
9 changes: 3 additions & 6 deletions views/components/main/parts/mini-ship/index.es
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,9 @@ const CardWrapper = styled(CardWrapperL)`
`

const shipViewSwitchButtonDataSelectorFactory = memoize(fleetId =>
createSelector(
[fleetStateSelectorFactory(fleetId)],
fleetState => ({
fleetState,
}),
),
createSelector([fleetStateSelectorFactory(fleetId)], fleetState => ({
fleetState,
})),
)

const ShipViewSwitchButton = connect((state, { fleetId }) =>
Expand Down
5 changes: 4 additions & 1 deletion views/components/settings/about/app-metrics.es
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ export class AppMetrics extends PureComponent {
// prop => (total[prop] = round(sumBy(metrics, metric => metric.memory[prop]) / 1000, 2)),
// )

total.percentCPUUsage = round(sumBy(metrics, metric => metric.cpu.percentCPUUsage), 2)
total.percentCPUUsage = round(
sumBy(metrics, metric => metric.cpu.percentCPUUsage),
2,
)

this.getAllWindows().map(win => {
const pid = win.webContents.getOSProcessId()
Expand Down
5 changes: 4 additions & 1 deletion views/components/settings/main/screenshot-config.es
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ export const ScreenshotConfig = withNamespaces(['setting'])(({ t }) => (
label={t('setting:Screenshot Format')}
configName="poi.misc.screenshot.format"
defaultValue="png"
availableVal={[{ name: 'PNG', value: 'png' }, { name: 'JPEG', value: 'jpg' }]}
availableVal={[
{ name: 'PNG', value: 'png' },
{ name: 'JPEG', value: 'jpg' },
]}
/>
</FormGroup>
</Wrapper>
Expand Down
15 changes: 5 additions & 10 deletions views/components/ship-parts/fleet-stat.es
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,12 @@ class CountdownLabel extends Component {
}

const tykuSelectorFactory = memoize(fleetId =>
createSelector(
fleetShipsEquipDataWithEscapeSelectorFactory(fleetId),
(equipsData = []) => getTyku(equipsData),
createSelector(fleetShipsEquipDataWithEscapeSelectorFactory(fleetId), (equipsData = []) =>
getTyku(equipsData),
),
)

const admiralLevelSelector = createSelector(
basicSelector,
basic => basic.api_level,
)
const admiralLevelSelector = createSelector(basicSelector, basic => basic.api_level)

const sakuSelectorFactory = memoize(fleetId =>
createSelector(
Expand All @@ -161,9 +157,8 @@ const sakuSelectorFactory = memoize(fleetId =>
)

const speedSelectorFactory = memoize(fleetId =>
createSelector(
[fleetShipsDataWithEscapeSelectorFactory(fleetId)],
(shipsData = []) => getFleetSpeed(shipsData),
createSelector([fleetShipsDataWithEscapeSelectorFactory(fleetId)], (shipsData = []) =>
getFleetSpeed(shipsData),
),
)

Expand Down
11 changes: 4 additions & 7 deletions views/components/ship/aaci-indicator.es
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,10 @@ const AACISelectorFactory = memoize(shipId =>
)

const maxAACIShotdownSelectorFactory = memoize(shipId =>
createSelector(
[shipDataSelectorFactory(shipId)],
([_ship = {}, $ship = {}] = []) => {
const AACIs = getShipAllAACIs({ ...$ship, ..._ship })
return Math.max(...AACIs.map(id => AACITable[id].fixed || 0))
},
),
createSelector([shipDataSelectorFactory(shipId)], ([_ship = {}, $ship = {}] = []) => {
const AACIs = getShipAllAACIs({ ...$ship, ..._ship })
return Math.max(...AACIs.map(id => AACITable[id].fixed || 0))
}),
)

export const AACIIndicator = withNamespaces(['main'])(
Expand Down
9 changes: 3 additions & 6 deletions views/components/ship/index.es
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,9 @@ const ShipViewSwitchButton = connect((state, { fleetId }) =>
))

const fleetShipViewDataSelectorFactory = memoize(fleetId =>
createSelector(
[fleetShipsIdSelectorFactory(fleetId)],
shipsId => ({
shipsId,
}),
),
createSelector([fleetShipsIdSelectorFactory(fleetId)], shipsId => ({
shipsId,
})),
)

const FleetShipView = connect((state, { fleetId }) =>
Expand Down
5 changes: 1 addition & 4 deletions views/components/ship/oasw-indicator.es
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ import { isOASWWith } from 'views/utils/oasw'
import { withNamespaces } from 'react-i18next'
import { ShipLabel } from 'views/components/ship-parts/styled-components'

const isOASWFuncSelector = createSelector(
allCVEIdsSelector,
allCVEIds => isOASWWith(allCVEIds),
)
const isOASWFuncSelector = createSelector(allCVEIdsSelector, allCVEIds => isOASWWith(allCVEIds))

const OASWSelectorFactory = memoize(shipId =>
createSelector(
Expand Down
5 changes: 1 addition & 4 deletions views/env-parts/getter.es
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ function object2Array(obj) {
}
function object2ArraySelectorFactory(path) {
const pathSelector = state => get(state, path)
return createSelector(
pathSelector,
obj => object2Array(obj),
)
return createSelector(pathSelector, obj => object2Array(obj))
}

// User config
Expand Down
17 changes: 10 additions & 7 deletions views/env-parts/i18next.es
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,16 @@ const i18nFiles = glob.sync(path.join(ROOT, 'i18n', '*'))

const mainPoiNs = i18nFiles.map(i => path.basename(i))
const mainPoiRes = {}
each(LOCALES.map(lng => lng.locale), locale => {
mainPoiRes[locale] = {}
each(i18nFiles, i18nFile => {
const namespace = path.basename(i18nFile)
mainPoiRes[locale][namespace] = readI18nResources(path.join(i18nFile, `${locale}.json`))
})
})
each(
LOCALES.map(lng => lng.locale),
locale => {
mainPoiRes[locale] = {}
each(i18nFiles, i18nFile => {
const namespace = path.basename(i18nFile)
mainPoiRes[locale][namespace] = readI18nResources(path.join(i18nFile, `${locale}.json`))
})
},
)

window.LOCALES = LOCALES
window.language = window.config.get('poi.misc.language', navigator.language)
Expand Down
5 changes: 4 additions & 1 deletion views/redux/info/equips.es
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ export function reducer(state = {}, { type, postBody, body }, store) {
}
case '@@Response/kcsapi/api_req_kousyou/createitem':
if (body.api_create_flag == 1) {
const items = keyBy(filter(body.api_get_items, item => item?.api_id > 0), 'api_id')
const items = keyBy(
filter(body.api_get_items, item => item?.api_id > 0),
'api_id',
)
return {
...state,
...items,
Expand Down
12 changes: 7 additions & 5 deletions views/services/plugin-manager/index.es
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,13 @@ class PluginManager extends EventEmitter {

async getOutdatedPlugins(isNotif) {
const plugins = this.getInstalledPlugins()
const outdatedList = (await Promise.all(
plugins.map(plugin =>
this.getPluginOutdateInfo(plugin).catch(err => console.error(err.stack)),
),
)).filter(Boolean)
const outdatedList = (
await Promise.all(
plugins.map(plugin =>
this.getPluginOutdateInfo(plugin).catch(err => console.error(err.stack)),
),
)
).filter(Boolean)
if (isNotif && outdatedList.length > 0) {
const content = `${map(outdatedList, 'name').join(' / ')} ${i18next.t(
'setting:PluginUpdateMsg',
Expand Down
31 changes: 18 additions & 13 deletions views/services/plugin-manager/utils.es
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,19 @@ export function updateI18n(plugin) {
}
if (i18nFile != null) {
const namespace = plugin.id
each(window.LOCALES.map(lng => lng.locale), language => {
i18next.addGlobalI18n(namespace)
i18next.addResourceBundleDebounce(
language,
namespace,
readI18nResources(join(i18nFile, `${language}.json`)),
true,
true,
)
})
each(
window.LOCALES.map(lng => lng.locale),
language => {
i18next.addGlobalI18n(namespace)
i18next.addResourceBundleDebounce(
language,
namespace,
readI18nResources(join(i18nFile, `${language}.json`)),
true,
true,
)
},
)
plugin = {
...plugin,
name: i18next.t(`${namespace}:${plugin.name}`),
Expand Down Expand Up @@ -465,9 +468,11 @@ export function notifyFailed(state, npmConfig) {
}

export async function repairDep(brokenList, npmConfig) {
const depList = (await new Promise(res => {
glob(path.join(npmConfig.prefix, 'node_modules', '*'), (err, matches) => res(matches))
})).filter(p => !p.includes('poi-plugin'))
const depList = (
await new Promise(res => {
glob(path.join(npmConfig.prefix, 'node_modules', '*'), (err, matches) => res(matches))
})
).filter(p => !p.includes('poi-plugin'))
depList.forEach(p => {
try {
require(p)
Expand Down
5 changes: 4 additions & 1 deletion views/utils/aaci.es
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,10 @@ export const getShipAACIs = (ship, equips) => {
export const getFleetAvailableAACIs = (ships, equips) => {
const aaciSet = {}
ships.forEach((ship, index) => {
getShipAACIs(ship, equips[index].map(([equip, onslot]) => equip)).forEach(id => {
getShipAACIs(
ship,
equips[index].map(([equip, onslot]) => equip),
).forEach(id => {
aaciSet[id] = true
})
})
Expand Down
5 changes: 4 additions & 1 deletion views/utils/oasw.es
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ export const isOASWWith = allCVEIds =>
// 必要対潜60 + ソナー
_.overEvery(taisenAbove(60), overEquips(hasSome(isSonar))),
// 必要対潜値75 + 装備のみの対潜値が合計4以上
_.overEvery(taisenAbove(75), overEquips(equips => _.sum(equips.map(equipTais)) >= 4)),
_.overEvery(
taisenAbove(75),
overEquips(equips => _.sum(equips.map(equipTais)) >= 4),
),
),
),
_.overEvery(
Expand Down
Loading

0 comments on commit 5c50a99

Please sign in to comment.