@@ -42,30 +42,6 @@ function isSingleLine(node) {
4242 return ( node . loc . end . line === node . loc . start . line ) ;
4343}
4444
45- /**
46- * Checks whether both nodes are on the same line.
47- * @param {ASTNode } nodeA AST Node being evaluated.
48- * @param {ASTNode } nodeB AST Node being evaluated.
49- * @returns {boolean } True if both nodes are on the same line.
50- */
51- function isOnSameLine ( nodeA , nodeB ) {
52- return ( nodeA . loc . end . line === nodeB . loc . end . line ) ;
53- }
54-
55- /**
56- * Checks whether the properties of a node on the same line.
57- * @param {ASTNode } node node
58- * @returns {boolean } True if the properties of a node are on the same line.
59- */
60- function isPropertiesOnSameLine ( node ) {
61- if ( node . properties . length <= 1 ) {
62- return true ;
63- }
64- const [ firstProperty ] = node . properties ;
65-
66- return node . properties . every ( property => isOnSameLine ( firstProperty , property ) ) ;
67- }
68-
6945/**
7046 * Initializes a single option property from the configuration with defaults for undefined values
7147 * @param {Object } toOptions Object to be initialized
@@ -654,7 +630,7 @@ module.exports = {
654630
655631 return {
656632 ObjectExpression ( node ) {
657- if ( isSingleLine ( node ) || isPropertiesOnSameLine ( node ) ) {
633+ if ( isSingleLine ( node ) ) {
658634 verifyListSpacing ( node . properties . filter ( isKeyValueProperty ) ) ;
659635 } else {
660636 verifyAlignment ( node ) ;
@@ -667,9 +643,7 @@ module.exports = {
667643 // Obey beforeColon and afterColon in each property as configured
668644 return {
669645 Property ( node ) {
670- const option = ( isSingleLine ( node . parent ) || isPropertiesOnSameLine ( node . parent ) ) ? singleLineOptions : multiLineOptions ;
671-
672- verifySpacing ( node , option ) ;
646+ verifySpacing ( node , isSingleLine ( node . parent ) ? singleLineOptions : multiLineOptions ) ;
673647 }
674648 } ;
675649
0 commit comments