@putout/printer 1.144.0 → 1.145.0

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
@@ -1,3 +1,8 @@
1
+ 2023.06.08, v1.145.0
2
+
3
+ feature:
4
+ - 9d33542 @putout/printer: ArrayExpression: tuple: Identifier and StringLiteral
5
+
1
6
  2023.06.07, v1.144.0
2
7
 
3
8
  feature:
@@ -18,6 +18,8 @@ const {isSimple} = require('@putout/operate');
18
18
  const {
19
19
  isCoupleLines,
20
20
  isStringAndIdentifier,
21
+ isIdentifierAndString,
22
+
21
23
  } = require('../is');
22
24
 
23
25
  const isForOf = ({parentPath}) => parentPath.isForOfStatement();
@@ -261,6 +263,9 @@ function isNewlineBetweenElements(path, {elements}) {
261
263
  if (isStringAndIdentifier(elements))
262
264
  return false;
263
265
 
266
+ if (isIdentifierAndString(elements))
267
+ return false;
268
+
264
269
  if (isSimpleAndObject(elements))
265
270
  return false;
266
271
 
@@ -31,4 +31,3 @@ module.exports.ArrayPattern = (path, {indent, maybe, print}, options) => {
31
31
  maybe.indent(elements.length && isNewLine);
32
32
  print(']');
33
33
  };
34
-
@@ -43,6 +43,7 @@ function isCoupleLines(path) {
43
43
 
44
44
  module.exports.exists = (a) => a.node;
45
45
  module.exports.isStringAndIdentifier = ([a, b]) => isStringLiteral(a) && isIdentifier(b);
46
+ module.exports.isIdentifierAndString = ([a, b]) => isIdentifier(a) && isStringLiteral(b);
46
47
 
47
48
  const isIfOrStatement = (a) => isIfStatement(a) || isStatement(a);
48
49
  const isForOfOrStatement = (a) => isForOfStatement(a) || isStatement(a);
@@ -31,6 +31,7 @@ const {
31
31
  parseLeadingComments,
32
32
  parseTrailingComments,
33
33
  } = require('./comments');
34
+
34
35
  const {parseOverrides} = require('./overrides');
35
36
 
36
37
  const isString = (a) => typeof a === 'string';
@@ -233,7 +234,6 @@ module.exports.tokenize = (ast, overrides) => {
233
234
 
234
235
  const currentIndent = i;
235
236
  parseLeadingComments(path, printer, format);
236
-
237
237
  // this is main thing
238
238
  maybePlugin(currentTraverse, path, printer, semantics);
239
239
  parseTrailingComments(path, printer, format);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "1.144.0",
3
+ "version": "1.145.0",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Simplest possible opinionated Babel AST printer for 🐊Putout",