Skip to content

Commit 81de13c

Browse files
committed
Lint js files
1 parent 5c99999 commit 81de13c

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

.eslintrc.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
module.exports = {
2-
extends: 'kswedberg/es5'
2+
extends: 'kswedberg/es5',
3+
rules: {
4+
'comma-dangle': ['warn', 'never']
5+
}
36
};

Gruntfile.js

+8-9
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ module.exports = function(grunt) {
55

66
marked.setOptions({
77
highlight: function(code, lang) {
8-
lang = lang || 'javascript';
9-
lang = hl.getLanguage(lang);
8+
var language = hl.getLanguage(lang || 'javascript');
109

11-
return hl.highlight(code, lang);
10+
return hl.highlight(code, language);
1211
},
1312
gfm: true
1413
});
@@ -40,11 +39,11 @@ module.exports = function(grunt) {
4039
var umdHead = grunt.file.read('lib/tmpl/umdhead.tpl');
4140
var umdFoot = grunt.file.read('lib/tmpl/umdfoot.tpl');
4241

43-
src = src
42+
var ret = src
4443
.replace('(function($) {', umdHead)
4544
.replace('})(jQuery);', umdFoot);
4645

47-
return src;
46+
return ret;
4847
}
4948
}
5049
},
@@ -54,7 +53,7 @@ module.exports = function(grunt) {
5453
'jquery.<%= pluginName %>.min.js': ['<%= concat.all.dest %>']
5554
},
5655
options: {
57-
banner: '<%= meta.banner %>',
56+
banner: '<%= meta.banner %>'
5857
// preserveComments: /\/\*[\s\S]*/
5958
}
6059
}
@@ -95,8 +94,8 @@ module.exports = function(grunt) {
9594
eslint: {
9695
target: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js'],
9796
options: {
98-
fix: true,
99-
configFile: '.eslintrc.js',
97+
fix: true
98+
// configFile: '.eslintrc.js',
10099
}
101100
},
102101
version: {
@@ -115,7 +114,7 @@ module.exports = function(grunt) {
115114
},
116115
package: {
117116
src: ['package.json']
118-
},
117+
}
119118
}
120119
});
121120

src/jquery.smooth-scroll.js

+10-12
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525

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

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

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

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

113113
$.fn.extend({
114114
scrollable: function(dir) {
@@ -123,9 +123,9 @@
123123
},
124124

125125
smoothScroll: function(options, extra) {
126-
options = options || {};
126+
var userOptions = options || {};
127127

128-
if (options === 'options') {
128+
if (userOptions === 'options') {
129129
if (!extra) {
130130
return this.first().data('ssOpts');
131131
}
@@ -138,7 +138,7 @@
138138
});
139139
}
140140

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

143143
var clickHandler = function(event) {
144144
var escapeSelector = function(str) {
@@ -324,12 +324,10 @@
324324

325325
$.smoothScroll.version = version;
326326
$.smoothScroll.filterPath = function(string) {
327-
string = string || '';
328-
329-
return string
330-
.replace(/^\//, '')
331-
.replace(/(?:index|default).[a-zA-Z]{3,4}$/, '')
332-
.replace(/\/$/, '');
327+
return (string || '')
328+
.replace(/^\//, '')
329+
.replace(/(?:index|default).[a-zA-Z]{3,4}$/, '')
330+
.replace(/\/$/, '');
333331
};
334332

335333
// default options

0 commit comments

Comments
 (0)