Build: Bump and merge JSHint/JSCS config

Moved options depreciated in the latest JSHint to the JSCS version.
This commit is contained in:
Nick Schonning
2014-05-26 23:13:18 -04:00
parent cda5efa487
commit 56a2a18368
8 changed files with 65 additions and 41 deletions

23
.jscsrc Normal file
View File

@@ -0,0 +1,23 @@
{
"preset": "jquery",
"disallowSpacesInNamedFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"requireSpacesInNamedFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInAnonymousFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"requireSpacesInAnonymousFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"disallowTrailingComma": true,
"requireMultipleVarDecl": "onevar",
"disallowTrailingWhitespace": true,
"validateQuoteMarks": "\"",
"excludeFiles": [
"node_modules/**",
"dist/**"
]
}

View File

@@ -6,12 +6,9 @@
"expr": true, "expr": true,
"immed": true, "immed": true,
"noarg": true, "noarg": true,
"onevar": true,
"quotmark": "double",
"smarttabs": true,
"trailing": true,
"undef": true, "undef": true,
"unused": true, "unused": true,
"es3": true,
"jquery": true, "jquery": true,
"browser": true, "browser": true,

View File

@@ -118,22 +118,20 @@ grunt.initConfig({
options: { options: {
jshintrc: true jshintrc: true
}, },
files: [ core: {
"src/**/*.js" src: [
], "src/**/*.js"
]
},
test: { test: {
files: { src: [
src: [ "test/*.js"
"test/*.js" ]
]
}
}, },
grunt: { grunt: {
files: { src: [
src: [ "Gruntfile.js"
"Gruntfile.js" ]
]
}
} }
}, },
watch: { watch: {
@@ -142,20 +140,20 @@ grunt.initConfig({
tasks: ["jshint:grunt"] tasks: ["jshint:grunt"]
}, },
src: { src: {
files: "<%= jshint.files %>", files: "<%= jshint.core.src %>",
tasks: ["concat", "qunit"] tasks: ["jscs:core", "jshint:core", "concat", "qunit"]
}, },
test: { test: {
files: ["<%= jshint.test.files.src %>", "test/index.html"], files: ["<%= jshint.test.src %>", "test/index.html"],
tasks: ["jshint:test"] tasks: ["jscs:test", "jshint:test"]
} }
}, },
jscs: { jscs: {
all: { core: {
options: { src: "<%= jshint.core.src %>"
preset: "jquery" },
}, test: {
src: "src/**/*.*" src: "<%= jshint.test.src %>"
} }
}, },
copy: { copy: {

View File

@@ -29,14 +29,14 @@
"devDependencies": { "devDependencies": {
"commitplease": "1.7.0", "commitplease": "1.7.0",
"grunt": "0.4.4", "grunt": "0.4.4",
"grunt-contrib-qunit": "0.4.0",
"grunt-contrib-jshint": "0.8.0",
"grunt-contrib-uglify": "0.4.0",
"grunt-contrib-concat": "0.3.0",
"grunt-contrib-compress": "0.7.0", "grunt-contrib-compress": "0.7.0",
"grunt-contrib-watch": "0.6.0", "grunt-contrib-concat": "0.3.0",
"grunt-jscs-checker": "0.4.0",
"grunt-contrib-copy": "0.5.0", "grunt-contrib-copy": "0.5.0",
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-qunit": "0.4.0",
"grunt-contrib-uglify": "0.4.0",
"grunt-contrib-watch": "0.6.0",
"grunt-jscs-checker": "^0.4.4",
"grunt-text-replace": "0.3.11" "grunt-text-replace": "0.3.11"
}, },
"keywords": [ "keywords": [

View File

@@ -27,7 +27,7 @@ $.validator.addMethod("dateITA", function(value, element) {
mm = parseInt(adata[1],10); mm = parseInt(adata[1],10);
aaaa = parseInt(adata[2],10); aaaa = parseInt(adata[2],10);
xdata = new Date(aaaa, mm - 1, gg, 12, 0, 0, 0); xdata = new Date(aaaa, mm - 1, gg, 12, 0, 0, 0);
if ( ( xdata.getFullYear() === aaaa ) && ( xdata.getMonth() === mm - 1 ) && ( xdata.getDate() === gg ) ){ if ( ( xdata.getFullYear() === aaaa ) && ( xdata.getMonth() === mm - 1 ) && ( xdata.getDate() === gg ) ) {
check = true; check = true;
} else { } else {
check = false; check = false;

View File

@@ -21,7 +21,7 @@ $.validator.addMethod("vinUS", function(v) {
rs = 0, rs = 0,
i, n, d, f, cd, cdv; i, n, d, f, cd, cdv;
for (i = 0; i < 17; i++){ for (i = 0; i < 17; i++) {
f = FL[i]; f = FL[i];
d = v.slice(i,i + 1); d = v.slice(i,i + 1);
if (i === 8) { if (i === 8) {

View File

@@ -177,11 +177,17 @@ $.extend($.fn, {
// Custom selectors // Custom selectors
$.extend( $.expr[ ":" ], { $.extend( $.expr[ ":" ], {
// http://jqueryvalidation.org/blank-selector/ // http://jqueryvalidation.org/blank-selector/
blank: function( a ) { return !$.trim( "" + $( a ).val() ); }, blank: function( a ) {
return !$.trim( "" + $( a ).val() );
},
// http://jqueryvalidation.org/filled-selector/ // http://jqueryvalidation.org/filled-selector/
filled: function( a ) { return !!$.trim( "" + $( a ).val() ); }, filled: function( a ) {
return !!$.trim( "" + $( a ).val() );
},
// http://jqueryvalidation.org/unchecked-selector/ // http://jqueryvalidation.org/unchecked-selector/
unchecked: function( a ) { return !$( a ).prop( "checked" ); } unchecked: function( a ) {
return !$( a ).prop( "checked" );
}
}); });
// constructor for validator // constructor for validator
@@ -730,7 +736,7 @@ $.extend( $.validator, {
.attr( "id", elementID + "-error" ) .attr( "id", elementID + "-error" )
.addClass( this.settings.errorClass ) .addClass( this.settings.errorClass )
.html( message || "" ); .html( message || "" );
// Maintain reference to the element to be placed into the DOM // Maintain reference to the element to be placed into the DOM
place = error; place = error;
if ( this.settings.wrapper ) { if ( this.settings.wrapper ) {
@@ -745,7 +751,7 @@ $.extend( $.validator, {
} else { } else {
place.insertAfter( element ); place.insertAfter( element );
} }
// Link error back to the element // Link error back to the element
if ( error.is( "label" ) ) { if ( error.is( "label" ) ) {
// If the error is a label, then associate using 'for' // If the error is a label, then associate using 'for'
@@ -754,7 +760,7 @@ $.extend( $.validator, {
// If the element is not a child of an associated label, then it's necessary // If the element is not a child of an associated label, then it's necessary
// to explicitly apply aria-describedby // to explicitly apply aria-describedby
$( element ).attr( "aria-describedby", error.attr( "id" ) ); $( element ).attr( "aria-describedby", error.attr( "id" ) );
// If this element is grouped, then assign to all elements in the same group // If this element is grouped, then assign to all elements in the same group
group = this.groups[ element.name ]; group = this.groups[ element.name ];
if ( group ) { if ( group ) {

View File

@@ -45,5 +45,5 @@ $.extend($.validator.messages, {
nifES: "Veuillez fournir un numéro NIF valide.", nifES: "Veuillez fournir un numéro NIF valide.",
nieES: "Veuillez fournir un numéro NIE valide.", nieES: "Veuillez fournir un numéro NIE valide.",
cifES: "Veuillez fournir un numéro CIF valide.", cifES: "Veuillez fournir un numéro CIF valide.",
postalCodeCA: "Veuillez fournir un code postal valide.", postalCodeCA: "Veuillez fournir un code postal valide."
}); });