Add husky and lint-staged to run linting on commit

Change-type: patch
Signed-off-by: Stevche Radevski <stevche@balena.io>
This commit is contained in:
Stevche Radevski 2019-12-06 13:28:03 +01:00 committed by Lorenzo Alberto Maria Ambrosi
parent 388852d6b7
commit 9f4e0ce920
4 changed files with 858 additions and 9 deletions

View File

@ -18,6 +18,8 @@ import * as _ from 'lodash';
import * as propTypes from 'prop-types';
import * as React from 'react';
import styled from 'styled-components';
import * as driveConstraints from '../../../../shared/drive-constraints';
import * as utils from '../../../../shared/utils';
import * as TargetSelector from '../../components/drive-selector/target-selector.jsx';
import * as SvgIcon from '../../components/svg-icon/svg-icon.jsx';
import * as selectionState from '../../models/selection-state';
@ -25,8 +27,6 @@ import * as settings from '../../models/settings';
import * as store from '../../models/store';
import * as analytics from '../../modules/analytics';
import * as exceptionReporter from '../../modules/exception-reporter';
import * as driveConstraints from '../../../../shared/drive-constraints';
import * as utils from '../../../../shared/utils';
const StepBorder = styled.div<{
disabled: boolean;
@ -68,8 +68,10 @@ const openDriveSelector = async (DriveSelectorService: any) => {
device: drive.device,
unsafeMode:
settings.get('unsafeMode') && !settings.get('disableUnsafeMode'),
applicationSessionUuid: (store as any).getState().toJS().applicationSessionUuid,
flashingWorkflowUuid: (store as any).getState().toJS().flashingWorkflowUuid,
applicationSessionUuid: (store as any).getState().toJS()
.applicationSessionUuid,
flashingWorkflowUuid: (store as any).getState().toJS()
.flashingWorkflowUuid,
});
} catch (error) {
exceptionReporter.report(error);
@ -79,7 +81,8 @@ const openDriveSelector = async (DriveSelectorService: any) => {
const reselectDrive = (DriveSelectorService: any) => {
openDriveSelector(DriveSelectorService);
analytics.logEvent('Reselect drive', {
applicationSessionUuid: (store as any).getState().toJS().applicationSessionUuid,
applicationSessionUuid: (store as any).getState().toJS()
.applicationSessionUuid,
flashingWorkflowUuid: (store as any).getState().toJS().flashingWorkflowUuid,
});
};

View File

@ -18,6 +18,8 @@ import * as _ from 'lodash';
import * as path from 'path';
import * as React from 'react';
import { Modal, Txt } from 'rendition';
import * as constraints from '../../../../shared/drive-constraints';
import * as messages from '../../../../shared/messages';
import * as ProgressButton from '../../components/progress-button/progress-button.jsx';
import * as SvgIcon from '../../components/svg-icon/svg-icon.jsx';
import * as availableDrives from '../../models/available-drives';
@ -29,8 +31,6 @@ import * as driveScanner from '../../modules/drive-scanner';
import * as imageWriter from '../../modules/image-writer';
import * as progressStatus from '../../modules/progress-status';
import * as notification from '../../os/notification';
import * as constraints from '../../../../shared/drive-constraints';
import * as messages from '../../../../shared/messages';
const COMPLETED_PERCENTAGE = 100;
const SPEED_PRECISION = 2;
@ -189,8 +189,10 @@ export const Flash = ({
flashState.resetState();
if (shouldRetry) {
analytics.logEvent('Restart after failure', {
applicationSessionUuid: (store as any).getState().toJS().applicationSessionUuid,
flashingWorkflowUuid: (store as any).getState().toJS().flashingWorkflowUuid,
applicationSessionUuid: (store as any).getState().toJS()
.applicationSessionUuid,
flashingWorkflowUuid: (store as any).getState().toJS()
.flashingWorkflowUuid,
});
} else {
selection.clear();

830
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load Diff

View File

@ -32,6 +32,18 @@
"concourse-test": "npx npm@6.7.0 test",
"concourse-test-electron": "npx npm@6.7.0 test"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"./**/*.{js,mjs,jsx,ts,tsx}": [
"npm run prettier",
"make lint",
"git add"
]
},
"author": "Balena Inc. <hello@etcher.io>",
"license": "Apache-2.0",
"platformSpecificDependencies": [
@ -106,6 +118,8 @@
"eslint-plugin-standard": "^3.0.1",
"html-angular-validate": "^0.2.3",
"html-loader": "^0.5.1",
"husky": "^3.1.0",
"lint-staged": "^9.5.0",
"mocha": "^6.2.1",
"mochainon": "^2.0.0",
"node-gyp": "^3.8.0",