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,
"immed": true,
"noarg": true,
"onevar": true,
"quotmark": "double",
"smarttabs": true,
"trailing": true,
"undef": true,
"unused": true,
"es3": true,
"jquery": true,
"browser": true,

View File

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

View File

@@ -29,14 +29,14 @@
"devDependencies": {
"commitplease": "1.7.0",
"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-watch": "0.6.0",
"grunt-jscs-checker": "0.4.0",
"grunt-contrib-concat": "0.3.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"
},
"keywords": [

View File

@@ -27,7 +27,7 @@ $.validator.addMethod("dateITA", function(value, element) {
mm = parseInt(adata[1],10);
aaaa = parseInt(adata[2],10);
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;
} else {
check = false;

View File

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

View File

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

View File

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