@putout/printer 8.10.0 → 8.11.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,15 @@
1
+ 2024.04.09, v8.11.0
2
+
3
+ feature:
4
+ - 914b94a @putout/printer: ImportDeclaration: when there is couple specifiers and one of them renamed - always write each on separate line
5
+ - c1961a5 @putout/printer: eslint-plugin-n v17.0.0
6
+ - abd17d5 @putout/printer: eslint v9.0.0
7
+
8
+ 2024.04.06, v8.10.1
9
+
10
+ feature:
11
+ - 079b1ad @putout/printer: TSExportAssignment: add newline when has next
12
+
1
13
  2024.04.04, v8.10.0
2
14
 
3
15
  feature:
@@ -16,7 +16,6 @@ module.exports.ImportDeclaration = {
16
16
  const {phase} = path.node;
17
17
  const isType = path.node.importKind === 'type';
18
18
  const specifiers = path.get('specifiers');
19
- const {maxSpecifiersInOneLine} = options;
20
19
 
21
20
  indent();
22
21
  write('import');
@@ -45,6 +44,7 @@ module.exports.ImportDeclaration = {
45
44
  traverse(spec.get('local'));
46
45
  }
47
46
 
47
+ const maxSpecifiersInOneLine = parseMaxSpecifiers(imports, options);
48
48
  const importsCount = imports.length - 1;
49
49
 
50
50
  for (const [index, spec] of imports.entries()) {
@@ -109,3 +109,14 @@ module.exports.ImportDeclaration = {
109
109
  markAfter(path);
110
110
  },
111
111
  };
112
+
113
+ function parseMaxSpecifiers(imports, options) {
114
+ const {maxSpecifiersInOneLine} = options;
115
+
116
+ for (const {node} of imports) {
117
+ if (node.imported.name !== node.local.name)
118
+ return 0;
119
+ }
120
+
121
+ return maxSpecifiersInOneLine;
122
+ }
@@ -1,7 +1,15 @@
1
1
  'use strict';
2
2
 
3
- module.exports.TSExportAssignment = (path, {print}) => {
4
- print('export = ');
5
- print('__expression');
6
- print(';');
3
+ const {isNext} = require('../../is');
4
+
5
+ module.exports.TSExportAssignment = {
6
+ print: (path, {print}) => {
7
+ print('export = ');
8
+ print('__expression');
9
+ print(';');
10
+ },
11
+ afterSatisfy: () => [isNext],
12
+ after: (path, {print}) => {
13
+ print.newline();
14
+ },
7
15
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/printer",
3
- "version": "8.10.0",
3
+ "version": "8.11.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",
@@ -55,8 +55,8 @@
55
55
  "c8": "^9.1.0",
56
56
  "check-dts": "^0.7.2",
57
57
  "escover": "^4.0.1",
58
- "eslint": "^8.0.1",
59
- "eslint-plugin-n": "^16.0.0",
58
+ "eslint": "^9.0.0",
59
+ "eslint-plugin-n": "^17.0.0",
60
60
  "eslint-plugin-putout": "^22.0.0",
61
61
  "estree-to-babel": "^9.0.0",
62
62
  "just-kebab-case": "^4.2.0",