Skip to content

Commit

Permalink
style(): move from jshint to eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
ajoslin committed Apr 14, 2015
1 parent 218605f commit ce06f6e
Show file tree
Hide file tree
Showing 63 changed files with 417 additions and 486 deletions.
1 change: 1 addition & 0 deletions .agignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
release
36 changes: 36 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"env": {
"browser": true
},
"globals": {
"ionic": true,
"IonicModule": true,
"angular": true,
"jqLite": true,
"forEach": true,
"isDefined": true,
"isNumber": true,
"isString": true,
"noop": true,
"extend": true,
"deprecated": true,
"cordova": true,
"DocumentTouch": true
},
"rules": {
"quotes": false,
"no-underscore-dangle": false,
"no-unused-expressions": false,
"curly": [2, "multi-line"],
"strict": false,
"no-use-before-define": false,
"eqeqeq": false,
"new-cap": [2, {"capIsNew": false}],
"dot-notation": [2, {"allowKeywords": false}],
"no-console": false,
"no-return-assign": false,
"no-shadow": false,
"comma-dangle": false,
"camelcase": [2, {"properties": "never"}]
}
}
3 changes: 0 additions & 3 deletions .jshintrc

This file was deleted.

17 changes: 6 additions & 11 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var concat = require('gulp-concat');
var footer = require('gulp-footer');
var gulpif = require('gulp-if');
var header = require('gulp-header');
var jshint = require('gulp-jshint');
var eslint = require('gulp-eslint');
var jscs = require('gulp-jscs');
var minifyCss = require('gulp-minify-css');
var rename = require('gulp-rename');
Expand Down Expand Up @@ -61,7 +61,7 @@ if (argv.dist) {

gulp.task('default', ['build']);
gulp.task('build', ['bundle', 'sass']);
gulp.task('validate', ['jshint', 'ddescribe-iit', 'karma']);
gulp.task('validate', ['eslint', 'ddescribe-iit', 'karma']);

var IS_WATCH = false;
gulp.task('watch', ['build'], function() {
Expand Down Expand Up @@ -135,16 +135,11 @@ gulp.task('jscs', function() {
}));
});

gulp.task('jshint', function() {
gulp.task('eslint', function() {
return gulp.src(['js/**/*.js'])
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter(require('jshint-summary')({
fileColCol: ',bold',
positionCol: ',bold',
codeCol: 'green,bold',
reasonCol: 'cyan'
})))
.pipe(jshint.reporter('fail'));
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failOnError());
});

gulp.task('ddescribe-iit', function() {
Expand Down
8 changes: 4 additions & 4 deletions js/angular/controller/infiniteScrollController.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ IonicModule
'$attrs',
'$element',
'$timeout',
function($scope, $attrs, $element, $timeout) {
function($scope, $attrs, $element, $timeout) {
var self = this;
self.isLoading = false;

Expand Down Expand Up @@ -92,7 +92,7 @@ IonicModule
self.getNativeMaxScroll = function() {
var maxValues = {
left: self.scrollEl.scrollWidth,
top: self.scrollEl.scrollHeight
top: self.scrollEl.scrollHeight
};
var computedStyle = window.getComputedStyle(self.scrollEl) || {};
return {
Expand All @@ -109,8 +109,8 @@ IonicModule

// determine pixel refresh distance based on % or value
function calculateMaxValue(maximum) {
distance = ($attrs.distance || '2.5%').trim();
isPercent = distance.indexOf('%') !== -1;
var distance = ($attrs.distance || '2.5%').trim();
var isPercent = distance.indexOf('%') !== -1;
return isPercent ?
maximum * (1 - parseFloat(distance) / 100) :
maximum - parseFloat(distance);
Expand Down
4 changes: 1 addition & 3 deletions js/angular/controller/listController.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/**
* @ngdoc service
* @name $ionicListDelegate
Expand Down Expand Up @@ -32,8 +31,7 @@
* }
* ```
*/
IonicModule
.service('$ionicListDelegate', ionic.DelegateService([
IonicModule.service('$ionicListDelegate', ionic.DelegateService([
/**
* @ngdoc method
* @name $ionicListDelegate#showReorder
Expand Down
2 changes: 1 addition & 1 deletion js/angular/controller/navBarController.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function($scope, $element, $attrs, $compile, $timeout, $ionicNavBarDelegate, $io
};


self.createHeaderBar = function(isActive, navBarClass) {
self.createHeaderBar = function(isActive) {
var containerEle = jqLite('<div class="nav-bar-block">');
ionic.DomUtil.cachedAttr(containerEle, 'nav-bar', isActive ? 'active' : 'cached');

Expand Down
5 changes: 2 additions & 3 deletions js/angular/controller/navViewController.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ function($scope, $element, $attrs, $compile, $controller, $ionicNavBarDelegate,
var activeEleId;
var navViewAttr = $ionicViewSwitcher.navViewAttr;
var disableRenderStartViewId, disableAnimation;
var transitionDuration, transitionTiming;

self.scope = $scope;
self.element = $element;
Expand All @@ -39,7 +38,7 @@ function($scope, $element, $attrs, $compile, $controller, $ionicNavBarDelegate,
// off the DOM so child directives can find it.
var parent = $element.parent().inheritedData('$uiView');
var parentViewName = ((parent && parent.state) ? parent.state.name : '');
if (navViewName.indexOf('@') < 0) navViewName = navViewName + '@' + parentViewName;
if (navViewName.indexOf('@') < 0) navViewName = navViewName + '@' + parentViewName;

var viewData = { name: navViewName, state: null };
$element.data('$uiView', viewData);
Expand Down Expand Up @@ -478,7 +477,7 @@ function($scope, $element, $attrs, $compile, $controller, $ionicNavBarDelegate,

function getAssociatedNavBarCtrl() {
if (navBarDelegate) {
for (var x=0; x < $ionicNavBarDelegate._instances.length; x++) {
for (var x = 0; x < $ionicNavBarDelegate._instances.length; x++) {
if ($ionicNavBarDelegate._instances[x].$$delegateHandle == navBarDelegate) {
return $ionicNavBarDelegate._instances[x];
}
Expand Down
36 changes: 17 additions & 19 deletions js/angular/controller/refresherController.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ IonicModule
'$element',
'$ionicBind',
'$timeout',
function($scope, $attrs, $element, $ionicBind, $timeout) {
function($scope, $attrs, $element, $ionicBind, $timeout) {
var self = this,
isDragging = false,
isOverscrolling = false,
Expand Down Expand Up @@ -51,22 +51,21 @@ IonicModule
dragOffset = 0;
isOverscrolling = false;
setScrollLock(false);
return true;
}
isDragging = false;
dragOffset = 0;
} else {
isDragging = false;
dragOffset = 0;

// the user has scroll far enough to trigger a refresh
if (lastOverscroll > ptrThreshold) {
start();
scrollTo(ptrThreshold, scrollTime);
// the user has scroll far enough to trigger a refresh
if (lastOverscroll > ptrThreshold) {
start();
scrollTo(ptrThreshold, scrollTime);

// the user has overscrolled but not far enough to trigger a refresh
} else {
scrollTo(0, scrollTime, deactivate);
isOverscrolling = false;
// the user has overscrolled but not far enough to trigger a refresh
} else {
scrollTo(0, scrollTime, deactivate);
isOverscrolling = false;
}
}
return true;
}

function handleTouchmove(e) {
Expand All @@ -91,15 +90,14 @@ IonicModule
}

if (isDragging) {
nativescroll(scrollParent,parseInt(deltaY - dragOffset, 10) * -1);
nativescroll(scrollParent, parseInt(deltaY - dragOffset, 10) * -1);
}

// if we're not at overscroll 0 yet, 0 out
if (lastOverscroll !== 0) {
overscroll(0);
}

return true;
return;

} else if (deltaY > 0 && scrollParent.scrollTop === 0 && !isOverscrolling) {
// starting overscroll, but drag started below scrollTop 0, so we need to offset the position
Expand Down Expand Up @@ -297,7 +295,7 @@ IonicModule
$element[0].classList.remove('invisible');
}

function hide() {
function hide() {
// showCallback
$element[0].classList.add('invisible');
}
Expand All @@ -310,6 +308,6 @@ IonicModule
// for testing
self.__handleTouchmove = handleTouchmove;
self.__getScrollChild = function() { return scrollChild; };
self.__getScrollParent= function() { return scrollParent; };
self.__getScrollParent = function() { return scrollParent; };
}
]);
2 changes: 1 addition & 1 deletion js/angular/controller/scrollController.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ function($scope,
var hash = $location.hash();
var elm = hash && $document[0].getElementById(hash);
if (!(hash && elm)) {
scrollView.scrollTo(0,0, !!shouldAnimate);
scrollView.scrollTo(0, 0, !!shouldAnimate);
return;
}
var curElm = elm;
Expand Down
6 changes: 3 additions & 3 deletions js/angular/controller/sideMenuController.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ IonicModule
'$ionicBody',
'$ionicHistory',
'$ionicScrollDelegate',
function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $ionicHistory, $ionicScrollDelegate) {
'IONIC_BACK_PRIORITY',
function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $ionicHistory, $ionicScrollDelegate, IONIC_BACK_PRIORITY) {
var self = this;
var rightShowing, leftShowing, isDragging;
var startX, lastX, offsetX, isAsideExposed;
Expand Down Expand Up @@ -142,7 +143,6 @@ function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $io
if (self.left && percentage >= 0) {
self.openAmount(self.left.width * p);
} else if (self.right && percentage < 0) {
var maxRight = self.right.width;
self.openAmount(self.right.width * p);
}

Expand Down Expand Up @@ -413,7 +413,7 @@ function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $io
if (isOpen) {
deregisterBackButtonAction = $ionicPlatform.registerBackButtonAction(
closeSideMenu,
PLATFORM_BACK_BUTTON_PRIORITY_SIDE_MENU
IONIC_BACK_PRIORITY.sideMenu
);
}
});
Expand Down
6 changes: 3 additions & 3 deletions js/angular/controller/spinnerController.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
};
},
t: 1
},{
}, {
fn: function() {
return {
an: 'y2',
Expand All @@ -238,7 +238,7 @@
};
},
t: 1
},{
}, {
fn: function() {
return {
an: STROKE_OPACITY,
Expand Down Expand Up @@ -278,7 +278,7 @@
};
},
t: 1
},{
}, {
fn: function() {
return {
an: STROKE_OPACITY,
Expand Down
3 changes: 1 addition & 2 deletions js/angular/controller/viewController.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ IonicModule
'$attrs',
'$compile',
'$rootScope',
'$ionicViewSwitcher',
function($scope, $element, $attrs, $compile, $rootScope, $ionicViewSwitcher) {
function($scope, $element, $attrs, $compile, $rootScope) {
var self = this;
var navElementHtml = {};
var navViewCtrl;
Expand Down
44 changes: 0 additions & 44 deletions js/angular/deprecated.js

This file was deleted.

Loading

0 comments on commit ce06f6e

Please sign in to comment.