Skip to content

Commit 6263d28

Browse files
Add husky and prettier with post-commit formatting hook
1 parent bef7bd8 commit 6263d28

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+434
-366
lines changed

app/bootstrap/bootstrap.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,13 @@
1919
* - 3rd party Libraries and angular1 module
2020
*/
2121

22-
2322
// import all the app sub modules
2423
// Each module registers it states/services/components, with the `ngmodule`
25-
import "../global/global.module";
26-
import "../main/main.module";
27-
import "../contacts/contacts.module";
28-
import "../mymessages/mymessages.module";
29-
import "../prefs/prefs.module";
24+
import '../global/global.module';
25+
import '../main/main.module';
26+
import '../contacts/contacts.module';
27+
import '../mymessages/mymessages.module';
28+
import '../prefs/prefs.module';
3029

3130
// Google analytics
3231
import '../util/ga';

app/bootstrap/ngmodule.js

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
* and exports it.
44
*/
55
// External dependencies
6-
import * as angular from "angular";
7-
import uiRouter from "@uirouter/angularjs";
6+
import * as angular from 'angular';
7+
import uiRouter from '@uirouter/angularjs';
88
import { StickyStatesPlugin } from '@uirouter/sticky-states';
99
import { DSRPlugin } from '@uirouter/dsr';
10-
import ocLazyLoad from "oclazyload";
10+
import ocLazyLoad from 'oclazyload';
1111

1212
import { MAIN_MODULE } from '../main/main.module';
1313
import { GLOBAL_MODULE } from '../global/global.module';
@@ -16,7 +16,7 @@ import { GLOBAL_MODULE } from '../global/global.module';
1616
//
1717
// Since it is exported, other parts of the application (in other files) can then import it and register things.
1818
// In bootstrap.js, the module is imported, and the components, services, and states are registered.
19-
export const ngmodule = angular.module("demo", [
19+
export const ngmodule = angular.module('demo', [
2020
uiRouter,
2121
ocLazyLoad,
2222
MAIN_MODULE.name,
@@ -28,10 +28,14 @@ export const ngmodule = angular.module("demo", [
2828
// PREFS_MODULE.name
2929
]);
3030

31-
ngmodule.config(['$uiRouterProvider', '$locationProvider', ($uiRouter, $locationProvider) => {
32-
$locationProvider.hashPrefix('');
33-
$uiRouter.plugin(StickyStatesPlugin);
34-
$uiRouter.plugin(DSRPlugin);
35-
// Show the UI-Router Visualizer
36-
import("@uirouter/visualizer").then(module => $uiRouter.plugin(module.Visualizer));
37-
}]);
31+
ngmodule.config([
32+
'$uiRouterProvider',
33+
'$locationProvider',
34+
($uiRouter, $locationProvider) => {
35+
$locationProvider.hashPrefix('');
36+
$uiRouter.plugin(StickyStatesPlugin);
37+
$uiRouter.plugin(DSRPlugin);
38+
// Show the UI-Router Visualizer
39+
import('@uirouter/visualizer').then((module) => $uiRouter.plugin(module.Visualizer));
40+
},
41+
]);

app/contacts/contactDetail.component.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* This component renders a read only view of the details for a single contact.
2+
* This component renders a read only view of the details for a single contact.
33
*/
44
export const contactDetail = {
55
bindings: { contact: '<' },
@@ -24,5 +24,5 @@ export const contactDetail = {
2424
<img ng-src="{{$ctrl.contact.picture}}"/>
2525
</div>
2626
</div>
27-
`
27+
`,
2828
};

app/contacts/contactList.component.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* This component renders a list of contacts.
3-
*
3+
*
44
* At the top is a "new contact" button.
55
* Each list item is a clickable link to the `contacts.contact` details substate
66
*/
@@ -29,5 +29,5 @@ export const contactList = {
2929
</a>
3030
</li>
3131
</ul>
32-
`
32+
`,
3333
};

app/contacts/contactView.component.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/**
22
* This component renders details for a single contact
3-
*
3+
*
44
* A button messages the contact by linking to `mymessages.compose` state passing the email as a state parameter.
55
* Another button edits the contact by linking to `contacts.contact.edit` state.
66
*/
77

88
export const contactView = {
9-
bindings: {contact: '<'},
9+
bindings: { contact: '<' },
1010

1111
template: `
1212
<div class="contact">
@@ -25,4 +25,5 @@ export const contactView = {
2525
</button>
2626
2727
</div>
28-
`};
28+
`,
29+
};

app/contacts/contacts.component.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* This component renders the contacts submodule.
3-
*
3+
*
44
* On the left is the list of contacts.
55
* On the right is the ui-view viewport where contact details appear.
66
*/
@@ -17,5 +17,5 @@ export const contacts = {
1717
<h4 style="margin: 1em 2em;">Select a contact</h4>
1818
</div>
1919
20-
</div>`
20+
</div>`,
2121
};

app/contacts/contacts.module.js

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import {contactDetail} from "./contactDetail.component";
2-
import {contactList} from "./contactList.component";
3-
import {contacts} from "./contacts.component";
4-
import {contactView} from "./contactView.component";
5-
import {editContact} from "./editContact.component";
1+
import { contactDetail } from './contactDetail.component';
2+
import { contactList } from './contactList.component';
3+
import { contacts } from './contacts.component';
4+
import { contactView } from './contactView.component';
5+
import { editContact } from './editContact.component';
66

7-
import {contactsState, editContactState, newContactState, viewContactState} from "./contacts.states";
7+
import { contactsState, editContactState, newContactState, viewContactState } from './contacts.states';
88

99
export const CONTACTS_MODULE = angular.module('contacts', []);
1010

@@ -14,9 +14,12 @@ CONTACTS_MODULE.component('editContact', editContact);
1414
CONTACTS_MODULE.component('contactDetail', contactDetail);
1515
CONTACTS_MODULE.component('contactList', contactList);
1616

17-
CONTACTS_MODULE.config(['$stateRegistryProvider', function($stateRegistry) {
18-
$stateRegistry.register(contactsState);
19-
$stateRegistry.register(newContactState);
20-
$stateRegistry.register(viewContactState);
21-
$stateRegistry.register(editContactState);
22-
}]);
17+
CONTACTS_MODULE.config([
18+
'$stateRegistryProvider',
19+
function ($stateRegistry) {
20+
$stateRegistry.register(contactsState);
21+
$stateRegistry.register(newContactState);
22+
$stateRegistry.register(viewContactState);
23+
$stateRegistry.register(editContactState);
24+
},
25+
]);

app/contacts/contacts.states.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import "../global/dialog.service";
1+
import '../global/dialog.service';
22

33
/**
44
* This state displays the contact list.
@@ -8,17 +8,17 @@ import "../global/dialog.service";
88
*/
99
export const contactsState = {
1010
parent: 'app', // declares that 'contacts' is a child of 'app'
11-
name: "contacts",
12-
url: "/contacts",
11+
name: 'contacts',
12+
url: '/contacts',
1313
resolve: {
1414
// Resolve all the contacts. The resolved contacts are injected into the controller.
15-
contacts: ['Contacts', (Contacts) => Contacts.all()]
15+
contacts: ['Contacts', (Contacts) => Contacts.all()],
1616
},
1717
data: { requiresAuth: true },
1818
deepStateRedirect: true,
1919
sticky: true,
2020
views: {
21-
contacts: 'contacts'
21+
contacts: 'contacts',
2222
},
2323
};
2424

@@ -32,12 +32,11 @@ export const viewContactState = {
3232
resolve: {
3333
// Resolve the contact, based on the contactId parameter value.
3434
// The resolved contact is provided to the contactComponent's contact binding
35-
contact: ['Contacts', '$transition$', (Contacts, $transition$) => Contacts.get($transition$.params().contactId)]
35+
contact: ['Contacts', '$transition$', (Contacts, $transition$) => Contacts.get($transition$.params().contactId)],
3636
},
37-
component: 'contactView'
37+
component: 'contactView',
3838
};
3939

40-
4140
/**
4241
* This state allows a user to edit a contact
4342
*
@@ -54,10 +53,10 @@ export const editContactState = {
5453
// This could also have been written using ui-view@state addressing: $default@contacts
5554
// Or, this could also have been written using absolute ui-view addressing: !$default.$default.$default
5655
'^.^.$default': {
57-
bindings: { pristineContact: "contact" },
58-
component: 'editContact'
59-
}
60-
}
56+
bindings: { pristineContact: 'contact' },
57+
component: 'editContact',
58+
},
59+
},
6160
};
6261

6362
/**
@@ -68,5 +67,5 @@ export const editContactState = {
6867
export const newContactState = {
6968
name: 'contacts.new',
7069
url: '/new',
71-
component: 'editContact'
70+
component: 'editContact',
7271
};

app/contacts/editContact.component.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@ class EditContactController {
4646
/** Ask for confirmation, then delete the contact, then go to the grandparent state ('contacts') */
4747
remove(contact) {
4848
this.DialogService.confirm(`Delete contact: ${contact.name.first} ${contact.name.last}`)
49-
.then(() => this.Contacts.remove(contact))
50-
.then(() => this.canExit = true)
51-
.then(() => this.$state.go("^.^", null, { reload: true }));
49+
.then(() => this.Contacts.remove(contact))
50+
.then(() => (this.canExit = true))
51+
.then(() => this.$state.go('^.^', null, { reload: true }));
5252
}
5353

5454
/** Save the contact, then go to the grandparent state ('contacts') */
5555
save(contact) {
5656
this.Contacts.save(contact)
57-
.then(() => this.canExit = true)
58-
.then(() => this.$state.go("^", null, { reload: true }));
57+
.then(() => (this.canExit = true))
58+
.then(() => this.$state.go('^', null, { reload: true }));
5959
}
6060
}
6161
EditContactController.$inject = ['$state', 'DialogService', 'Contacts'];
@@ -68,7 +68,7 @@ EditContactController.$inject = ['$state', 'DialogService', 'Contacts'];
6868
* Another button saves the contact.
6969
* A third button deletes the bcontact.
7070
*/
71-
export const editContact = {
71+
export const editContact = {
7272
bindings: { pristineContact: '<' },
7373

7474
controller: EditContactController,
@@ -98,4 +98,5 @@ export const editContact = {
9898
<button class="btn btn-primary" ng-click="$ctrl.remove($ctrl.contact)"><i class="fa fa-close"></i><span>Delete</span></button>
9999
</div>
100100
</div>
101-
`};
101+
`,
102+
};

app/global/appConfig.service.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ export class AppConfig {
1111

1212
load() {
1313
try {
14-
return angular.extend(this, angular.fromJson(sessionStorage.getItem("appConfig")))
15-
} catch (Error) { }
14+
return angular.extend(this, angular.fromJson(sessionStorage.getItem('appConfig')));
15+
} catch (Error) {}
1616

1717
return this;
1818
}
1919

2020
save() {
21-
sessionStorage.setItem("appConfig", angular.toJson(angular.extend({}, this)));
21+
sessionStorage.setItem('appConfig', angular.toJson(angular.extend({}, this)));
2222
}
23-
}
23+
}

0 commit comments

Comments
 (0)