putout 32.5.0 → 32.7.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,32 @@
1
+ 2023.10.28, v32.7.0
2
+
3
+ feature:
4
+ - ca284d35c package: @putout/plugin-logical-expressions v5.0.0
5
+ - ad44b4283 @putout/plugin-logical-expressions: drop support of 🐊 < 32
6
+ - ecd39020e putout: printer: add ability to handle endOfFile in markdown listings without ESLint
7
+ - 7587c2c4c package: @putout/plugin-regexp v8.0.0
8
+ - a4110ac0c @putout/plugin-regexp: drop support of 🐊 < 32
9
+ - 798576371 package: @putout/printer v6.0.0
10
+
11
+ 2023.10.28, v32.6.0
12
+
13
+ fix:
14
+ - 87b010708 @putou/eslint-config: drop @stylistic
15
+ - fa74ea3af @putout/eslint-config: @stylistic
16
+ - 6683113da @putout/test: format with UPDATE: wrong options
17
+
18
+ feature:
19
+ - 1d4d5a7a0 package: @putout/plugin-regexp v8.0.0
20
+ - 715060684 @putout/plugin-regexp: drop support of 🐊 < 32
21
+ - f804763dc package: @putout/printer v6.0.0
22
+ - e8a190841 package: @stylistic/eslint-plugin-jsx v0.1.1
23
+ - 295e2b0b0 package: eslint-plugin-putout v21.0.0
24
+ - 52f114390 eslint-plugin-putout: @putout/eslint-config v8
25
+ - fc0e9d6cf @putout/eslint-config: use @stylistic (https://eslint.org/blog/2023/10/deprecating-formatting-rules/)
26
+ - 0ed5144c1 package: hermes-parser v0.17.0
27
+ - 15a88dfaf package: hermes-parser v0.17.0
28
+ - 160b5341e @putout/plugin-printer: remove-args: maybe.write.breakline()
29
+
1
30
  2023.10.23, v32.5.0
2
31
 
3
32
  feature:
@@ -0,0 +1,25 @@
1
+ const {assign} = Object;
2
+ const {isArray} = Array;
3
+ const maybeArray = (a) => isArray(a) ? a : [a];
4
+
5
+ const DefaultMarkdown = {
6
+ format: {
7
+ endOfFile: '',
8
+ },
9
+ };
10
+
11
+ export const configurePrinter = (name, printerOptions) => {
12
+ const [printer = 'putout', options = {}] = maybeArray(printerOptions);
13
+
14
+ if (printer !== 'putout')
15
+ return printerOptions;
16
+
17
+ if (name.endsWith('.md{json}'))
18
+ assign(options, DefaultMarkdown);
19
+ else if (name.endsWith('.md{js}'))
20
+ assign(options, DefaultMarkdown);
21
+ else if (name.endsWith('.md{ts}'))
22
+ assign(options, DefaultMarkdown);
23
+
24
+ return [printer, options];
25
+ };
@@ -17,6 +17,7 @@ const getMatchedOptions = (name, options) => {
17
17
  };
18
18
 
19
19
  module.exports = ({fix, fixCount, isFlow, logError, raw, printer}) => async ({name, source, startLine, options}) => {
20
+ const {configurePrinter} = await import('./printer/printer.mjs');
20
21
  const isTS = /\.tsx?$/.test(name) || /{tsx?}$/.test(name);
21
22
  const matchedOptions = getMatchedOptions(name, options);
22
23
 
@@ -25,8 +26,8 @@ module.exports = ({fix, fixCount, isFlow, logError, raw, printer}) => async ({na
25
26
  fixCount,
26
27
  isTS,
27
28
  isFlow,
28
- printer,
29
29
  ...matchedOptions,
30
+ printer: configurePrinter(name, printer),
30
31
  });
31
32
 
32
33
  if (e) {
package/lib/putout.mjs CHANGED
@@ -5,4 +5,3 @@ export * from './putout.js';
5
5
  export default function(...a) {
6
6
  return putout(...a);
7
7
  }
8
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "putout",
3
- "version": "32.5.0",
3
+ "version": "32.7.0",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "🐊 Pluggable and configurable code transformer with built-in ESLint, Babel and support of js, jsx, typescript, flow, markdown, yaml and json",
@@ -105,7 +105,7 @@
105
105
  "@putout/plugin-for-of": "^3.0.0",
106
106
  "@putout/plugin-github": "^9.0.0",
107
107
  "@putout/plugin-gitignore": "^3.0.0",
108
- "@putout/plugin-logical-expressions": "^4.0.0",
108
+ "@putout/plugin-logical-expressions": "^5.0.0",
109
109
  "@putout/plugin-madrun": "^17.0.0",
110
110
  "@putout/plugin-math": "^2.0.0",
111
111
  "@putout/plugin-maybe": "^1.0.0",
@@ -120,7 +120,7 @@
120
120
  "@putout/plugin-promises": "^13.0.0",
121
121
  "@putout/plugin-putout": "^15.0.0",
122
122
  "@putout/plugin-putout-config": "^3.0.0",
123
- "@putout/plugin-regexp": "^7.0.0",
123
+ "@putout/plugin-regexp": "^8.0.0",
124
124
  "@putout/plugin-remove-console": "^6.0.0",
125
125
  "@putout/plugin-remove-constant-conditions": "^4.0.0",
126
126
  "@putout/plugin-remove-debugger": "^5.0.0",
@@ -207,7 +207,7 @@
207
207
  "escover": "^3.2.2",
208
208
  "eslint": "^8.0.1",
209
209
  "eslint-plugin-n": "^16.0.0",
210
- "eslint-plugin-putout": "^20.0.0",
210
+ "eslint-plugin-putout": "^21.0.0",
211
211
  "just-camel-case": "^4.0.2",
212
212
  "lerna": "^6.0.1",
213
213
  "madrun": "^9.0.0",