putout 35.22.2 → 35.22.3

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,8 @@
1
+ 2024.05.09, v35.22.3
2
+
3
+ feature:
4
+ - 6cb49e0b4 putout: cli: syntax lint: improve support of fn
5
+
1
6
  2024.05.08, v35.22.2
2
7
 
3
8
  feature:
@@ -6,8 +6,8 @@ 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
12
  const isParserError = ([a]) => a?.rule.includes('parser');
13
13
 
@@ -34,6 +34,8 @@ module.exports = ({fix, fixCount, isFlow, logError, raw, printer}) => async func
34
34
 
35
35
  if (!again && e) {
36
36
  raw && logError(e);
37
+
38
+ const {lintSyntax} = await simpleImport('./syntax/syntax.mjs');
37
39
  const {places, code} = await lintSyntax(source, {
38
40
  fix,
39
41
  isTS,
@@ -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.3",
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",