Permalink
Browse files

Tools: Bump up grunt-jscs to 1.8.0

Fixes #421
  • Loading branch information...
rxaviers committed Jul 16, 2015
1 parent 2caa094 commit 76c340cf66a7da438d69e7955b530e7c0dc09136
View
@@ -1,3 +1,7 @@
{
- "preset": "jquery"
+ "preset": "jquery",
+ "requireSpacesInsideParentheses": {
+ "all": true,
+ "except": [ "{", "}", "[", "]", "function", "(", ")" ]
+ }
}
View
@@ -136,7 +136,7 @@ module.exports = function( grunt ) {
var name = camelCase( id.replace( /util\/|common\//, "" ) );
// MakePlural
- if ( (/make-plural/).test( id ) ) {
+ if ( ( /make-plural/ ).test( id ) ) {
return contents
// Remove browserify wrappers.
@@ -149,7 +149,7 @@ module.exports = function( grunt ) {
.replace( "module.exports = exports['default'];", "" )
// Remove self-tests.
- .replace( /var Tests =[\s\S]*?\n}\)\(\);/, "")
+ .replace( /var Tests =[\s\S]*?\n}\)\(\);/, "" )
.replace( "this.tests = new Tests(this);", "" )
.replace( /this.fn.test =[\s\S]*?bind\(this\);/, "" )
.replace( "this.tests.add(type, cat, examples);", "" )
@@ -168,6 +168,7 @@ module.exports = function( grunt ) {
"}());",
"/* jshint ignore:end */"
].join( "\n" ) )
+
// Wrap everything into a var assignment.
.replace( /^/, [
"var MakePlural;",
@@ -181,7 +182,7 @@ module.exports = function( grunt ) {
].join( "\n" ) );
// messageformat
- } else if ( (/messageformat/).test( id ) ) {
+ } else if ( ( /messageformat/ ).test( id ) ) {
return contents
// Remove browserify wrappers.
View
@@ -82,7 +82,7 @@
"grunt-contrib-requirejs": "0.4.4",
"grunt-contrib-uglify": "0.6.0",
"grunt-contrib-watch": "0.6.1",
- "grunt-jscs": "0.7.1",
+ "grunt-jscs": "1.8.0",
"gzip-js": "0.3.2",
"matchdep": "0.3.0"
},
View
@@ -59,6 +59,7 @@ function Globalize( locale ) {
* Somewhat equivalent to previous Globalize.addCultureInfo(...).
*/
Globalize.load = function() {
+
// validations are delegated to Cldr.load().
Cldr.load.apply( Cldr, arguments );
};
@@ -39,6 +39,7 @@ return function( pattern, cldr ) {
length = current.length;
if ( chr === "j" ) {
+
// Locale preferred hHKk.
// http://www.unicode.org/reports/tr35/tr35-dates.html#Time_Data
properties.preferredTime = chr = cldr.supplemental.timeData.preferred();
@@ -62,11 +63,13 @@ return function( pattern, cldr ) {
// Year
case "y":
+
// Plain year.
formatNumber = true;
break;
case "Y":
+
// Year in "Week of Year"
properties.firstDay = dateFirstDayOfWeek( cldr );
properties.minDays = cldr.supplemental.weekData.minDays();
@@ -135,6 +138,7 @@ return function( pattern, cldr ) {
break;
case "g":
+
// Modified Julian day. Need to be implemented.
throw createErrorUnsupportedFeature({
feature: "Julian day pattern `g`"
@@ -207,6 +211,7 @@ return function( pattern, cldr ) {
// Zone
case "z":
case "O":
+
// O: "{gmtFormat}+H;{gmtFormat}-H" or "{gmtZeroFormat}", eg. "GMT-8" or "GMT".
// OOOO: "{gmtFormat}{hourFormat}" or "{gmtZeroFormat}", eg. "GMT-08:00" or "GMT".
properties.gmtFormat = cldr.main( "dates/timeZoneNames/gmtFormat" );
View
@@ -30,12 +30,14 @@ return function( date, numberFormatters, properties ) {
length = current.length;
if ( chr === "j" ) {
+
// Locale preferred hHKk.
// http://www.unicode.org/reports/tr35/tr35-dates.html#Time_Data
chr = properties.preferredTime;
}
if ( chr === "Z" ) {
+
// Z..ZZZ: same as "xxxx".
if ( length < 4 ) {
chr = "x";
@@ -62,6 +64,7 @@ return function( date, numberFormatters, properties ) {
// Year
case "y":
+
// Plain year.
// The length specifies the padding, but for two letters it also specifies the
// maximum length.
@@ -73,6 +76,7 @@ return function( date, numberFormatters, properties ) {
break;
case "Y":
+
// Year in "Week of Year"
// The length specifies the padding, but for two letters it also specifies the
// maximum length.
@@ -111,6 +115,7 @@ return function( date, numberFormatters, properties ) {
// Week
case "w":
+
// Week of Year.
// woy = ceil( ( doy + dow of 1/1 ) / 7 ) - minDaysStuff ? 1 : 0.
// TODO should pad on ww? Not documented, but I guess so.
@@ -120,6 +125,7 @@ return function( date, numberFormatters, properties ) {
break;
case "W":
+
// Week of Month.
// wom = ceil( ( dom + dow of `1/month` ) / 7 ) - minDaysStuff ? 1 : 0.
ret = dateDayOfWeek( dateStartOf( date, "month" ), properties.firstDay );
@@ -137,6 +143,7 @@ return function( date, numberFormatters, properties ) {
break;
case "F":
+
// Day of Week in month. eg. 2nd Wed in July.
ret = Math.floor( date.getDate() / 7 ) + 1;
break;
@@ -145,6 +152,7 @@ return function( date, numberFormatters, properties ) {
case "e":
case "c":
if ( length <= 2 ) {
+
// Range is [1-7] (deduced by example provided on documentation)
// TODO Should pad with zeros (not specified in the docs)?
ret = dateDayOfWeek( date, properties.firstDay ) + 1;
@@ -200,6 +208,7 @@ return function( date, numberFormatters, properties ) {
// Zone
case "z":
case "O":
+
// O: "{gmtFormat}+H;{gmtFormat}-H" or "{gmtZeroFormat}", eg. "GMT-8" or "GMT".
// OOOO: "{gmtFormat}{hourFormat}" or "{gmtZeroFormat}", eg. "GMT-08:00" or "GMT".
if ( date.getTimezoneOffset() === 0 ) {
@@ -216,6 +225,7 @@ return function( date, numberFormatters, properties ) {
break;
case "X":
+
// Same as x*, except it uses "Z" for zero offset.
if ( date.getTimezoneOffset() === 0 ) {
ret = "Z";
@@ -224,6 +234,7 @@ return function( date, numberFormatters, properties ) {
/* falls through */
case "x":
+
// x: hourFormat("+HH;-HH")
// xx or xxxx: hourFormat("+HHmm;-HHmm")
// xxx or xxxxx: hourFormat("+HH:mm;-HH:mm")
View
@@ -8,7 +8,7 @@ define(function() {
* Returns an indication whether the specified year is a leap year.
*/
return function( year ) {
- return new Date(year, 1, 29).getMonth() === 1;
+ return new Date( year, 1, 29 ).getMonth() === 1;
};
});
@@ -8,7 +8,7 @@ define(function() {
* Return the last day of the given date's month
*/
return function( date ) {
- return new Date( date.getFullYear(), date.getMonth() + 1, 0).getDate();
+ return new Date( date.getFullYear(), date.getMonth() + 1, 0 ).getDate();
};
});
@@ -6,6 +6,7 @@ define([
* millisecondsInDay
*/
return function( date ) {
+
// TODO Handle daylight savings discontinuities
return date - dateStartOf( date, "day" );
};
View
@@ -41,6 +41,7 @@ return function( value, tokens, properties ) {
var century, chr, value, length;
if ( token.type === "literal" ) {
+
// continue
return true;
}
@@ -49,6 +50,7 @@ return function( value, tokens, properties ) {
length = token.type.length;
if ( chr === "j" ) {
+
// Locale preferred hHKk.
// http://www.unicode.org/reports/tr35/tr35-dates.html#Time_Data
chr = properties.preferredTimeData;
@@ -69,6 +71,7 @@ return function( value, tokens, properties ) {
if ( outOfRange( value, 0, 99 ) ) {
return false;
}
+
// mimic dojo/date/locale: choose century to apply, according to a sliding
// window of 80 years before and 20 years after present year.
century = Math.floor( date.getFullYear() / 100 ) * 100;
@@ -123,6 +126,7 @@ return function( value, tokens, properties ) {
break;
case "F":
+
// Day of Week in month. eg. 2nd Wed in July.
// Skip
break;
@@ -131,6 +135,7 @@ return function( value, tokens, properties ) {
case "e":
case "c":
case "E":
+
// Skip.
// value = arrayIndexOf( dateWeekDays, token.value );
break;
@@ -237,6 +242,7 @@ return function( value, tokens, properties ) {
}
if ( era === 0 ) {
+
// 1 BC = year 0
date.setFullYear( date.getFullYear() * -1 + 1 );
}
@@ -250,7 +256,7 @@ return function( value, tokens, properties ) {
if ( outOfRange( daysOfYear, 1, dateIsLeapYear( date.getFullYear() ) ? 366 : 365 ) ) {
return null;
}
- date.setMonth(0);
+ date.setMonth( 0 );
date.setDate( daysOfYear );
}
View
@@ -1,5 +1,5 @@
define(function() {
-return (/([a-z])\1*|'([^']|'')+'|''|./ig);
+return ( /([a-z])\1*|'([^']|'')+'|''|./ig );
});
@@ -71,6 +71,7 @@ return function( pattern, cldr ) {
// Month
case "M":
case "L":
+
// number l=1:{1,2}, l=2:{2}.
// lookup l=3...
if ( length > 2 ) {
@@ -84,6 +85,7 @@ return function( pattern, cldr ) {
// Day
case "g":
+
// Modified Julian day. Need to be implemented.
throw createErrorUnsupportedFeature({
feature: "Julian day pattern `g`"
@@ -92,6 +94,7 @@ return function( pattern, cldr ) {
// Week day
case "e":
case "c":
+
// lookup for length >=3.
if ( length <= 2 ) {
break;
@@ -100,6 +103,7 @@ return function( pattern, cldr ) {
/* falls through */
case "E":
if ( length === 6 ) {
+
// Note: if short day names are not explicitly specified, abbreviated day
// names are used instead http://www.unicode.org/reports/tr35/tr35-dates.html#months_days_quarters_eras
cldr.main([
Oops, something went wrong.

0 comments on commit 76c340c

Please sign in to comment.