putout 35.20.0 → 35.21.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,26 @@
1
+ 2024.05.06, v35.21.0
2
+
3
+ fix:
4
+ - 8b22f546d @putout/processor-yaml: lineWidth: 80 -> Infinity
5
+
6
+ feature:
7
+ - 68404b101 putout: add ability to autofix syntax
8
+ - 7367fd174 @putout/plugin-react: remove-useless-forward-ref: add
9
+ - 522b92c5a @putout/plugin-apply-overrides: improve support of one-two arguments
10
+ - d86f10109 @putout/plugin-react: remove-implicit-ref-return: add
11
+ - 6064290d3 eslint-plugin-putout: long-properties-destructuring: exclude ImportDefaultSpecifier
12
+ - 2d6890984 @putout/plugin-react: add
13
+
14
+ 2024.05.06, v35.20.1
15
+
16
+ fix:
17
+ - 44635b9f3 putout: config: eslint/apply-match-to-flat: disable for .eslintrc.js
18
+
19
+ feature:
20
+ - 4d75b9c9f putout: @putout/plugin-for-of v5.0.0
21
+ - b1b9aa23b @putout/plugin-for-of: drop support of 🐊 < 35
22
+ - dd29a5a0b @putout/plugin-for-of: for-each: exclude ConditionalExpression (coderaiser/minify#122)
23
+
1
24
  2024.05.05, v35.20.0
2
25
 
3
26
  feature:
@@ -7,6 +7,7 @@ const quickLint = require('@putout/quick-lint');
7
7
  const {putoutAsync} = require('../..');
8
8
  const merge = require('../merge');
9
9
  const parseMatch = require('../parse-options/parse-match');
10
+ const {syntaxFix} = require('./syntax/syntax');
10
11
 
11
12
  const parseError = require('./parse-error');
12
13
 
@@ -31,7 +32,7 @@ module.exports = ({fix, fixCount, isFlow, logError, raw, printer}) => async ({na
31
32
  printer: configurePrinter(name, printer),
32
33
  });
33
34
 
34
- if (e) {
35
+ if (e && !fix) {
35
36
  raw && logError(e);
36
37
  const quickLintPlaces = await quickLint(source, {
37
38
  isTS,
@@ -45,6 +46,9 @@ module.exports = ({fix, fixCount, isFlow, logError, raw, printer}) => async ({na
45
46
  };
46
47
  }
47
48
 
49
+ if (e && fix)
50
+ return await syntaxFix(source);
51
+
48
52
  const {code = source} = result || {};
49
53
  const allPlaces = result ? result.places : parseError(e);
50
54
 
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ module.exports.syntaxFix = async (source) => {
4
+ const {parse, print} = await import('goldstein');
5
+
6
+ const code = print(parse(source));
7
+
8
+ return {
9
+ code,
10
+ places: [],
11
+ };
12
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "putout",
3
- "version": "35.20.0",
3
+ "version": "35.21.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",
@@ -197,6 +197,7 @@
197
197
  "fast-glob": "^3.2.2",
198
198
  "find-up": "^7.0.0",
199
199
  "fullstore": "^3.0.0",
200
+ "goldstein": "^5.3.0",
200
201
  "ignore": "^5.0.4",
201
202
  "is-relative": "^1.0.0",
202
203
  "nano-memoize": "^3.0.11",
package/putout.json CHANGED
@@ -102,7 +102,8 @@
102
102
  },
103
103
  ".eslintrc{*,.json}": {
104
104
  "eslint": "on",
105
- "eslint/convert-require-to-import": "off"
105
+ "eslint/convert-require-to-import": "off",
106
+ "eslint/apply-match-to-flat": "off"
106
107
  },
107
108
  "eslint.config.*": {
108
109
  "eslint": "on"