diff --git a/Gruntfile.js b/Gruntfile.js index 7257791463..6d0dd4bde6 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -65,16 +65,19 @@ module.exports = function (grunt) { config: 'js/.jscsrc' }, grunt: { - src: ['Gruntfile.js', 'grunt/*.js'] + options: { + 'requireParenthesesAroundIIFE': true + }, + 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 %>' } }, 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..8d402b53c2 100644 --- a/grunt/.jshintrc +++ b/grunt/.jshintrc @@ -1,15 +1,10 @@ { - "camelcase": true, - "curly": true, + "curly" : true, "eqeqeq": true, - "immed": true, - "indent": 2, "newcap": true, - "noarg": true, - "node": true, + "noarg" : true, + "node" : true, "nonbsp": true, - "quotmark": "single", "strict": true, - "trailing": true, - "undef": true + "undef" : true } diff --git a/js/.jscsrc b/js/.jscsrc index 313bfb6901..2da777a222 100644 --- a/js/.jscsrc +++ b/js/.jscsrc @@ -1,15 +1,22 @@ { + "disallowEmptyBlocks": true, "disallowKeywords": ["with"], - "requireLeftStickedOperators": [","], "disallowLeftStickedOperators": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="], + "disallowMixedSpacesAndTabs": true, + "disallowMultipleLineStrings": true, "disallowRightStickedOperators": ["?", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="], "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~"], "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], + "disallowTrailingWhitespace": true, + "requireCamelCaseOrUpperCaseIdentifiers": true, + "requireLeftStickedOperators": [","], "requireLineFeedAtFileEnd": true, "requireRightStickedOperators": ["!"], "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"], "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], "requireSpacesInFunctionExpression": { "beforeOpeningCurlyBrace": true }, - "validateLineBreaks": "LF" + "validateIndentation": 2, + "validateLineBreaks": "LF", + "validateQuoteMarks": "'" } diff --git a/js/.jshintrc b/js/.jshintrc index ae8a0b404d..e1ead322ea 100644 --- a/js/.jshintrc +++ b/js/.jshintrc @@ -7,8 +7,6 @@ "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()