mirror of
https://github.com/twbs/bootstrap.git
synced 2025-01-17 09:52:29 +01:00
Tweak JSHint and JSCS checks.
Be more consistent across the whole codebase. Also, make use of JSHint's 2.5.1 `extends` and `qunit` options. This way we set our basis options in js/.jshintrc and override the rest.
This commit is contained in:
parent
a8641b4db7
commit
5ef9383f53
@ -53,6 +53,9 @@ module.exports = function (grunt) {
|
||||
src: 'js/*.js'
|
||||
},
|
||||
test: {
|
||||
options: {
|
||||
jshintrc: 'js/tests/unit/.jshintrc'
|
||||
},
|
||||
src: 'js/tests/unit/*.js'
|
||||
},
|
||||
assets: {
|
||||
@ -65,10 +68,6 @@ module.exports = function (grunt) {
|
||||
config: 'js/.jscsrc'
|
||||
},
|
||||
grunt: {
|
||||
options: {
|
||||
requireCamelCaseOrUpperCaseIdentifiers: null,
|
||||
requireParenthesesAroundIIFE: true
|
||||
},
|
||||
src: '<%= jshint.grunt.src %>'
|
||||
},
|
||||
src: {
|
||||
|
@ -1,11 +1,6 @@
|
||||
{
|
||||
"curly" : true,
|
||||
"eqeqeq": true,
|
||||
"newcap": true,
|
||||
"noarg" : true,
|
||||
"node" : true,
|
||||
"nonbsp": true,
|
||||
"strict": true,
|
||||
"undef" : true,
|
||||
"unused": true
|
||||
"extends" : "../js/.jshintrc",
|
||||
"browser" : false,
|
||||
"es3" : false,
|
||||
"node" : true
|
||||
}
|
||||
|
11
js/.jscsrc
11
js/.jscsrc
@ -1,16 +1,22 @@
|
||||
{
|
||||
"disallowEmptyBlocks": true,
|
||||
"disallowKeywords": ["with"],
|
||||
"disallowLeftStickedOperators": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
|
||||
"disallowLeftStickedOperators": ["?", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
|
||||
"disallowMixedSpacesAndTabs": true,
|
||||
"disallowMultipleLineStrings": true,
|
||||
"disallowMultipleVarDecl": true,
|
||||
"disallowQuotedKeysInObjects": "allButReserved",
|
||||
"disallowRightStickedOperators": ["?", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
|
||||
"disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"],
|
||||
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
|
||||
"disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true },
|
||||
"disallowSpacesInsideArrayBrackets": true,
|
||||
"disallowSpacesInsideParentheses": true,
|
||||
"disallowTrailingComma": true,
|
||||
"disallowTrailingWhitespace": true,
|
||||
"requireCamelCaseOrUpperCaseIdentifiers": true,
|
||||
"requireCapitalizedConstructors": true,
|
||||
"requireCommaBeforeLineBreak": true,
|
||||
"requireDotNotation": true,
|
||||
"requireLeftStickedOperators": [","],
|
||||
"requireLineFeedAtFileEnd": true,
|
||||
@ -18,10 +24,11 @@
|
||||
"requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", "<", ">=", "<="],
|
||||
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"],
|
||||
"requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", "<", ">=", "<="],
|
||||
"requireSpacesInAnonymousFunctionExpression": { "beforeOpeningCurlyBrace": true },
|
||||
"requireSpacesInAnonymousFunctionExpression": { "beforeOpeningCurlyBrace": true, "beforeOpeningRoundBrace": true },
|
||||
"requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true },
|
||||
"requireSpacesInFunctionExpression": { "beforeOpeningCurlyBrace": true },
|
||||
"requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true },
|
||||
"requireSpacesInsideObjectBrackets": "allButNested",
|
||||
"validateIndentation": 2,
|
||||
"validateLineBreaks": "LF",
|
||||
"validateQuoteMarks": "'"
|
||||
|
12
js/.jshintrc
12
js/.jshintrc
@ -1,13 +1,15 @@
|
||||
{
|
||||
"asi" : true,
|
||||
"boss" : true,
|
||||
"browser" : true,
|
||||
"debug" : true,
|
||||
"devel" : true,
|
||||
"eqeqeq" : false,
|
||||
"eqnull" : true,
|
||||
"es3" : true,
|
||||
"expr" : true,
|
||||
"jquery" : true,
|
||||
"latedef" : true,
|
||||
"laxbreak" : true,
|
||||
"unused" : true,
|
||||
"validthis": true
|
||||
"nonbsp" : true,
|
||||
"strict" : true,
|
||||
"undef" : true,
|
||||
"unused" : true
|
||||
}
|
||||
|
5
js/tests/unit/.jshintrc
Normal file
5
js/tests/unit/.jshintrc
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"extends" : "../../.jshintrc",
|
||||
"devel" : true,
|
||||
"qunit" : true
|
||||
}
|
@ -6,7 +6,6 @@
|
||||
* Licensed under the MIT license.
|
||||
*/
|
||||
|
||||
/*global QUnit:true, alert:true*/
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user