putout 35.22.2 β†’ 35.22.4

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,13 @@
1
+ 2024.05.09, v35.22.4
2
+
3
+ fix:
4
+ - d376eb082 putout: always show ESLint parser error, even when 🐊Putout can parse
5
+
6
+ 2024.05.09, v35.22.3
7
+
8
+ feature:
9
+ - 6cb49e0b4 putout: cli: syntax lint: improve support of fn
10
+
1
11
  2024.05.08, v35.22.2
2
12
 
3
13
  feature:
@@ -6,10 +6,9 @@ const eslint = require('@putout/eslint');
6
6
  const {putoutAsync} = require('../..');
7
7
  const merge = require('../merge');
8
8
  const parseMatch = require('../parse-options/parse-match');
9
- const {lintSyntax} = require('./syntax/syntax');
10
9
 
10
+ const {simpleImport} = require('./simple-import');
11
11
  const parseError = require('./parse-error');
12
- const isParserError = ([a]) => a?.rule.includes('parser');
13
12
 
14
13
  const getMatchedOptions = (name, options) => {
15
14
  if (!name.includes('{'))
@@ -34,6 +33,8 @@ module.exports = ({fix, fixCount, isFlow, logError, raw, printer}) => async func
34
33
 
35
34
  if (!again && e) {
36
35
  raw && logError(e);
36
+
37
+ const {lintSyntax} = await simpleImport('./syntax/syntax.mjs');
37
38
  const {places, code} = await lintSyntax(source, {
38
39
  fix,
39
40
  isTS,
@@ -64,10 +65,7 @@ module.exports = ({fix, fixCount, isFlow, logError, raw, printer}) => async func
64
65
  fix,
65
66
  });
66
67
 
67
- const wasParserError = isParserError(newPlaces);
68
-
69
- if (e || !wasParserError)
70
- allPlaces.push(...newPlaces);
68
+ allPlaces.push(...newPlaces);
71
69
 
72
70
  const places = formatPlaces(startLine, allPlaces);
73
71
 
@@ -1,9 +1,7 @@
1
- 'use strict';
1
+ import tryCatch from 'try-catch';
2
+ import parseError from '../parse-error.js';
2
3
 
3
- const tryCatch = require('try-catch');
4
- const parseError = require('../parse-error');
5
-
6
- module.exports.lintSyntax = async (source, {fix, isTS}) => {
4
+ export const lintSyntax = async (source, {fix, isTS}) => {
7
5
  if (fix)
8
6
  return await syntaxFix(source);
9
7
 
@@ -13,8 +11,14 @@ module.exports.lintSyntax = async (source, {fix, isTS}) => {
13
11
  };
14
12
 
15
13
  async function syntaxFix(source) {
16
- const {compile} = await import('goldstein');
17
- const [error, code] = tryCatch(compile, source);
14
+ const {compile, keywords} = await import('goldstein');
15
+ const {keywordArrow, keywordIf} = keywords;
16
+ const [error, code] = tryCatch(compile, source, {
17
+ keywords: {
18
+ keywordArrow,
19
+ keywordIf,
20
+ },
21
+ });
18
22
 
19
23
  if (error)
20
24
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "putout",
3
- "version": "35.22.2",
3
+ "version": "35.22.4",
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",