Skip to content

Commit

Permalink
Various updates
Browse files Browse the repository at this point in the history
* Added `.editorconfig`
* Removed `jshint` and replaced with `eslint`
* Added `.eslintrc`
* Removed `uglify` and task to create minified version of jScroll source since this can be done on the user end, and it will also prevent conflicts in PRs
* Removed `jquery.jscroll.min.js`
  • Loading branch information
pklauzinski committed May 31, 2017
1 parent 4232f01 commit fe3e5f2
Show file tree
Hide file tree
Showing 7 changed files with 151 additions and 66 deletions.
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = false
128 changes: 128 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
{
"env": {
"browser": true
},
"globals": {
"jQuery": true
},
"rules": {
"curly": [
2,
"all"
],
"eqeqeq": 2,
"no-eq-null": 2,
"guard-for-in": 2,
"no-unused-vars": [
2,
{
"args": "none"
}
],
"strict": [
2,
"safe"
],
"no-use-before-define": [
2,
{
"functions": false,
"variables": false
}
],
"operator-linebreak": [
2,
"after"
],
"max-len": [
2,
{
"code": 200,
"tabWidth": 4,
"ignoreComments": true
}
],
"indent": [
2,
4,
{
"SwitchCase": 1
}
],
"quotes": [
2,
"single"
],
"no-multi-str": 2,
"no-mixed-spaces-and-tabs": 2,
"no-trailing-spaces": 2,
"space-unary-ops": [
2,
{
"nonwords": false,
"overrides": {}
}
],
"brace-style": [
2,
"1tbs",
{
"allowSingleLine": true
}
],
"comma-spacing": [
2,
{
"before": false,
"after": true
}
],
"comma-dangle": [
2,
"never"
],
"comma-style": [
"error",
"last"
],
"keyword-spacing": [
2,
{}
],
"space-infix-ops": 2,
"space-before-blocks": [
2,
"always"
],
"space-before-function-paren": [
2,
{
"anonymous": "ignore",
"named": "never"
}
],
"array-bracket-spacing": [
2,
"never"
],
"space-in-parens": [
2,
"never"
],
"no-multiple-empty-lines": 2,
"no-with": 2,
"no-spaced-func": 2,
"key-spacing": [
2,
{
"beforeColon": false,
"afterColon": true
}
],
"dot-notation": 2,
"semi": [
2,
"always"
]
}
}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

.idea/
.project
.settings/
Expand Down
47 changes: 6 additions & 41 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,52 +7,17 @@ module.exports = function(grunt) {
pkg: grunt.file.readJSON('package.json'),

/**
* https://github.com/gruntjs/grunt-contrib-jshint
* https://github.com/gyandeeps/gruntify-eslint
*/
jshint: {
eslint: {
options: {
curly: true,
eqeqeq: true,
eqnull: true,
browser: true,
newcap: false,
es3: true,
forin: true,
indent: 4,
unused: 'vars',
strict: true,
trailing: true,
quotmark: 'single',
latedef: true,
globals: {
jQuery: true
}
configFile: '.eslintrc'
},
files: {
src: ['Gruntfile.js', 'jquery.jscroll.js']
}
},

/**
* https://github.com/gruntjs/grunt-contrib-uglify
*/
uglify: {
options: {
preserveComments: 'some'
},
jscroll: {
files: {
'jquery.jscroll.min.js': [
'jquery.jscroll.js'
]
}
}
src: ['Gruntfile.js', 'jquery.jscroll.js']
}

});

grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');

grunt.registerTask('default', ['jshint', 'uglify']);
grunt.loadNpmTasks('gruntify-eslint');
grunt.registerTask('default', ['eslint']);
};
14 changes: 7 additions & 7 deletions jquery.jscroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @copyright 2011-2017, Philip Klauzinski
* @license Dual licensed under the MIT and GPL Version 2 licenses.
* @author Philip Klauzinski (http://webtopian.com)
* @version 2.3.7
* @version 2.3.8
* @requires jQuery v1.4.3+
* @preserve
*/
Expand Down Expand Up @@ -121,9 +121,9 @@
}
if (_options.autoTrigger && (_options.autoTriggerUntil === false || _options.autoTriggerUntil > 0)) {
_nextWrap($next);
var scrollingBodyHeight = _$body.height() - $e.offset().top,
scrollingHeight = ($e.height() < scrollingBodyHeight) ? $e.height() : scrollingBodyHeight,
windowHeight = ($e.offset().top - _$window.scrollTop() > 0) ? _$window.height() - ($e.offset().top - $(window).scrollTop()) : _$window.height();
var scrollingBodyHeight = _$body.height() - $e.offset().top,
scrollingHeight = ($e.height() < scrollingBodyHeight) ? $e.height() : scrollingBodyHeight,
windowHeight = ($e.offset().top - _$window.scrollTop() > 0) ? _$window.height() - ($e.offset().top - $(window).scrollTop()) : _$window.height();
if (scrollingHeight <= windowHeight) {
_observe();
}
Expand Down Expand Up @@ -153,7 +153,7 @@
.children('.jscroll-added').last()
.html('<div class="jscroll-loading" id="jscroll-loading">' + _options.loadingHtml + '</div>')
.promise()
.done(function(){
.done(function() {
if (_options.loadingFunction) {
_options.loadingFunction();
}
Expand Down Expand Up @@ -214,13 +214,13 @@
$.fn.jscroll = function(m) {
return this.each(function() {
var $this = $(this),
data = $this.data('jscroll'), jscroll;
data = $this.data('jscroll');

// Instantiate jScroll on this element if it hasn't been already
if (data && data.initialized) {
return;
}
jscroll = new jScroll($this, m);
jScroll($this, m);
});
};

Expand Down
12 changes: 0 additions & 12 deletions jquery.jscroll.min.js

This file was deleted.

8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"name": "jscroll",
"version": "2.3.7",
"version": "2.3.8",
"description": "jQuery plugin for infinite scrolling / auto-paging.",
"main": "jquery.jscroll.js",
"scripts": {
"test": "grunt jshint",
"build": "grunt uglify"
"test": "grunt eslint"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -36,7 +35,6 @@
},
"devDependencies": {
"grunt": "^1.0.1",
"grunt-contrib-jshint": "^0.11.3",
"grunt-contrib-uglify": "^0.9.2"
"gruntify-eslint": "^3.1.0"
}
}

0 comments on commit fe3e5f2

Please sign in to comment.