remove globals and warn for unused variables

This commit is contained in:
Hendrik Leppelsack 2016-03-19 12:02:13 +01:00
parent aef99a78b9
commit 65e2348b14
39 changed files with 94 additions and 50 deletions

View File

@ -1,12 +1,10 @@
{
"extends": "eslint:recommended",
"rules": {
"no-undef": "off",
"no-unused-vars": "off",
"eqeqeq": ["warn", "smart"],
"no-console": "warn",
"no-loop-func": "warn",
"no-unused-vars": "warn",
"block-spacing": "error",
"camelcase": "error",
@ -20,6 +18,17 @@
"quotes": ["error", "single", "avoid-escape"],
"semi": "error",
"space-before-blocks": "error"
},
"env": {
"browser": true,
"jquery": true
},
"globals": {
"angular": false,
"vCard": false,
"_": false,
"OC": false,
"t": false,
"dav": false
}
}

View File

@ -1,4 +1,5 @@
app.controller('addressbookCtrl', function($scope, AddressBookService) {
angular.module('contactsApp')
.controller('addressbookCtrl', function($scope, AddressBookService) {
var ctrl = this;
ctrl.urlBase = window.location.protocol + '//' + window.location.host;

View File

@ -1,4 +1,5 @@
app.directive('addressbook', function() {
angular.module('contactsApp')
.directive('addressbook', function() {
return {
restrict: 'A', // has to be an attribute to work with core css
scope: {},

View File

@ -1,4 +1,5 @@
app.controller('addressbooklistCtrl', function($scope, AddressBookService, SettingsService) {
angular.module('contactsApp')
.controller('addressbooklistCtrl', function($scope, AddressBookService, SettingsService) {
var ctrl = this;
ctrl.loading = true;

View File

@ -1,4 +1,5 @@
app.directive('addressbooklist', function() {
angular.module('contactsApp')
.directive('addressbooklist', function() {
return {
restrict: 'EA', // has to be an attribute to work with core css
scope: {},

View File

@ -1,4 +1,5 @@
app.controller('contactCtrl', function($route, $routeParams) {
angular.module('contactsApp')
.controller('contactCtrl', function($route, $routeParams) {
var ctrl = this;
ctrl.openContact = function() {

View File

@ -1,4 +1,5 @@
app.directive('contact', function() {
angular.module('contactsApp')
.directive('contact', function() {
return {
scope: {},
controller: 'contactCtrl',

View File

@ -1,4 +1,5 @@
app.controller('contactdetailsCtrl', function(ContactService, AddressBookService, vCardPropertiesService, $routeParams, $scope) {
angular.module('contactsApp')
.controller('contactdetailsCtrl', function(ContactService, AddressBookService, vCardPropertiesService, $routeParams, $scope) {
var ctrl = this;
ctrl.loading = true;

View File

@ -1,4 +1,5 @@
app.directive('contactdetails', function() {
angular.module('contactsApp')
.directive('contactdetails', function() {
return {
priority: 1,
scope: {},

View File

@ -1,4 +1,5 @@
app.controller('contactlistCtrl', function($scope, $filter, $route, $routeParams, ContactService, vCardPropertiesService, SearchService) {
angular.module('contactsApp')
.controller('contactlistCtrl', function($scope, $filter, $route, $routeParams, ContactService, vCardPropertiesService, SearchService) {
var ctrl = this;
ctrl.routeParams = $routeParams;

View File

@ -1,4 +1,5 @@
app.directive('contactlist', function() {
angular.module('contactsApp')
.directive('contactlist', function() {
return {
priority: 1,
scope: {},

View File

@ -1,4 +1,5 @@
app.directive('datepicker', function() {
angular.module('contactsApp')
.directive('datepicker', function() {
return {
restrict: 'A',
require : 'ngModel',

View File

@ -1,4 +1,5 @@
app.controller('detailsItemCtrl', function($templateRequest, vCardPropertiesService, ContactService) {
angular.module('contactsApp')
.controller('detailsItemCtrl', function($templateRequest, vCardPropertiesService, ContactService) {
var ctrl = this;
ctrl.meta = vCardPropertiesService.getMeta(ctrl.name);

View File

@ -1,4 +1,5 @@
app.directive('detailsitem', ['$compile', function($compile) {
angular.module('contactsApp')
.directive('detailsitem', ['$compile', function($compile) {
return {
scope: {},
controller: 'detailsItemCtrl',

View File

@ -1,4 +1,5 @@
app.directive('focusExpression', function ($timeout) {
angular.module('contactsApp')
.directive('focusExpression', function ($timeout) {
return {
restrict: 'A',
link: {

View File

@ -1,3 +1,4 @@
app.controller('groupCtrl', function() {
angular.module('contactsApp')
.controller('groupCtrl', function() {
var ctrl = this;
});

View File

@ -1,4 +1,5 @@
app.directive('group', function() {
angular.module('contactsApp')
.directive('group', function() {
return {
restrict: 'A', // has to be an attribute to work with core css
scope: {},

View File

@ -1,4 +1,5 @@
app.controller('grouplistCtrl', function($scope, ContactService, SearchService, $routeParams) {
angular.module('contactsApp')
.controller('grouplistCtrl', function($scope, ContactService, SearchService, $routeParams) {
var ctrl = this;
var initialGroups = [t('contacts', 'All contacts'), t('contacts', 'Not grouped')];

View File

@ -1,4 +1,5 @@
app.directive('grouplist', function() {
angular.module('contactsApp')
.directive('grouplist', function() {
return {
restrict: 'EA', // has to be an attribute to work with core css
scope: {},

View File

@ -1,4 +1,5 @@
app.directive('groupModel', function($filter) {
angular.module('contactsApp')
.directive('groupModel', function($filter) {
return{
restrict: 'A',
require: 'ngModel',

View File

@ -1,4 +1,5 @@
app.directive('telModel', function() {
angular.module('contactsApp')
.directive('telModel', function() {
return{
restrict: 'A',
require: 'ngModel',

View File

@ -1,5 +1,6 @@
app.filter('JSON2vCard', function() {
angular.module('contactsApp')
.filter('JSON2vCard', function() {
return function(input) {
return vCard.generate(input);
};
});
});

View File

@ -1,4 +1,5 @@
app.filter('contactColor', function() {
angular.module('contactsApp')
.filter('contactColor', function() {
return function(input) {
var colors = [
'#001f3f',

View File

@ -1,4 +1,5 @@
app.filter('contactGroupFilter', function() {
angular.module('contactsApp')
.filter('contactGroupFilter', function() {
'use strict';
return function (contacts, group) {
if (typeof contacts === 'undefined') {

View File

@ -1,4 +1,5 @@
app.filter('fieldFilter', function() {
angular.module('contactsApp')
.filter('fieldFilter', function() {
'use strict';
return function (fields, contact) {
if (typeof fields === 'undefined') {

View File

@ -1,4 +1,5 @@
app.filter('firstCharacter', function() {
angular.module('contactsApp')
.filter('firstCharacter', function() {
return function(input) {
return input.charAt(0);
};

View File

@ -1,4 +1,5 @@
app.filter('orderDetailItems', function(vCardPropertiesService) {
angular.module('contactsApp')
.filter('orderDetailItems', function(vCardPropertiesService) {
'use strict';
return function(items, field, reverse) {

View File

@ -1,4 +1,5 @@
app.filter('toArray', function() {
angular.module('contactsApp')
.filter('toArray', function() {
return function(obj) {
if (!(obj instanceof Object)) return obj;
return _.map(obj, function(val, key) {

View File

@ -1,5 +1,6 @@
app.filter('vCard2JSON', function() {
angular.module('contactsApp')
.filter('vCard2JSON', function() {
return function(input) {
return vCard.parse(input);
};
});
});

View File

@ -8,9 +8,8 @@
* @copyright Hendrik Leppelsack 2015
*/
var app = angular.module('contactsApp', ['uuid4', 'angular-cache', 'ngRoute', 'ui.bootstrap', 'ui.select', 'ngSanitize']);
app.config(function($routeProvider) {
angular.module('contactsApp', ['uuid4', 'angular-cache', 'ngRoute', 'ui.bootstrap', 'ui.select', 'ngSanitize'])
.config(function($routeProvider) {
$routeProvider.when('/:gid', {
template: '<contactdetails></contactdetails>'

View File

@ -1,4 +1,5 @@
app.factory('AddressBook', function()
angular.module('contactsApp')
.factory('AddressBook', function()
{
return function AddressBook(data) {
angular.extend(this, {

View File

@ -1,4 +1,5 @@
app.factory('Contact', function($filter) {
angular.module('contactsApp')
.factory('Contact', function($filter) {
return function Contact(addressBook, vCard) {
angular.extend(this, {

View File

@ -1,4 +1,5 @@
app.factory('AddressBookService', function(DavClient, DavService, SettingsService, AddressBook, Contact) {
angular.module('contactsApp')
.factory('AddressBookService', function(DavClient, DavService, SettingsService, AddressBook, Contact) {
var addressBooks = [];

View File

@ -1,9 +1,9 @@
var contacts;
app.service('ContactService', function(DavClient, AddressBookService, Contact, $q, CacheFactory, uuid4) {
angular.module('contactsApp')
.service('ContactService', function(DavClient, AddressBookService, Contact, $q, CacheFactory, uuid4) {
var cacheFilled = false;
contacts = CacheFactory('contacts');
var contacts = CacheFactory('contacts');
var observerCallbacks = [];
@ -29,7 +29,7 @@ app.service('ContactService', function(DavClient, AddressBookService, Contact, $
promises.push(
AddressBookService.sync(addressBook).then(function(addressBook) {
for(var i in addressBook.objects) {
contact = new Contact(addressBook, addressBook.objects[i]);
var contact = new Contact(addressBook, addressBook.objects[i]);
contacts.put(contact.uid(), contact);
}
})

View File

@ -1,6 +1,7 @@
app.service('DavClient', function() {
angular.module('contactsApp')
.service('DavClient', function() {
var xhr = new dav.transport.Basic(
new dav.Credentials()
);
return new dav.Client(xhr);
});
});

View File

@ -1,4 +1,5 @@
app.service('DavService', function(DavClient) {
angular.module('contactsApp')
.service('DavService', function(DavClient) {
return DavClient.createAccount({
server: OC.linkToRemoteBase('dav/addressbooks'),
accountType: 'carddav',

View File

@ -1,4 +1,5 @@
app.service('SearchService', function() {
angular.module('contactsApp')
.service('SearchService', function() {
var searchTerm = '';
var observerCallbacks = [];

View File

@ -1,4 +1,5 @@
app.service('SettingsService', function() {
angular.module('contactsApp')
.service('SettingsService', function() {
var settings = {
addressBooks: [
'testAddr'

View File

@ -1,4 +1,5 @@
app.service('vCardPropertiesService', function() {
angular.module('contactsApp')
.service('vCardPropertiesService', function() {
/**
* map vCard attributes to internal attributes
*