@putout/printer
Advanced tools
Comparing version 10.4.1 to 10.5.0
'use strict'; | ||
const {types} = require('@putout/babel'); | ||
const { | ||
isAssignmentPattern, | ||
isIdentifier, | ||
} = require('@putout/babel').types; | ||
} = types; | ||
@@ -8,0 +9,0 @@ module.exports.moreThenMaxPropertiesLengthInOneLine = (path, {maxPropertiesLengthInOneLine}) => { |
@@ -7,2 +7,3 @@ 'use strict'; | ||
isAssignmentPattern, | ||
isVariableDeclarator, | ||
} = require('@putout/babel').types; | ||
@@ -24,5 +25,2 @@ | ||
const isTwoLevelsDeep = ({parentPath}) => parentPath.parentPath.parentPath.isObjectProperty(); | ||
const isOneParentProperty = ({parentPath}) => parentPath.parentPath.node.properties?.length === 1; | ||
function isIndent(path) { | ||
@@ -39,2 +37,5 @@ return !path.parentPath.isArrayPattern(); | ||
if (path.parentPath.isVariableDeclarator() && !hasAssign(path.get('properties'))) | ||
return false; | ||
return !path.parentPath.isObjectProperty(); | ||
@@ -109,3 +110,3 @@ }; | ||
if (is || hasObject && !isAssign) { | ||
if (is || hasObject) { | ||
print(','); | ||
@@ -128,14 +129,2 @@ print.newline(); | ||
}), | ||
afterIf(path) { | ||
if (!path.parentPath.isObjectProperty()) | ||
return false; | ||
if (isTwoLevelsDeep(path)) | ||
return false; | ||
return isOneParentProperty(path); | ||
}, | ||
after(path, {print}) { | ||
print.newline(); | ||
}, | ||
}; | ||
@@ -200,3 +189,6 @@ | ||
if (moreCount && !moreLength) | ||
if (hasObjectPattern(properties)) | ||
return COUPLE_LINES; | ||
if (moreCount && !moreLength && isVariableDeclarator(path.parentPath)) | ||
return ONE_LINE; | ||
@@ -203,0 +195,0 @@ |
{ | ||
"name": "@putout/printer", | ||
"version": "10.4.1", | ||
"version": "10.5.0", | ||
"type": "commonjs", | ||
@@ -5,0 +5,0 @@ "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
234879
5149