Skip to content

Commit 91e06e9

Browse files
committed
Build: update grunt-jscs-checker and pass with the new rules
Conflicts: build/tasks/build.js src/ajax/xhr.js src/attributes/classes.js src/attributes/prop.js src/attributes/val.js src/core/init.js src/core/ready.js src/css.js src/css/curCSS.js src/css/defaultDisplay.js src/data.js src/data/var/dataPriv.js src/data/var/dataUser.js src/dimensions.js src/effects.js src/event.js src/manipulation.js src/offset.js src/queue.js src/selector-native.js test/data/testrunner.js
1 parent 511eb15 commit 91e06e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+379
-168
lines changed

Gruntfile.js

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module.exports = function( grunt ) {
1919
grunt.initConfig({
2020
pkg: grunt.file.readJSON( "package.json" ),
2121
dst: readOptionalJSON( "dist/.destination.json" ),
22-
compare_size: {
22+
"compare_size": {
2323
files: [ "dist/jquery.js", "dist/jquery.min.js" ],
2424
options: {
2525
compress: {
@@ -92,13 +92,31 @@ module.exports = function( grunt ) {
9292
src: "src/**/*.js",
9393
gruntfile: "Gruntfile.js",
9494

95-
// Right know, check only test helpers
96-
test: [ "test/data/testrunner.js", "test/data/testinit.js" ],
97-
release: "build/*.js",
95+
// Right now, check only test helpers
96+
test: [ "test/data/testrunner.js" ],
97+
release: [ "build/*.js", "!build/release-notes.js" ],
9898
tasks: "build/tasks/*.js"
9999
},
100100
testswarm: {
101-
tests: "ajax attributes callbacks core css data deferred dimensions effects event manipulation offset queue selector serialize support traversing".split( " " )
101+
tests: [
102+
"ajax",
103+
"attributes",
104+
"callbacks",
105+
"core",
106+
"css",
107+
"data",
108+
"deferred",
109+
"dimensions",
110+
"effects",
111+
"event",
112+
"manipulation",
113+
"offset",
114+
"queue",
115+
"selector",
116+
"serialize",
117+
"support",
118+
"traversing"
119+
]
102120
},
103121
watch: {
104122
files: [ "<%= jshint.all.src %>" ],
@@ -115,13 +133,13 @@ module.exports = function( grunt ) {
115133
sourceMappingURL: "jquery.min.map",
116134
report: "min",
117135
beautify: {
118-
ascii_only: true
136+
"ascii_only": true
119137
},
120138
banner: "/*! jQuery v<%= pkg.version %> | " +
121139
"(c) 2005, <%= grunt.template.today('yyyy') %> jQuery Foundation, Inc. | " +
122140
"jquery.org/license */",
123141
compress: {
124-
hoist_funs: false,
142+
"hoist_funs": false,
125143
loops: false,
126144
unused: false
127145
}

build/release-notes.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ http.request({
1616
host: "bugs.jquery.com",
1717
port: 80,
1818
method: "GET",
19-
path: "/query?status=closed&resolution=fixed&max=400&component=!web&order=component&milestone=" + version
19+
path: "/query?status=closed&resolution=fixed&max=400&" +
20+
"component=!web&order=component&milestone=" + version
2021
}, function( res ) {
2122
var data = [];
2223

build/release.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ module.exports = function( Release ) {
8888

8989
var archiver = require( "archiver" )( "zip" ),
9090
md5file = cdnFolder + "/" + cdn + "-md5.txt",
91-
output = fs.createWriteStream( cdnFolder + "/" + cdn + "-jquery-" + Release.newVersion + ".zip" );
91+
output = fs.createWriteStream(
92+
cdnFolder + "/" + cdn + "-jquery-" + Release.newVersion + ".zip"
93+
);
9294

9395
output.on( "error", function( err ) {
9496
throw err;

build/tasks/build.js

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/**
22
* Special concat/build task to handle various jQuery build requirements
3-
* Concats AMD modules, removes their definitions, and includes/excludes specified modules
3+
* Concats AMD modules, removes their definitions,
4+
* and includes/excludes specified modules
45
*/
56

67
module.exports = function( grunt ) {
@@ -35,7 +36,8 @@ module.exports = function( grunt ) {
3536
/**
3637
* Strip all definitions generated by requirejs
3738
* Convert "var" modules to var declarations
38-
* "var module" means the module only contains a return statement that should be converted to a var declaration
39+
* "var module" means the module only contains a return
40+
* statement that should be converted to a var declaration
3941
* This is indicated by including the file in any "var" folder
4042
* @param {String} name
4143
* @param {String} path
@@ -98,7 +100,8 @@ module.exports = function( grunt ) {
98100

99101
grunt.registerMultiTask(
100102
"build",
101-
"Concatenate source, remove sub AMD definitions, (include/exclude modules with +/- flags), embed date/version",
103+
"Concatenate source, remove sub AMD definitions, " +
104+
"(include/exclude modules with +/- flags), embed date/version",
102105
function() {
103106
var flag, index,
104107
done = this.async(),
@@ -113,15 +116,18 @@ module.exports = function( grunt ) {
113116
/**
114117
* Recursively calls the excluder to remove on all modules in the list
115118
* @param {Array} list
116-
* @param {String} [prepend] Prepend this to the module name. Indicates we're walking a directory
119+
* @param {String} [prepend] Prepend this to the module name.
120+
* Indicates we're walking a directory
117121
*/
118122
excludeList = function( list, prepend ) {
119123
if ( list ) {
120124
prepend = prepend ? prepend + "/" : "";
121125
list.forEach(function( module ) {
122126
// Exclude var modules as well
123127
if ( module === "var" ) {
124-
excludeList( fs.readdirSync( srcFolder + prepend + module ), prepend + module );
128+
excludeList(
129+
fs.readdirSync( srcFolder + prepend + module ), prepend + module
130+
);
125131
return;
126132
}
127133
if ( prepend ) {
@@ -143,7 +149,9 @@ module.exports = function( grunt ) {
143149
},
144150
/**
145151
* Adds the specified module to the excluded or included list, depending on the flag
146-
* @param {String} flag A module path relative to the src directory starting with + or - to indicate whether it should included or excluded
152+
* @param {String} flag A module path relative to
153+
* the src directory starting with + or - to indicate
154+
* whether it should included or excluded
147155
*/
148156
excluder = function( flag ) {
149157
var m = /^(\+|\-|)([\w\/-]+)$/.exec( flag ),
@@ -162,7 +170,7 @@ module.exports = function( grunt ) {
162170
// It's fine if the directory is not there
163171
try {
164172
excludeList( fs.readdirSync( srcFolder + module ), module );
165-
} catch( e ) {
173+
} catch ( e ) {
166174
grunt.verbose.writeln( e );
167175
}
168176
}
@@ -192,8 +200,10 @@ module.exports = function( grunt ) {
192200
// * none (implicit exclude)
193201
// *:* all (implicit include)
194202
// *:*:-css all except css and dependents (explicit > implicit)
195-
// *:*:-css:+effects same (excludes effects because explicit include is trumped by explicit exclude of dependency)
196-
// *:+effects none except effects and its dependencies (explicit include trumps implicit exclude of dependency)
203+
// *:*:-css:+effects same (excludes effects because explicit include is
204+
// trumped by explicit exclude of dependency)
205+
// *:+effects none except effects and its dependencies
206+
// (explicit include trumps implicit exclude of dependency)
197207
delete flags[ "*" ];
198208
for ( flag in flags ) {
199209
excluder( flag );
@@ -239,7 +249,9 @@ module.exports = function( grunt ) {
239249
// Turn off opt-in if necessary
240250
if ( !optIn ) {
241251
// Overwrite the default inclusions with the explicit ones provided
242-
config.rawText.jquery = "define([" + (included.length ? included.join(",") : "") + "]);";
252+
config.rawText.jquery = "define([" +
253+
(included.length ? included.join(",") : "") +
254+
"]);";
243255
}
244256

245257
// Trace dependencies and concatenate files

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"grunt-contrib-uglify": "0.5.0",
4040
"grunt-contrib-watch": "0.6.1",
4141
"grunt-git-authors": "1.2.0",
42-
"grunt-jscs-checker": "0.4.1",
42+
"grunt-jscs-checker": "0.6.1",
4343
"grunt-jsonlint": "1.0.4",
4444
"grunt-npmcopy": "0.1.0",
4545
"gzip-js": "0.3.2",

src/ajax.js

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ var
4949
// a field from window.location if document.domain has been set
5050
try {
5151
ajaxLocation = location.href;
52-
} catch( e ) {
52+
} catch ( e ) {
5353
// Use the href attribute of an A element
5454
// since IE will modify it given document.location
5555
ajaxLocation = document.createElement( "a" );
@@ -103,7 +103,9 @@ function inspectPrefiltersOrTransports( structure, options, originalOptions, jqX
103103
inspected[ dataType ] = true;
104104
jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
105105
var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
106-
if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
106+
if ( typeof dataTypeOrTransport === "string" &&
107+
!seekingTransport && !inspected[ dataTypeOrTransport ] ) {
108+
107109
options.dataTypes.unshift( dataTypeOrTransport );
108110
inspect( dataTypeOrTransport );
109111
return false;
@@ -275,7 +277,10 @@ function ajaxConvert( s, response, jqXHR, isSuccess ) {
275277
try {
276278
response = conv( response );
277279
} catch ( e ) {
278-
return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
280+
return {
281+
state: "parsererror",
282+
error: conv ? e : "No conversion from " + prev + " to " + current
283+
};
279284
}
280285
}
281286
}
@@ -412,9 +417,10 @@ jQuery.extend({
412417
// Callbacks context
413418
callbackContext = s.context || s,
414419
// Context for global events is callbackContext if it is a DOM node or jQuery collection
415-
globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
416-
jQuery( callbackContext ) :
417-
jQuery.event,
420+
globalEventContext = s.context &&
421+
( callbackContext.nodeType || callbackContext.jquery ) ?
422+
jQuery( callbackContext ) :
423+
jQuery.event,
418424
// Deferreds
419425
deferred = jQuery.Deferred(),
420426
completeDeferred = jQuery.Callbacks("once memory"),
@@ -506,7 +512,9 @@ jQuery.extend({
506512
// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
507513
// Handle falsy url in the settings object (#10093: consistency with old signature)
508514
// We also use the url parameter if available
509-
s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
515+
s.url = ( ( url || s.url || ajaxLocation ) + "" )
516+
.replace( rhash, "" )
517+
.replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
510518

511519
// Alias method option to type as per ticket #12004
512520
s.type = options.method || options.type || s.method || s.type;
@@ -597,7 +605,8 @@ jQuery.extend({
597605
jqXHR.setRequestHeader(
598606
"Accept",
599607
s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
600-
s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
608+
s.accepts[ s.dataTypes[0] ] +
609+
( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
601610
s.accepts[ "*" ]
602611
);
603612

@@ -607,7 +616,9 @@ jQuery.extend({
607616
}
608617

609618
// Allow custom headers/mimetypes and early abort
610-
if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
619+
if ( s.beforeSend &&
620+
( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
621+
611622
// Abort if not done already and return
612623
return jqXHR.abort();
613624
}

src/ajax/jsonp.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
2424
var callbackName, overwritten, responseContainer,
2525
jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
2626
"url" :
27-
typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
27+
typeof s.data === "string" &&
28+
!( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") &&
29+
rjsonp.test( s.data ) && "data"
2830
);
2931

3032
// Handle iff the expected data type is "jsonp" or we have a parameter to set

src/ajax/parseXML.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jQuery.parseXML = function( data ) {
1717
xml.async = "false";
1818
xml.loadXML( data );
1919
}
20-
} catch( e ) {
20+
} catch ( e ) {
2121
xml = undefined;
2222
}
2323
if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {

src/ajax/script.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ define([
66
// Install script dataType
77
jQuery.ajaxSetup({
88
accepts: {
9-
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
9+
script: "text/javascript, application/javascript, " +
10+
"application/ecmascript, application/x-ecmascript"
1011
},
1112
contents: {
1213
script: /(?:java|ecma)script/

src/ajax/xhr.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,13 @@ if ( xhrSupported ) {
6060
id = ++xhrId;
6161

6262
// Open the socket
63-
xhr.open( options.type, options.url, options.async, options.username, options.password );
63+
xhr.open(
64+
options.type,
65+
options.url,
66+
options.async,
67+
options.username,
68+
options.password
69+
);
6470

6571
// Apply custom fields if provided
6672
if ( options.xhrFields ) {
@@ -132,7 +138,7 @@ if ( xhrSupported ) {
132138
// statusText for faulty cross-domain requests
133139
try {
134140
statusText = xhr.statusText;
135-
} catch( e ) {
141+
} catch ( e ) {
136142
// We normalize with Webkit giving an empty statusText
137143
statusText = "";
138144
}
@@ -184,13 +190,13 @@ if ( xhrSupported ) {
184190
function createStandardXHR() {
185191
try {
186192
return new window.XMLHttpRequest();
187-
} catch( e ) {}
193+
} catch ( e ) {}
188194
}
189195

190196
function createActiveXHR() {
191197
try {
192198
return new window.ActiveXObject( "Microsoft.XMLHTTP" );
193-
} catch( e ) {}
199+
} catch ( e ) {}
194200
}
195201

196202
});

0 commit comments

Comments
 (0)