From 537e10033e055bc060ecbd57a678e6cfcfffed30 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Wed, 19 Feb 2014 09:11:05 +0200 Subject: [PATCH 1/8] Switch to using JSCS for the indentation check. --- docs/assets/js/customizer.js | 12 ++++++------ grunt/.jshintrc | 23 +++++++++++------------ js/.jscsrc | 3 ++- js/.jshintrc | 3 +-- js/tests/unit/tooltip.js | 25 ++++++++++++------------- 5 files changed, 32 insertions(+), 34 deletions(-) diff --git a/docs/assets/js/customizer.js b/docs/assets/js/customizer.js index c7385534cd..a0e4a28d19 100644 --- a/docs/assets/js/customizer.js +++ b/docs/assets/js/customizer.js @@ -72,9 +72,9 @@ window.onload = function () { // wait for load in a dumb way because B-0 var vars = {} $('#less-variables-section input') - .each(function () { - $(this).val() && (vars[$(this).prev().text()] = $(this).val()) - }) + .each(function () { + $(this).val() && (vars[$(this).prev().text()] = $(this).val()) + }) var data = { vars: vars, @@ -238,9 +238,9 @@ window.onload = function () { // wait for load in a dumb way because B-0 var vars = {} $('#less-variables-section input') - .each(function () { - $(this).val() && (vars[$(this).prev().text()] = $(this).val()) - }) + .each(function () { + $(this).val() && (vars[$(this).prev().text()] = $(this).val()) + }) var bsLessSource = generateLESS('bootstrap.less', lessFileIncludes, vars) var themeLessSource = generateLESS('theme.less', lessFileIncludes, vars) diff --git a/grunt/.jshintrc b/grunt/.jshintrc index 47dc88e0be..15f3862a94 100644 --- a/grunt/.jshintrc +++ b/grunt/.jshintrc @@ -1,15 +1,14 @@ { "camelcase": true, - "curly": true, - "eqeqeq": true, - "immed": true, - "indent": 2, - "newcap": true, - "noarg": true, - "node": true, - "nonbsp": true, - "quotmark": "single", - "strict": true, - "trailing": true, - "undef": true + "curly" : true, + "eqeqeq" : true, + "immed" : true, + "newcap" : true, + "noarg" : true, + "node" : true, + "nonbsp" : true, + "quotmark" : "single", + "strict" : true, + "trailing" : true, + "undef" : true } diff --git a/js/.jscsrc b/js/.jscsrc index 313bfb6901..5fa37a0c9e 100644 --- a/js/.jscsrc +++ b/js/.jscsrc @@ -1,15 +1,16 @@ { "disallowKeywords": ["with"], - "requireLeftStickedOperators": [","], "disallowLeftStickedOperators": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="], "disallowRightStickedOperators": ["?", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="], "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~"], "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], + "requireLeftStickedOperators": [","], "requireLineFeedAtFileEnd": true, "requireRightStickedOperators": ["!"], "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"], "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], "requireSpacesInFunctionExpression": { "beforeOpeningCurlyBrace": true }, + "validateIndentation": 2, "validateLineBreaks": "LF" } diff --git a/js/.jshintrc b/js/.jshintrc index ae8a0b404d..6a47fe03b7 100644 --- a/js/.jshintrc +++ b/js/.jshintrc @@ -7,8 +7,7 @@ "eqeqeq" : false, "eqnull" : true, "expr" : true, - "indent" : 2, "laxbreak" : true, "quotmark" : "single", "validthis": true -} \ No newline at end of file +} diff --git a/js/tests/unit/tooltip.js b/js/tests/unit/tooltip.js index c3af7d82e0..f0ac577c6e 100644 --- a/js/tests/unit/tooltip.js +++ b/js/tests/unit/tooltip.js @@ -273,8 +273,7 @@ $(function () { test('should show tooltip with delegate selector on click', function () { var div = $('
') var tooltip = div.appendTo('#qunit-fixture') - .tooltip({ selector: 'a[rel=tooltip]', - trigger: 'click' }) + .tooltip({ selector: 'a[rel=tooltip]', trigger: 'click' }) div.find('a').trigger('click') ok($('.tooltip').is('.fade.in'), 'tooltip is faded in') }) @@ -392,21 +391,21 @@ $(function () { test('tooltips should be placed dynamically, with the dynamic placement option', function () { $.support.transition = false var ttContainer = $('
').css({ - 'height' : 400, - 'overflow' : 'hidden', - 'position' : 'absolute', - 'top' : 0, - 'left' : 0, - 'width' : 600 - }) - .appendTo('body') + 'height' : 400, + 'overflow' : 'hidden', + 'position' : 'absolute', + 'top' : 0, + 'left' : 0, + 'width' : 600 + }) + .appendTo('body') var topTooltip = $('
Top Dynamic Tooltip
') .appendTo('#dynamic-tt-test') .tooltip({placement: 'auto'}) .tooltip('show') - ok($('.tooltip').is('.bottom'), 'top positioned tooltip is dynamically positioned bottom') + ok($('.tooltip').is('.bottom'), 'top positioned tooltip is dynamically positioned bottom') topTooltip.tooltip('hide') @@ -415,7 +414,7 @@ $(function () { .tooltip({placement: 'right auto'}) .tooltip('show') - ok($('.tooltip').is('.left'), 'right positioned tooltip is dynamically positioned left') + ok($('.tooltip').is('.left'), 'right positioned tooltip is dynamically positioned left') rightTooltip.tooltip('hide') var leftTooltip = $('
Left Dynamic Tooltip
') @@ -423,7 +422,7 @@ $(function () { .tooltip({placement: 'auto left'}) .tooltip('show') - ok($('.tooltip').is('.right'), 'left positioned tooltip is dynamically positioned right') + ok($('.tooltip').is('.right'), 'left positioned tooltip is dynamically positioned right') leftTooltip.tooltip('hide') ttContainer.remove() From d65f749390a32ec8c7abb09199bf31a7cca415ac Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Wed, 19 Feb 2014 09:11:25 +0200 Subject: [PATCH 2/8] Move the quotes check to JSCS. --- grunt/.jshintrc | 1 - js/.jscsrc | 3 ++- js/.jshintrc | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/grunt/.jshintrc b/grunt/.jshintrc index 15f3862a94..26ebc7e3b9 100644 --- a/grunt/.jshintrc +++ b/grunt/.jshintrc @@ -7,7 +7,6 @@ "noarg" : true, "node" : true, "nonbsp" : true, - "quotmark" : "single", "strict" : true, "trailing" : true, "undef" : true diff --git a/js/.jscsrc b/js/.jscsrc index 5fa37a0c9e..7572481c7f 100644 --- a/js/.jscsrc +++ b/js/.jscsrc @@ -12,5 +12,6 @@ "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], "requireSpacesInFunctionExpression": { "beforeOpeningCurlyBrace": true }, "validateIndentation": 2, - "validateLineBreaks": "LF" + "validateLineBreaks": "LF", + "validateQuoteMarks": "'" } diff --git a/js/.jshintrc b/js/.jshintrc index 6a47fe03b7..e1ead322ea 100644 --- a/js/.jshintrc +++ b/js/.jshintrc @@ -8,6 +8,5 @@ "eqnull" : true, "expr" : true, "laxbreak" : true, - "quotmark" : "single", "validthis": true } From 2619325626d25c2f7b342bfc17451e5ff451615f Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Wed, 19 Feb 2014 14:28:05 +0200 Subject: [PATCH 3/8] JSCS: Use more style checks. --- js/.jscsrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/js/.jscsrc b/js/.jscsrc index 7572481c7f..e8168b8b8c 100644 --- a/js/.jscsrc +++ b/js/.jscsrc @@ -1,6 +1,9 @@ { + "disallowEmptyBlocks": true, "disallowKeywords": ["with"], "disallowLeftStickedOperators": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="], + "disallowMixedSpacesAndTabs": true, + "disallowMultipleLineStrings": true, "disallowRightStickedOperators": ["?", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="], "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~"], "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], From be8f125ce6225222507f0b7329ea88b99207ac21 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Thu, 27 Feb 2014 17:38:37 +0200 Subject: [PATCH 4/8] Move `camelcase` check to JSCS. --- grunt/.jshintrc | 1 - js/.jscsrc | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/grunt/.jshintrc b/grunt/.jshintrc index 26ebc7e3b9..d357212cc2 100644 --- a/grunt/.jshintrc +++ b/grunt/.jshintrc @@ -1,5 +1,4 @@ { - "camelcase": true, "curly" : true, "eqeqeq" : true, "immed" : true, diff --git a/js/.jscsrc b/js/.jscsrc index e8168b8b8c..ceaffbcd50 100644 --- a/js/.jscsrc +++ b/js/.jscsrc @@ -7,6 +7,7 @@ "disallowRightStickedOperators": ["?", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="], "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~"], "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], + "requireCamelCaseOrUpperCaseIdentifiers": true, "requireLeftStickedOperators": [","], "requireLineFeedAtFileEnd": true, "requireRightStickedOperators": ["!"], From 25450730247f4e77f30660f52762fa83e44d6fa1 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Thu, 27 Feb 2014 17:38:46 +0200 Subject: [PATCH 5/8] Move `trailing` check to JSCS. --- grunt/.jshintrc | 1 - js/.jscsrc | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/grunt/.jshintrc b/grunt/.jshintrc index d357212cc2..f79ed0cac1 100644 --- a/grunt/.jshintrc +++ b/grunt/.jshintrc @@ -7,6 +7,5 @@ "node" : true, "nonbsp" : true, "strict" : true, - "trailing" : true, "undef" : true } diff --git a/js/.jscsrc b/js/.jscsrc index ceaffbcd50..2da777a222 100644 --- a/js/.jscsrc +++ b/js/.jscsrc @@ -7,6 +7,7 @@ "disallowRightStickedOperators": ["?", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="], "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~"], "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], + "disallowTrailingWhitespace": true, "requireCamelCaseOrUpperCaseIdentifiers": true, "requireLeftStickedOperators": [","], "requireLineFeedAtFileEnd": true, From c586a56d573ed4498b9ba2a8742653b23d92de2b Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Fri, 28 Feb 2014 14:21:21 +0200 Subject: [PATCH 6/8] Move `immed` to JSCS. --- Gruntfile.js | 3 +++ grunt/.jshintrc | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Gruntfile.js b/Gruntfile.js index 5bc1c07edd..fbb6a1a869 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -65,6 +65,9 @@ module.exports = function (grunt) { config: 'js/.jscsrc' }, grunt: { + options: { + 'requireParenthesesAroundIIFE': true + }, src: ['Gruntfile.js', 'grunt/*.js'] }, src: { diff --git a/grunt/.jshintrc b/grunt/.jshintrc index f79ed0cac1..c812e59d84 100644 --- a/grunt/.jshintrc +++ b/grunt/.jshintrc @@ -1,7 +1,6 @@ { "curly" : true, "eqeqeq" : true, - "immed" : true, "newcap" : true, "noarg" : true, "node" : true, From 055730d84ef31936fd3e13d7809528c6cc006d96 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Fri, 28 Feb 2014 14:24:35 +0200 Subject: [PATCH 7/8] Gruntfile.js: use the same targets as JSHint for JSCS to avoid duplication. --- Gruntfile.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index fbb6a1a869..05ec1f4420 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -68,16 +68,16 @@ module.exports = function (grunt) { options: { 'requireParenthesesAroundIIFE': true }, - src: ['Gruntfile.js', 'grunt/*.js'] + src: '<%= jshint.grunt.src %>' }, src: { - src: 'js/*.js' + src: '<%= jshint.src.src %>' }, test: { - src: 'js/tests/unit/*.js' + src: '<%= jshint.test.src %>' }, assets: { - src: ['docs/assets/js/application.js', 'docs/assets/js/customizer.js'] + src: '<%= jshint.assets.src %>' } }, From 22d004e332700e4867691896b9f6db954c2d7c12 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Fri, 28 Feb 2014 19:07:14 +0200 Subject: [PATCH 8/8] Re-indent grunt/.jshintrc. --- grunt/.jshintrc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/grunt/.jshintrc b/grunt/.jshintrc index c812e59d84..8d402b53c2 100644 --- a/grunt/.jshintrc +++ b/grunt/.jshintrc @@ -1,10 +1,10 @@ { - "curly" : true, - "eqeqeq" : true, - "newcap" : true, - "noarg" : true, - "node" : true, - "nonbsp" : true, - "strict" : true, - "undef" : true + "curly" : true, + "eqeqeq": true, + "newcap": true, + "noarg" : true, + "node" : true, + "nonbsp": true, + "strict": true, + "undef" : true }