Skip to content

Commit b28e649

Browse files
committed
Migrate from JSHint to ESLint (as jQuery Core has)
The "jquery" ESLint config is more strict than what we had here in JSHint so some linting violations had to be fixed as well.
1 parent 420c8a7 commit b28e649

11 files changed

+35
-40
lines changed

.eslintrc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "eslint-config-jquery",
3+
"root": true,
4+
"env": {
5+
"node": true
6+
}
7+
}

.jshintrc

Lines changed: 0 additions & 5 deletions
This file was deleted.

.jshintrc-common

Lines changed: 0 additions & 12 deletions
This file was deleted.

Gruntfile.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,23 @@ module.exports = function( grunt ) {
1919
to: "<%= grunt.template.today('yyyy') %>"
2020
}
2121
]
22-
},
22+
}
2323
},
2424
qunit: {
2525
all: [ "test/**/*.html" ]
2626
},
27-
jshint: {
27+
eslint: {
28+
options: {
29+
30+
// See https://github.com/sindresorhus/grunt-eslint/issues/119
31+
quiet: true
32+
},
2833
all: {
2934
src: [ "Gruntfile.js", "src/**/*.js", "test/**/*.js" ]
30-
},
31-
options: {
32-
jshintrc: true
3335
}
3436
},
3537
watch: {
36-
files: [ "<%= jshint.all.src %>" ],
38+
files: [ "<%= eslint.all.src %>" ],
3739
tasks: [ "lint", "qunit" ]
3840
},
3941
uglify: {
@@ -55,7 +57,7 @@ module.exports = function( grunt ) {
5557
banner: "/*! jQuery requestAnimationFrame - <%= pkg.version %> - " +
5658
"<%= grunt.template.today('yyyy-mm-dd') %>\n" +
5759
"<%= pkg.homepage ? '* ' + pkg.homepage + '\\n' : '' %>" +
58-
" * Copyright (c) <%= grunt.template.today('yyyy') %> " +
60+
" * Copyright (c) <%= grunt.template.today('yyyy') %> " +
5961
"<%= pkg.author.name %>; Licensed <%= pkg.license %> */"
6062
}
6163
}
@@ -65,6 +67,6 @@ module.exports = function( grunt ) {
6567
require( "load-grunt-tasks" )( grunt );
6668

6769
// Default task.
68-
grunt.registerTask( "default", [ "jshint", "qunit", "replace", "uglify" ] );
70+
grunt.registerTask( "default", [ "eslint", "qunit", "replace", "uglify" ] );
6971

7072
};

dist/jquery.requestanimationframe.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Licensed under the MIT license.
88
*/
99
// UMD factory https://github.com/umdjs/umd/blob/master/jqueryPlugin.js
10-
( function ( factory ) {
10+
( function( factory ) {
1111
if ( typeof define === "function" && define.amd ) {
1212

1313
// AMD. Register as an anonymous module.
@@ -17,7 +17,7 @@
1717
// Browser globals
1818
factory( jQuery );
1919
}
20-
}( function ( jQuery ) {
20+
} )( function( jQuery ) {
2121

2222
if ( Number( jQuery.fn.jquery.split( "." )[ 0 ] ) >= 3 ) {
2323
if ( window.console && window.console.warn ) {
@@ -49,4 +49,4 @@ if ( window.requestAnimationFrame ) {
4949
};
5050
}
5151

52-
} ) );
52+
} );

dist/jquery.requestanimationframe.min.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@
3232
"license": "MIT",
3333
"dependencies": {},
3434
"devDependencies": {
35+
"eslint-config-jquery": "1.0.0",
3536
"grunt": "1.0.1",
3637
"grunt-cli": "1.2.0",
37-
"grunt-contrib-jshint": "1.0.0",
3838
"grunt-contrib-qunit": "1.2.0",
3939
"grunt-contrib-uglify": "2.0.0",
40+
"grunt-eslint": "19.0.0",
4041
"grunt-text-replace": "0.4.0",
4142
"jquery": "1.11.3",
4243
"load-grunt-tasks": "3.5.2",

src/.jshintrc renamed to src/.eslintrc.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
2-
"extends": "../.jshintrc-common",
3-
2+
"env": {
3+
"browser": true,
4+
"node": false
5+
},
46
"globals": {
57
"window": true,
68
"jQuery": true,

src/jquery.requestanimationframe.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Licensed under the MIT license.
88
*/
99
// UMD factory https://github.com/umdjs/umd/blob/master/jqueryPlugin.js
10-
( function ( factory ) {
10+
( function( factory ) {
1111
if ( typeof define === "function" && define.amd ) {
1212

1313
// AMD. Register as an anonymous module.
@@ -17,7 +17,7 @@
1717
// Browser globals
1818
factory( jQuery );
1919
}
20-
}( function ( jQuery ) {
20+
} )( function( jQuery ) {
2121

2222
if ( Number( jQuery.fn.jquery.split( "." )[ 0 ] ) >= 3 ) {
2323
if ( window.console && window.console.warn ) {
@@ -49,4 +49,4 @@ if ( window.requestAnimationFrame ) {
4949
};
5050
}
5151

52-
} ) );
52+
} );

test/.jshintrc renamed to test/.eslintrc.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"extends": "../.jshintrc-common",
3-
4-
"browser": true,
5-
2+
"env": {
3+
"browser": true,
4+
"node": false
5+
},
66
"globals": {
77
"jQuery": false,
88
"QUnit": false

test/jquery.requestanimationframe_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
} );
1818
} );
1919

20-
}() );
20+
} )();

0 commit comments

Comments
 (0)