@putout/printer 1.54.3 → 1.54.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ChangeLog
CHANGED
|
@@ -186,7 +186,21 @@ function isCallInsideArrow(path) {
|
|
|
186
186
|
return path.node.elements.length < 4;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
+
function isOneSimple(path) {
|
|
190
|
+
const elements = path.get('elements');
|
|
191
|
+
|
|
192
|
+
if (elements.length !== 1)
|
|
193
|
+
return false;
|
|
194
|
+
|
|
195
|
+
const [first] = elements;
|
|
196
|
+
|
|
197
|
+
return first.isIdentifier() && first.node.name.length < 5;
|
|
198
|
+
}
|
|
199
|
+
|
|
189
200
|
function isNewlineBetweenElements(path, {elements}) {
|
|
201
|
+
if (isOneSimple(path))
|
|
202
|
+
return false;
|
|
203
|
+
|
|
190
204
|
if (isCallInsideArrow(path))
|
|
191
205
|
return false;
|
|
192
206
|
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const {
|
|
3
|
+
const {
|
|
4
|
+
isNewlineBetweenStatements,
|
|
5
|
+
isNext,
|
|
6
|
+
} = require('../is');
|
|
7
|
+
|
|
4
8
|
const {isMarkedAfter} = require('../mark');
|
|
5
9
|
|
|
10
|
+
const notClass = (path) => {
|
|
11
|
+
if (!isNext(path))
|
|
12
|
+
return false;
|
|
13
|
+
|
|
14
|
+
return !path.get('declaration').isClass();
|
|
15
|
+
};
|
|
16
|
+
|
|
6
17
|
module.exports.ExportDefaultDeclaration = {
|
|
7
18
|
beforeIf(path) {
|
|
8
19
|
const prev = path.getPrevSibling();
|
|
@@ -21,4 +32,11 @@ module.exports.ExportDefaultDeclaration = {
|
|
|
21
32
|
traverse(declaration);
|
|
22
33
|
maybe.print(!declaration.isClassDeclaration(), ';');
|
|
23
34
|
},
|
|
35
|
+
afterSatisfy: () => [
|
|
36
|
+
notClass,
|
|
37
|
+
],
|
|
38
|
+
after(path, {print}) {
|
|
39
|
+
print.newline();
|
|
40
|
+
print.newline();
|
|
41
|
+
},
|
|
24
42
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/printer",
|
|
3
|
-
"version": "1.54.
|
|
3
|
+
"version": "1.54.5",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "Easiest possible opinionated Babel AST printer made with ❤️ to use in 🐊Putout",
|