Skip to content

Commit

Permalink
Build: update grunt-jscs-checker and pass with the new rules
Browse files Browse the repository at this point in the history
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
  • Loading branch information
timmywil committed Jul 17, 2014
1 parent 511eb15 commit 91e06e9
Show file tree
Hide file tree
Showing 41 changed files with 379 additions and 168 deletions.
32 changes: 25 additions & 7 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = function( grunt ) {
grunt.initConfig({
pkg: grunt.file.readJSON( "package.json" ),
dst: readOptionalJSON( "dist/.destination.json" ),
compare_size: {
"compare_size": {
files: [ "dist/jquery.js", "dist/jquery.min.js" ],
options: {
compress: {
Expand Down Expand Up @@ -92,13 +92,31 @@ module.exports = function( grunt ) {
src: "src/**/*.js",
gruntfile: "Gruntfile.js",

// Right know, check only test helpers
test: [ "test/data/testrunner.js", "test/data/testinit.js" ],
release: "build/*.js",
// Right now, check only test helpers
test: [ "test/data/testrunner.js" ],
release: [ "build/*.js", "!build/release-notes.js" ],
tasks: "build/tasks/*.js"
},
testswarm: {
tests: "ajax attributes callbacks core css data deferred dimensions effects event manipulation offset queue selector serialize support traversing".split( " " )
tests: [
"ajax",
"attributes",
"callbacks",
"core",
"css",
"data",
"deferred",
"dimensions",
"effects",
"event",
"manipulation",
"offset",
"queue",
"selector",
"serialize",
"support",
"traversing"
]
},
watch: {
files: [ "<%= jshint.all.src %>" ],
Expand All @@ -115,13 +133,13 @@ module.exports = function( grunt ) {
sourceMappingURL: "jquery.min.map",
report: "min",
beautify: {
ascii_only: true
"ascii_only": true
},
banner: "/*! jQuery v<%= pkg.version %> | " +
"(c) 2005, <%= grunt.template.today('yyyy') %> jQuery Foundation, Inc. | " +
"jquery.org/license */",
compress: {
hoist_funs: false,
"hoist_funs": false,
loops: false,
unused: false
}
Expand Down
3 changes: 2 additions & 1 deletion build/release-notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ http.request({
host: "bugs.jquery.com",
port: 80,
method: "GET",
path: "/query?status=closed&resolution=fixed&max=400&component=!web&order=component&milestone=" + version
path: "/query?status=closed&resolution=fixed&max=400&" +
"component=!web&order=component&milestone=" + version
}, function( res ) {
var data = [];

Expand Down
4 changes: 3 additions & 1 deletion build/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ module.exports = function( Release ) {

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

output.on( "error", function( err ) {
throw err;
Expand Down
32 changes: 22 additions & 10 deletions build/tasks/build.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
* Special concat/build task to handle various jQuery build requirements
* Concats AMD modules, removes their definitions, and includes/excludes specified modules
* Concats AMD modules, removes their definitions,
* and includes/excludes specified modules
*/

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

grunt.registerMultiTask(
"build",
"Concatenate source, remove sub AMD definitions, (include/exclude modules with +/- flags), embed date/version",
"Concatenate source, remove sub AMD definitions, " +
"(include/exclude modules with +/- flags), embed date/version",
function() {
var flag, index,
done = this.async(),
Expand All @@ -113,15 +116,18 @@ module.exports = function( grunt ) {
/**
* Recursively calls the excluder to remove on all modules in the list
* @param {Array} list
* @param {String} [prepend] Prepend this to the module name. Indicates we're walking a directory
* @param {String} [prepend] Prepend this to the module name.
* Indicates we're walking a directory
*/
excludeList = function( list, prepend ) {
if ( list ) {
prepend = prepend ? prepend + "/" : "";
list.forEach(function( module ) {
// Exclude var modules as well
if ( module === "var" ) {
excludeList( fs.readdirSync( srcFolder + prepend + module ), prepend + module );
excludeList(
fs.readdirSync( srcFolder + prepend + module ), prepend + module
);
return;
}
if ( prepend ) {
Expand All @@ -143,7 +149,9 @@ module.exports = function( grunt ) {
},
/**
* Adds the specified module to the excluded or included list, depending on the flag
* @param {String} flag A module path relative to the src directory starting with + or - to indicate whether it should included or excluded
* @param {String} flag A module path relative to
* the src directory starting with + or - to indicate
* whether it should included or excluded
*/
excluder = function( flag ) {
var m = /^(\+|\-|)([\w\/-]+)$/.exec( flag ),
Expand All @@ -162,7 +170,7 @@ module.exports = function( grunt ) {
// It's fine if the directory is not there
try {
excludeList( fs.readdirSync( srcFolder + module ), module );
} catch( e ) {
} catch ( e ) {
grunt.verbose.writeln( e );
}
}
Expand Down Expand Up @@ -192,8 +200,10 @@ module.exports = function( grunt ) {
// * none (implicit exclude)
// *:* all (implicit include)
// *:*:-css all except css and dependents (explicit > implicit)
// *:*:-css:+effects same (excludes effects because explicit include is trumped by explicit exclude of dependency)
// *:+effects none except effects and its dependencies (explicit include trumps implicit exclude of dependency)
// *:*:-css:+effects same (excludes effects because explicit include is
// trumped by explicit exclude of dependency)
// *:+effects none except effects and its dependencies
// (explicit include trumps implicit exclude of dependency)
delete flags[ "*" ];
for ( flag in flags ) {
excluder( flag );
Expand Down Expand Up @@ -239,7 +249,9 @@ module.exports = function( grunt ) {
// Turn off opt-in if necessary
if ( !optIn ) {
// Overwrite the default inclusions with the explicit ones provided
config.rawText.jquery = "define([" + (included.length ? included.join(",") : "") + "]);";
config.rawText.jquery = "define([" +
(included.length ? included.join(",") : "") +
"]);";
}

// Trace dependencies and concatenate files
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"grunt-contrib-uglify": "0.5.0",
"grunt-contrib-watch": "0.6.1",
"grunt-git-authors": "1.2.0",
"grunt-jscs-checker": "0.4.1",
"grunt-jscs-checker": "0.6.1",
"grunt-jsonlint": "1.0.4",
"grunt-npmcopy": "0.1.0",
"gzip-js": "0.3.2",
Expand Down
29 changes: 20 additions & 9 deletions src/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var
// a field from window.location if document.domain has been set
try {
ajaxLocation = location.href;
} catch( e ) {
} catch ( e ) {
// Use the href attribute of an A element
// since IE will modify it given document.location
ajaxLocation = document.createElement( "a" );
Expand Down Expand Up @@ -103,7 +103,9 @@ function inspectPrefiltersOrTransports( structure, options, originalOptions, jqX
inspected[ dataType ] = true;
jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
if ( typeof dataTypeOrTransport === "string" &&
!seekingTransport && !inspected[ dataTypeOrTransport ] ) {

options.dataTypes.unshift( dataTypeOrTransport );
inspect( dataTypeOrTransport );
return false;
Expand Down Expand Up @@ -275,7 +277,10 @@ function ajaxConvert( s, response, jqXHR, isSuccess ) {
try {
response = conv( response );
} catch ( e ) {
return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
return {
state: "parsererror",
error: conv ? e : "No conversion from " + prev + " to " + current
};
}
}
}
Expand Down Expand Up @@ -412,9 +417,10 @@ jQuery.extend({
// Callbacks context
callbackContext = s.context || s,
// Context for global events is callbackContext if it is a DOM node or jQuery collection
globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
jQuery( callbackContext ) :
jQuery.event,
globalEventContext = s.context &&
( callbackContext.nodeType || callbackContext.jquery ) ?
jQuery( callbackContext ) :
jQuery.event,
// Deferreds
deferred = jQuery.Deferred(),
completeDeferred = jQuery.Callbacks("once memory"),
Expand Down Expand Up @@ -506,7 +512,9 @@ jQuery.extend({
// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
// Handle falsy url in the settings object (#10093: consistency with old signature)
// We also use the url parameter if available
s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
s.url = ( ( url || s.url || ajaxLocation ) + "" )
.replace( rhash, "" )
.replace( rprotocol, ajaxLocParts[ 1 ] + "//" );

// Alias method option to type as per ticket #12004
s.type = options.method || options.type || s.method || s.type;
Expand Down Expand Up @@ -597,7 +605,8 @@ jQuery.extend({
jqXHR.setRequestHeader(
"Accept",
s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
s.accepts[ s.dataTypes[0] ] +
( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
s.accepts[ "*" ]
);

Expand All @@ -607,7 +616,9 @@ jQuery.extend({
}

// Allow custom headers/mimetypes and early abort
if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
if ( s.beforeSend &&
( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {

// Abort if not done already and return
return jqXHR.abort();
}
Expand Down
4 changes: 3 additions & 1 deletion src/ajax/jsonp.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
var callbackName, overwritten, responseContainer,
jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
"url" :
typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
typeof s.data === "string" &&
!( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") &&
rjsonp.test( s.data ) && "data"
);

// Handle iff the expected data type is "jsonp" or we have a parameter to set
Expand Down
2 changes: 1 addition & 1 deletion src/ajax/parseXML.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jQuery.parseXML = function( data ) {
xml.async = "false";
xml.loadXML( data );
}
} catch( e ) {
} catch ( e ) {
xml = undefined;
}
if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
Expand Down
3 changes: 2 additions & 1 deletion src/ajax/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ define([
// Install script dataType
jQuery.ajaxSetup({
accepts: {
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
script: "text/javascript, application/javascript, " +
"application/ecmascript, application/x-ecmascript"
},
contents: {
script: /(?:java|ecma)script/
Expand Down
14 changes: 10 additions & 4 deletions src/ajax/xhr.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,13 @@ if ( xhrSupported ) {
id = ++xhrId;

// Open the socket
xhr.open( options.type, options.url, options.async, options.username, options.password );
xhr.open(
options.type,
options.url,
options.async,
options.username,
options.password
);

// Apply custom fields if provided
if ( options.xhrFields ) {
Expand Down Expand Up @@ -132,7 +138,7 @@ if ( xhrSupported ) {
// statusText for faulty cross-domain requests
try {
statusText = xhr.statusText;
} catch( e ) {
} catch ( e ) {
// We normalize with Webkit giving an empty statusText
statusText = "";
}
Expand Down Expand Up @@ -184,13 +190,13 @@ if ( xhrSupported ) {
function createStandardXHR() {
try {
return new window.XMLHttpRequest();
} catch( e ) {}
} catch ( e ) {}
}

function createActiveXHR() {
try {
return new window.ActiveXObject( "Microsoft.XMLHTTP" );
} catch( e ) {}
} catch ( e ) {}
}

});
4 changes: 3 additions & 1 deletion src/attributes/attr.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ jQuery.extend({
if ( value === null ) {
jQuery.removeAttr( elem, name );

} else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
} else if ( hooks && "set" in hooks &&
(ret = hooks.set( elem, value, name )) !== undefined ) {

return ret;

} else {
Expand Down
12 changes: 9 additions & 3 deletions src/attributes/classes.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ jQuery.fn.extend({

if ( jQuery.isFunction( value ) ) {
return this.each(function( i ) {
jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
jQuery( this ).toggleClass(
value.call(this, i, this.className, stateVal), stateVal
);
});
}

Expand Down Expand Up @@ -135,7 +137,9 @@ jQuery.fn.extend({
// then remove the whole classname (if there was one, the above saved it).
// Otherwise bring back whatever was previously saved (if anything),
// falling back to the empty string if nothing was stored.
this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
this.className = this.className || value === false ?
"" :
jQuery._data( this, "__className__" ) || "";
}
});
},
Expand All @@ -145,7 +149,9 @@ jQuery.fn.extend({
i = 0,
l = this.length;
for ( ; i < l; i++ ) {
if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
if ( this[i].nodeType === 1 &&
(" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {

return true;
}
}
Expand Down
Loading

0 comments on commit 91e06e9

Please sign in to comment.