0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2025-01-20 05:32:46 -05:00

Made JSCS checking much, much stricter, brought code into line with checking.

This commit is contained in:
Gert K. Sønderby 2015-09-28 15:16:48 +02:00
parent 0ec3c43791
commit a88e7018da
10 changed files with 242 additions and 224 deletions

24
.jscsrc
View file

@ -1,6 +1,22 @@
{ {
"disallowSpacesInsideParentheses": false, "requireCamelCaseOrUpperCaseIdentifiers": true,
"disallowSpacesInFunctionDeclaration": { "requireCapitalizedConstructors": true,
"beforeOpeningRoundBrace": false "requireCurlyBraces": true,
} "requireDotNotation": true,
"requireLineBreakAfterVariableAssignment": true,
"requireLineFeedAtFileEnd": true,
"requireSpaceAfterBinaryOperators": true,
"requireSpaceBeforeBinaryOperators": true,
"requireSpaceBeforeBlockStatements": true,
"requireSpaceBetweenArguments": true,
"requireSpaceBeforeKeywords": true,
"requireSpacesInConditionalExpression": true,
"requireSpacesInForStatement": true,
"requireSpacesInFunction": {
"beforeOpeningRoundBrace": true,
"beforeOpeningCurlyBrace": true
},
"requireSpacesInsideBrackets": true,
"requireSpacesInsideParentheses": "all",
"validateQuoteMarks": "'"
} }

View file

@ -2,7 +2,7 @@
( function ( doc, undefined ) { ( function ( doc, undefined ) {
"use strict"; 'use strict';
var DOCUMENT_POSITION_PRECEDING = 2; // Node.DOCUMENT_POSITION_PRECEDING var DOCUMENT_POSITION_PRECEDING = 2; // Node.DOCUMENT_POSITION_PRECEDING
var ELEMENT_NODE = 1; // Node.ELEMENT_NODE; var ELEMENT_NODE = 1; // Node.ELEMENT_NODE;
@ -200,15 +200,6 @@ function hasTagAttributes ( node, tag, attributes ) {
} }
return true; return true;
} }
function areAlike ( node, node2 ) {
return !isLeaf( node ) && (
node.nodeType === node2.nodeType &&
node.nodeName === node2.nodeName &&
node.className === node2.className &&
( ( !node.style && !node2.style ) ||
node.style.cssText === node2.style.cssText )
);
}
function isLeaf ( node ) { function isLeaf ( node ) {
return node.nodeType === ELEMENT_NODE && return node.nodeType === ELEMENT_NODE &&
@ -228,6 +219,16 @@ function isContainer ( node ) {
!isInline( node ) && !isBlock( node ); !isInline( node ) && !isBlock( node );
} }
function areAlike ( node, node2 ) {
return !isLeaf( node ) && (
node.nodeType === node2.nodeType &&
node.nodeName === node2.nodeName &&
node.className === node2.className &&
( ( !node.style && !node2.style ) ||
node.style.cssText === node2.style.cssText )
);
}
function getBlockWalker ( node ) { function getBlockWalker ( node ) {
var doc = node.ownerDocument, var doc = node.ownerDocument,
walker = new TreeWalker( walker = new TreeWalker(

File diff suppressed because one or more lines are too long

View file

@ -31,15 +31,6 @@ function hasTagAttributes ( node, tag, attributes ) {
} }
return true; return true;
} }
function areAlike ( node, node2 ) {
return !isLeaf( node ) && (
node.nodeType === node2.nodeType &&
node.nodeName === node2.nodeName &&
node.className === node2.className &&
( ( !node.style && !node2.style ) ||
node.style.cssText === node2.style.cssText )
);
}
function isLeaf ( node ) { function isLeaf ( node ) {
return node.nodeType === ELEMENT_NODE && return node.nodeType === ELEMENT_NODE &&
@ -59,6 +50,16 @@ function isContainer ( node ) {
!isInline( node ) && !isBlock( node ); !isInline( node ) && !isBlock( node );
} }
function areAlike ( node, node2 ) {
return !isLeaf( node ) && (
node.nodeType === node2.nodeType &&
node.nodeName === node2.nodeName &&
node.className === node2.className &&
( ( !node.style && !node2.style ) ||
node.style.cssText === node2.style.cssText )
);
}
function getBlockWalker ( node ) { function getBlockWalker ( node ) {
var doc = node.ownerDocument, var doc = node.ownerDocument,
walker = new TreeWalker( walker = new TreeWalker(

View file

@ -3,4 +3,4 @@
( function ( doc, undefined ) { ( function ( doc, undefined ) {
"use strict"; 'use strict';