Skip to content

Commit

Permalink
Lint js files
Browse files Browse the repository at this point in the history
  • Loading branch information
kswedberg committed Aug 29, 2023
1 parent 5c99999 commit 81de13c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
5 changes: 4 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
module.exports = {
extends: 'kswedberg/es5'
extends: 'kswedberg/es5',
rules: {
'comma-dangle': ['warn', 'never']
}
};
17 changes: 8 additions & 9 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ module.exports = function(grunt) {

marked.setOptions({
highlight: function(code, lang) {
lang = lang || 'javascript';
lang = hl.getLanguage(lang);
var language = hl.getLanguage(lang || 'javascript');

return hl.highlight(code, lang);
return hl.highlight(code, language);
},
gfm: true
});
Expand Down Expand Up @@ -40,11 +39,11 @@ module.exports = function(grunt) {
var umdHead = grunt.file.read('lib/tmpl/umdhead.tpl');
var umdFoot = grunt.file.read('lib/tmpl/umdfoot.tpl');

src = src
var ret = src
.replace('(function($) {', umdHead)
.replace('})(jQuery);', umdFoot);

return src;
return ret;
}
}
},
Expand All @@ -54,7 +53,7 @@ module.exports = function(grunt) {
'jquery.<%= pluginName %>.min.js': ['<%= concat.all.dest %>']
},
options: {
banner: '<%= meta.banner %>',
banner: '<%= meta.banner %>'
// preserveComments: /\/\*[\s\S]*/
}
}
Expand Down Expand Up @@ -95,8 +94,8 @@ module.exports = function(grunt) {
eslint: {
target: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js'],
options: {
fix: true,
configFile: '.eslintrc.js',
fix: true
// configFile: '.eslintrc.js',
}
},
version: {
Expand All @@ -115,7 +114,7 @@ module.exports = function(grunt) {
},
package: {
src: ['package.json']
},
}
}
});

Expand Down
22 changes: 10 additions & 12 deletions src/jquery.smooth-scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@

// fn(opts) function to be called before scrolling occurs.
// `this` is the element(s) being scrolled
beforeScroll: function() {},
beforeScroll: function() {/* empty by default */},

// fn(opts) function to be called after scrolling occurs.
// `this` is the triggering element
afterScroll: function() {},
afterScroll: function() {/* empty by default */},

// easing name. jQuery comes with "swing" and "linear." For others, you'll need an easing plugin
// from jQuery UI or elsewhere
Expand Down Expand Up @@ -108,7 +108,7 @@
return scrollable;
};

var rRelative = /^([\-\+]=)(\d+)/;
var rRelative = /^([-+]=)(\d+)/;

$.fn.extend({
scrollable: function(dir) {
Expand All @@ -123,9 +123,9 @@
},

smoothScroll: function(options, extra) {
options = options || {};
var userOptions = options || {};

if (options === 'options') {
if (userOptions === 'options') {
if (!extra) {
return this.first().data('ssOpts');
}
Expand All @@ -138,7 +138,7 @@
});
}

var opts = $.extend({}, $.fn.smoothScroll.defaults, options);
var opts = $.extend({}, $.fn.smoothScroll.defaults, userOptions);

var clickHandler = function(event) {
var escapeSelector = function(str) {
Expand Down Expand Up @@ -324,12 +324,10 @@

$.smoothScroll.version = version;
$.smoothScroll.filterPath = function(string) {
string = string || '';

return string
.replace(/^\//, '')
.replace(/(?:index|default).[a-zA-Z]{3,4}$/, '')
.replace(/\/$/, '');
return (string || '')
.replace(/^\//, '')
.replace(/(?:index|default).[a-zA-Z]{3,4}$/, '')
.replace(/\/$/, '');
};

// default options
Expand Down

0 comments on commit 81de13c

Please sign in to comment.