@putout/printer 17.1.0 → 17.2.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,9 @@
1
+ 2026.02.11, v17.2.0
2
+
3
+ feature:
4
+ - 7cb116c @putout/printer: ArrayExpression: ObjectExpression, after StringLiteral/TemplateLiteral: indent
5
+ - 7a5f660 @putout/printer: eslint v10.0.0
6
+
1
7
  2026.02.01, v17.1.0
2
8
 
3
9
  feature:
@@ -4,10 +4,25 @@ import {isIndented} from '#is';
4
4
  const {
5
5
  isStringLiteral,
6
6
  isArrayExpression,
7
+ isObjectExpression,
8
+ isTemplateLiteral,
7
9
  } = types;
8
10
 
9
11
  export const isInsideArray = (path) => path.parentPath.isArrayExpression();
10
12
 
13
+ const isObjectAfterString = ([first, second]) => {
14
+ if (!first || !second)
15
+ return false;
16
+
17
+ if (!isObjectExpression(second))
18
+ return false;
19
+
20
+ if (isStringLiteral(first))
21
+ return true;
22
+
23
+ return isTemplateLiteral(first);
24
+ };
25
+
11
26
  export const isArrayIndented = (path) => {
12
27
  const elements = path.get('elements');
13
28
 
@@ -16,6 +31,9 @@ export const isArrayIndented = (path) => {
16
31
 
17
32
  const [first] = elements;
18
33
 
34
+ if (isObjectAfterString(elements))
35
+ return false;
36
+
19
37
  return !isTwoLongStrings(elements) || !isInsideArray(path) && isIndented(first);
20
38
  };
21
39
 
@@ -32,18 +32,18 @@ const maybeEscape = (value, {escapeDoubleQuote, escapeSingleQuote}) => {
32
32
  };
33
33
 
34
34
  const escape = (list, {slash, quote}) => {
35
- const res = [];
35
+ const result = [];
36
36
 
37
37
  for (const [index, char] of list.entries()) {
38
38
  const prev = list[index - 1];
39
39
 
40
40
  if (char === quote && prev !== slash) {
41
- res.push(`${slash}${char}`);
41
+ result.push(`${slash}${char}`);
42
42
  continue;
43
43
  }
44
44
 
45
- res.push(char);
45
+ result.push(char);
46
46
  }
47
47
 
48
- return res.join('');
48
+ return result.join('');
49
49
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "17.1.0",
3
+ "version": "17.2.0",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Simplest possible opinionated Babel AST printer for 🐊Putout",
@@ -72,7 +72,7 @@
72
72
  "c8": "^10.1.2",
73
73
  "check-dts": "^0.9.0",
74
74
  "escover": "^5.0.0",
75
- "eslint": "^9.0.0",
75
+ "eslint": "^10.0.0",
76
76
  "eslint-plugin-putout": "^30.0.0",
77
77
  "estree-to-babel": "^12.0.0",
78
78
  "goldstein": "^7.0.0",