From 9bf58c89d4adadfe6d3d7c45a109542fa8e079e1 Mon Sep 17 00:00:00 2001 From: Alexis Svinartchouk Date: Tue, 28 Apr 2020 15:19:39 +0200 Subject: [PATCH] Update resin-lint -> @balena/lint Change-type: patch --- Makefile | 2 +- lib/gui/app/app.ts | 6 +- .../drive-selector/DriveSelectorModal.tsx | 2 +- .../drive-selector/target-selector.tsx | 2 +- lib/gui/app/components/finish/finish.tsx | 2 +- .../source-selector/source-selector.tsx | 2 +- lib/gui/app/components/svg-icon/svg-icon.tsx | 4 +- lib/gui/app/models/flash-state.ts | 5 +- lib/gui/app/models/leds.ts | 2 +- lib/gui/app/models/selection-state.ts | 7 +- lib/gui/app/models/store.ts | 6 +- lib/gui/app/modules/image-writer.ts | 8 +- lib/gui/app/modules/update-lock.ts | 2 +- lib/gui/app/os/windows-network-drives.ts | 2 +- lib/gui/app/pages/main/DriveSelector.tsx | 6 +- lib/gui/app/styled-components.tsx | 2 +- lib/gui/etcher.ts | 4 +- lib/gui/modules/child-writer.ts | 4 +- lib/shared/drive-constraints.ts | 4 +- lib/shared/errors.ts | 2 +- lib/shared/file-extensions.ts | 6 +- lib/shared/utils.ts | 2 +- npm-shrinkwrap.json | 748 +++++++++--------- package.json | 2 +- tests/gui/models/available-drives.spec.ts | 86 +- tests/gui/models/flash-state.spec.ts | 140 ++-- tests/gui/models/selection-state.spec.ts | 312 ++++---- tests/gui/models/settings.spec.ts | 62 +- tests/gui/modules/child-writer.spec.ts | 4 +- tests/gui/modules/image-writer.spec.ts | 8 +- tests/gui/modules/progress-status.spec.ts | 34 +- tests/gui/os/window-progress.spec.ts | 38 +- tests/gui/utils/middle-ellipsis.spec.ts | 12 +- tests/shared/drive-constraints.spec.ts | 322 ++++---- tests/shared/errors.spec.ts | 216 ++--- tests/shared/file-extensions.spec.ts | 30 +- tests/shared/messages.spec.ts | 30 +- tests/shared/permissions.spec.ts | 20 +- tests/shared/supported-formats.spec.ts | 70 +- tests/shared/units.spec.ts | 18 +- tests/shared/utils.spec.ts | 64 +- tests/spectron/runner.spec.ts | 12 +- 42 files changed, 1150 insertions(+), 1160 deletions(-) diff --git a/Makefile b/Makefile index 47516079..929d3dc1 100644 --- a/Makefile +++ b/Makefile @@ -149,7 +149,7 @@ sass: node-sass lib/gui/app/scss/main.scss > lib/gui/css/main.css lint-ts: - resin-lint --fix --typescript typings lib tests scripts/clean-shrinkwrap.ts webpack.config.ts + balena-lint --fix --typescript typings lib tests scripts/clean-shrinkwrap.ts webpack.config.ts lint-sass: sass-lint -v lib/gui/app/scss/**/*.scss lib/gui/app/scss/*.scss diff --git a/lib/gui/app/app.ts b/lib/gui/app/app.ts index 865a22fb..da9cff55 100644 --- a/lib/gui/app/app.ts +++ b/lib/gui/app/app.ts @@ -198,7 +198,7 @@ function prepareDrive(drive: Drive) { // @ts-ignore drive.progress = 0; drive.disabled = true; - drive.on('progress', progress => { + drive.on('progress', (progress) => { updateDriveProgress(drive, progress); }); return drive; @@ -275,7 +275,7 @@ function updateDriveProgress( driveScanner.on('attach', addDrive); driveScanner.on('detach', removeDrive); -driveScanner.on('error', error => { +driveScanner.on('error', (error) => { // Stop the drive scanning loop in case of errors, // otherwise we risk presenting the same error over // and over again to the user, while also heavily @@ -289,7 +289,7 @@ driveScanner.start(); let popupExists = false; -window.addEventListener('beforeunload', async event => { +window.addEventListener('beforeunload', async (event) => { if (!flashState.isFlashing() || popupExists) { analytics.logEvent('Close application', { isFlashing: flashState.isFlashing(), diff --git a/lib/gui/app/components/drive-selector/DriveSelectorModal.tsx b/lib/gui/app/components/drive-selector/DriveSelectorModal.tsx index c93f3f68..136e0e31 100644 --- a/lib/gui/app/components/drive-selector/DriveSelectorModal.tsx +++ b/lib/gui/app/components/drive-selector/DriveSelectorModal.tsx @@ -190,7 +190,7 @@ export function DriveSelectorModal({ close }: { close: () => void }) {
keyboardToggleDrive(drive, evt)} + onKeyPress={(evt) => keyboardToggleDrive(drive, evt)} >
{drive.description} diff --git a/lib/gui/app/components/drive-selector/target-selector.tsx b/lib/gui/app/components/drive-selector/target-selector.tsx index f9dd930b..ea2fe8db 100644 --- a/lib/gui/app/components/drive-selector/target-selector.tsx +++ b/lib/gui/app/components/drive-selector/target-selector.tsx @@ -34,7 +34,7 @@ import { } from '../../styled-components'; import { middleEllipsis } from '../../utils/middle-ellipsis'; -const TargetDetail = styled(props => )` +const TargetDetail = styled((props) => )` float: ${({ float }) => float}; `; diff --git a/lib/gui/app/components/finish/finish.tsx b/lib/gui/app/components/finish/finish.tsx index dc1cb194..fe4ecf79 100644 --- a/lib/gui/app/components/finish/finish.tsx +++ b/lib/gui/app/components/finish/finish.tsx @@ -58,7 +58,7 @@ const restart = (options: any, goToMain: () => void) => { const formattedErrors = () => { const errors = _.map( _.get(flashState.getFlashResults(), ['results', 'errors']), - error => { + (error) => { return `${error.device}: ${error.message || error.code}`; }, ); diff --git a/lib/gui/app/components/source-selector/source-selector.tsx b/lib/gui/app/components/source-selector/source-selector.tsx index f8c60d10..fb0c9887 100644 --- a/lib/gui/app/components/source-selector/source-selector.tsx +++ b/lib/gui/app/components/source-selector/source-selector.tsx @@ -148,7 +148,7 @@ const URLSelector = ({ done }: { done: (imageURL: string) => void }) => { Recent ( + rows={_.map(recentImages, (recent) => ( { diff --git a/lib/gui/app/components/svg-icon/svg-icon.tsx b/lib/gui/app/components/svg-icon/svg-icon.tsx index 61efcebe..200e65df 100644 --- a/lib/gui/app/components/svg-icon/svg-icon.tsx +++ b/lib/gui/app/components/svg-icon/svg-icon.tsx @@ -82,7 +82,7 @@ export class SVGIcon extends React.Component { let svgData = ''; - _.find(this.props.contents, content => { + _.find(this.props.contents, (content) => { const attempt = tryParseSVGContents(content); if (attempt) { @@ -94,7 +94,7 @@ export class SVGIcon extends React.Component { }); if (!svgData) { - _.find(this.props.paths, relativePath => { + _.find(this.props.paths, (relativePath) => { // This means the path to the icon should be // relative to *this directory*. // TODO: There might be a way to compute the path diff --git a/lib/gui/app/models/flash-state.ts b/lib/gui/app/models/flash-state.ts index 079eb0df..3894ce6d 100644 --- a/lib/gui/app/models/flash-state.ts +++ b/lib/gui/app/models/flash-state.ts @@ -100,10 +100,7 @@ export function getFlashResults() { } export function getFlashState() { - return store - .getState() - .get('flashState') - .toJS(); + return store.getState().get('flashState').toJS(); } export function wasLastFlashCancelled() { diff --git a/lib/gui/app/models/leds.ts b/lib/gui/app/models/leds.ts index 85363138..71747abc 100644 --- a/lib/gui/app/models/leds.ts +++ b/lib/gui/app/models/leds.ts @@ -81,7 +81,7 @@ export function init() { for (const [drivePath, ledsNames] of Object.entries(ledsMapping)) { leds.set('/dev/disk/by-path/' + drivePath, new RGBLed(ledsNames)); } - observe(state => { + observe((state) => { const availableDrives = state .get('availableDrives') .toJS() diff --git a/lib/gui/app/models/selection-state.ts b/lib/gui/app/models/selection-state.ts index caf53b09..6a19f73a 100644 --- a/lib/gui/app/models/selection-state.ts +++ b/lib/gui/app/models/selection-state.ts @@ -51,10 +51,7 @@ export function selectImage(image: any) { * @summary Get all selected drives' devices */ export function getSelectedDevices(): string[] { - return store - .getState() - .getIn(['selection', 'devices']) - .toJS(); + return store.getState().getIn(['selection', 'devices']).toJS(); } /** @@ -62,7 +59,7 @@ export function getSelectedDevices(): string[] { */ export function getSelectedDrives(): any[] { const drives = availableDrives.getDrives(); - return _.map(getSelectedDevices(), device => { + return _.map(getSelectedDevices(), (device) => { return _.find(drives, { device }); }); } diff --git a/lib/gui/app/models/store.ts b/lib/gui/app/models/store.ts index 8da31f22..b9789a2c 100644 --- a/lib/gui/app/models/store.ts +++ b/lib/gui/app/models/store.ts @@ -34,7 +34,7 @@ function verifyNoNilFields( fields: string[], name: string, ) { - const nilFields = _.filter(fields, field => { + const nilFields = _.filter(fields, (field) => { return _.isNil(_.get(object, field)); }); if (nilFields.length) { @@ -133,9 +133,9 @@ function storeReducer( drives = _.sortBy(drives, [ // Devices with no devicePath first (usbboot) - d => !!d.devicePath, + (d) => !!d.devicePath, // Then sort by devicePath (only available on Linux with udev) or device - d => d.devicePath || d.device, + (d) => d.devicePath || d.device, ]); const newState = state.set('availableDrives', Immutable.fromJS(drives)); diff --git a/lib/gui/app/modules/image-writer.ts b/lib/gui/app/modules/image-writer.ts index 3b7b2690..202c5a3b 100644 --- a/lib/gui/app/modules/image-writer.ts +++ b/lib/gui/app/modules/image-writer.ts @@ -149,13 +149,13 @@ export function performWrite( let cancelled = false; ipc.serve(); return new Promise((resolve, reject) => { - ipc.server.on('error', error => { + ipc.server.on('error', (error) => { terminateServer(); const errorObject = errors.fromJSON(error); reject(errorObject); }); - ipc.server.on('log', message => { + ipc.server.on('log', (message) => { console.log(message); }); @@ -174,8 +174,8 @@ export function performWrite( handleErrorLogging(error, analyticsData); }); - ipc.server.on('done', event => { - event.results.errors = _.map(event.results.errors, data => { + ipc.server.on('done', (event) => { + event.results.errors = _.map(event.results.errors, (data) => { return errors.fromJSON(data); }); _.merge(flashResults, event); diff --git a/lib/gui/app/modules/update-lock.ts b/lib/gui/app/modules/update-lock.ts index 978e9c43..51a2b989 100644 --- a/lib/gui/app/modules/update-lock.ts +++ b/lib/gui/app/modules/update-lock.ts @@ -147,7 +147,7 @@ class UpdateLock extends EventEmitter { logException(checkError); } if (!isLocked) { - UpdateLock.acquire(error => { + UpdateLock.acquire((error) => { if (error) { logException(error); } diff --git a/lib/gui/app/os/windows-network-drives.ts b/lib/gui/app/os/windows-network-drives.ts index 6fffb515..1acba6a7 100755 --- a/lib/gui/app/os/windows-network-drives.ts +++ b/lib/gui/app/os/windows-network-drives.ts @@ -88,7 +88,7 @@ async function getWindowsNetworkDrives(): Promise> { trim(str.slice(colonPosition + 1)), ]; }) - .filter(couple => couple[1].length > 0) + .filter((couple) => couple[1].length > 0) .value(); return new Map(couples); } diff --git a/lib/gui/app/pages/main/DriveSelector.tsx b/lib/gui/app/pages/main/DriveSelector.tsx index 3464ec48..255b3989 100644 --- a/lib/gui/app/pages/main/DriveSelector.tsx +++ b/lib/gui/app/pages/main/DriveSelector.tsx @@ -31,7 +31,7 @@ const StepBorder = styled.div<{ right?: boolean; }>` height: 2px; - background-color: ${props => + background-color: ${(props) => props.disabled ? props.theme.customColors.dark.disabled.foreground : props.theme.customColors.dark.foreground}; @@ -39,8 +39,8 @@ const StepBorder = styled.div<{ width: 124px; top: 19px; - left: ${props => (props.left ? '-67px' : undefined)}; - right: ${props => (props.right ? '-67px' : undefined)}; + left: ${(props) => (props.left ? '-67px' : undefined)}; + right: ${(props) => (props.right ? '-67px' : undefined)}; `; const getDriveListLabel = () => { diff --git a/lib/gui/app/styled-components.tsx b/lib/gui/app/styled-components.tsx index 110b4944..41b5204a 100644 --- a/lib/gui/app/styled-components.tsx +++ b/lib/gui/app/styled-components.tsx @@ -61,7 +61,7 @@ export const BaseButton = styled(Button)` height: 48px; `; -export const IconButton = styled(props =>