@putout/printer
Advanced tools
Comparing version
@@ -11,3 +11,3 @@ 'use strict'; | ||
isNextObject, | ||
} = require('../../is'); | ||
} = require('#is'); | ||
@@ -14,0 +14,0 @@ const { |
@@ -18,2 +18,3 @@ 'use strict'; | ||
const {isLooksLikeChain} = require('../member-expression/is-looks-like-chain'); | ||
const {isThirdObjectInsideArray} = require('./is-third-object-inside-array'); | ||
@@ -56,2 +57,6 @@ const { | ||
const {elements} = parentPath.parentPath.node; | ||
if (!elements) | ||
return false; | ||
const [first] = elements; | ||
@@ -70,3 +75,3 @@ | ||
const insideNestedArrayCall = isInsideTuple(path) || isInsideNestedArrayCall(path); | ||
const insideNestedArrayCall = isInsideTuple(path) || isInsideNestedArrayCall(path) || isThirdObjectInsideArray(path); | ||
@@ -73,0 +78,0 @@ maybe.indent.inc(!insideNestedArrayCall); |
@@ -59,14 +59,2 @@ 'use strict'; | ||
const maybeIndent = (a) => a && indent(); | ||
const maybeIndentInc = (a) => a && indent.inc(); | ||
const maybeIndentDec = (a) => a && indent.dec(); | ||
const maybeNewline = (a) => a && newline(); | ||
const maybeBreakline = (a) => a && breakline(); | ||
const maybeLinebreak = (a) => a && linebreak(); | ||
const maybeWrite = (a, b) => a && write(b); | ||
const maybeSpace = (a) => a && space(); | ||
let i = 0; | ||
const incIndent = () => ++i; | ||
const decIndent = () => --i; | ||
const indent = () => { | ||
@@ -79,14 +67,24 @@ addToken({ | ||
assign(indent, { | ||
inc: incIndent, | ||
dec: decIndent, | ||
}); | ||
const maybeIndent = (a) => a && indent(); | ||
const splitter = () => { | ||
const maybeIndentInc = (a) => a && indent.inc(); | ||
const maybeIndentDec = (a) => a && indent.dec(); | ||
const newline = () => { | ||
addToken({ | ||
type: TYPES.SPLITTER, | ||
value: format.splitter, | ||
type: TYPES.NEWLINE, | ||
value: format.newline, | ||
}); | ||
}; | ||
const maybeNewline = (a) => a && newline(); | ||
const breakline = () => { | ||
newline(); | ||
indent(); | ||
}; | ||
const maybeBreakline = (a) => a && breakline(); | ||
const linebreak = () => { | ||
@@ -97,2 +95,5 @@ indent(); | ||
const maybeLinebreak = (a) => a && linebreak(); | ||
const maybeWrite = (a, b) => a && write(b); | ||
const space = () => { | ||
@@ -105,5 +106,17 @@ addToken({ | ||
const breakline = () => { | ||
newline(); | ||
indent(); | ||
const maybeSpace = (a) => a && space(); | ||
let i = 0; | ||
const incIndent = () => ++i; | ||
const decIndent = () => --i; | ||
assign(indent, { | ||
inc: incIndent, | ||
dec: decIndent, | ||
}); | ||
const splitter = () => { | ||
addToken({ | ||
type: TYPES.SPLITTER, | ||
value: format.splitter, | ||
}); | ||
}; | ||
@@ -118,9 +131,2 @@ | ||
const newline = () => { | ||
addToken({ | ||
type: TYPES.NEWLINE, | ||
value: format.newline, | ||
}); | ||
}; | ||
const endOfFile = () => { | ||
@@ -127,0 +133,0 @@ addToken({ |
{ | ||
"name": "@putout/printer", | ||
"version": "13.1.0", | ||
"version": "13.2.0", | ||
"type": "commonjs", | ||
@@ -65,2 +65,5 @@ "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)", | ||
"default": "./test/create-test.js" | ||
}, | ||
"#is": { | ||
"default": "./lib/tokenize/is.js" | ||
} | ||
@@ -71,7 +74,7 @@ }, | ||
"@putout/eslint-flat": "^2.0.0", | ||
"@putout/plugin-minify": "^9.0.0", | ||
"@putout/plugin-minify": "^10.0.0", | ||
"@putout/plugin-printer": "^4.0.0", | ||
"@putout/plugin-promises": "^16.0.0", | ||
"@putout/plugin-react-hook-form": "^5.0.0", | ||
"@putout/plugin-react-hooks": "^6.0.0", | ||
"@putout/plugin-react-hooks": "^7.0.0", | ||
"acorn": "^8.8.2", | ||
@@ -78,0 +81,0 @@ "c8": "^10.1.2", |
Sorry, the diff of this file is not supported yet
264236
0.34%156
0.65%5749
0.31%