putout 24.2.0 → 24.4.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 +66 -0
- package/lib/cli/eslint/index.js +2 -2
- package/lib/cli/index.js +31 -138
- package/lib/cli/process-file.js +2 -3
- package/lib/cli/runner/runner.js +49 -0
- package/lib/cli/runner/worker.js +146 -0
- package/package.json +9 -7
package/ChangeLog
CHANGED
|
@@ -1,3 +1,69 @@
|
|
|
1
|
+
2022.01.25, v24.4.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- (putout) cli: move out runner
|
|
5
|
+
- (@putout/eslint-config) padding-line-between-statements: add import
|
|
6
|
+
- (@putout/eslint-config) padding-line-between-statements: add export
|
|
7
|
+
- (@putout/eslint-config) enable operator-linebreak
|
|
8
|
+
- (@putout/test) add ESLint support
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
2022.01.24, v24.3.0
|
|
12
|
+
|
|
13
|
+
feature:
|
|
14
|
+
- (putout) eslint: add ability to enable putout/putout rule with a flag
|
|
15
|
+
- (putout/eslint) add ability to enable putout
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
2022.01.24, v24.2.2
|
|
19
|
+
|
|
20
|
+
fix:
|
|
21
|
+
- (@putout/plugin-declare-undefined-variables) node-js: exclude "promises" as it is to general
|
|
22
|
+
- (@putout/engine-runner) avoid duplication of plugins
|
|
23
|
+
|
|
24
|
+
feature:
|
|
25
|
+
- (package) @putout/plugin-convert-esm-to-commonjs v4.0.0
|
|
26
|
+
- (@putout/plugin-convert-esm-to-commonjs) drop support of putout < 24
|
|
27
|
+
- (@putout/plugin-convert-esm-to-commonjs) Commonjs -> CommonJS
|
|
28
|
+
- (@putout/engine-runner) add ability to debug with "putout:runner:replace"
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
2022.01.21, v24.2.1
|
|
32
|
+
|
|
33
|
+
fix:
|
|
34
|
+
- (@putout/test) avoid updating noTransform files
|
|
35
|
+
|
|
36
|
+
feature:
|
|
37
|
+
- (package) @putout/plugin-remove-useless-variables v6.0.0
|
|
38
|
+
- (@putout/plugin-remove-useless-variables) drop support of putout < 24
|
|
39
|
+
- (package) @putout/plugin-remove-unused-for-of-variables v2.0.0
|
|
40
|
+
- (package) @putout/plugin-convert-for-to-for-of v3.0.0
|
|
41
|
+
- (package) @putout/plugin-tape v8.0.0
|
|
42
|
+
- (@putout/plugin-tape) drop support of putout < 24
|
|
43
|
+
- (@putout/plugin-convert-for-to-for-of) drop support of putout < 24
|
|
44
|
+
- (package) @putout/operator-add-args v2.0.0
|
|
45
|
+
- (@putout/operator-add-args) drop support of putout < 24
|
|
46
|
+
- (@putout/operator-declare) improve variables declaration
|
|
47
|
+
- (package) @putout/plugin-remove-nested-blocks v5.0.0
|
|
48
|
+
- (@putout/plugin-remove-nested-blocks) drop support of putout < 24
|
|
49
|
+
- (package) @putout/plugin-putout v10.0.0
|
|
50
|
+
- (@putout/plugin-putout) drop support of putout < 24.2
|
|
51
|
+
- (package) @putout/plugin-merge-duplicate-imports v5.0.0
|
|
52
|
+
- (@putout/plugin-merge-duplicate-imports) drop support of putout < 24
|
|
53
|
+
- (package) @putout/plugin-merge-destructuring-properties v6.0.0
|
|
54
|
+
- (@putout/plugin-merge-destructuring-properties) drop support of putout < 24
|
|
55
|
+
- (package) @putout/plugin-extract-object-properties v7.0.0
|
|
56
|
+
- (@putout/plugin-extract-object-properties) drop support of putout < 24
|
|
57
|
+
- (package) @putout/plugin-convert-mock-require-to-mock-import v2.0.0
|
|
58
|
+
- (@putout/plugin-convert-mock-require-to-mock-import) drop support of putout < 24
|
|
59
|
+
- (package) @putout/plugin-convert-for-each-to-for-of v7.0.0
|
|
60
|
+
- (@putout/plugin-convert-for-each-to-for-of) drop support of putout < 24
|
|
61
|
+
- (package) @putout/plugin-convert-commonjs-to-esm v8.0.0
|
|
62
|
+
- (@putout/plugin-convert-commonjs-to-esm) drop support of putout < 24
|
|
63
|
+
- (package) @putout/operator-declare v3.0.0
|
|
64
|
+
- (@putout/operator-declare) drop support of putout < 24
|
|
65
|
+
|
|
66
|
+
|
|
1
67
|
2022.01.20, v24.2.0
|
|
2
68
|
|
|
3
69
|
fix:
|
package/lib/cli/eslint/index.js
CHANGED
|
@@ -49,7 +49,7 @@ const getESLint = ({fix, config}) => {
|
|
|
49
49
|
};
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
module.exports = async ({name, code, fix, config}) => {
|
|
52
|
+
module.exports = async ({name, code, fix, config, putout = false}) => {
|
|
53
53
|
const noChanges = [
|
|
54
54
|
code,
|
|
55
55
|
[],
|
|
@@ -81,7 +81,7 @@ module.exports = async ({name, code, fix, config}) => {
|
|
|
81
81
|
];
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
disablePutout(finalConfig);
|
|
84
|
+
!putout && disablePutout(finalConfig);
|
|
85
85
|
|
|
86
86
|
// that's right, we disabled "putout" rules in "config"
|
|
87
87
|
// and now it located in eslint's cache
|
package/lib/cli/index.js
CHANGED
|
@@ -1,50 +1,39 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const {resolve} = require('path');
|
|
4
|
-
const {readFileSync} = require('fs');
|
|
5
|
-
|
|
6
3
|
const {red} = require('chalk');
|
|
7
4
|
const yargsParser = require('yargs-parser');
|
|
8
5
|
const {isCI} = require('ci-info');
|
|
9
6
|
const memo = require('nano-memoize');
|
|
10
|
-
const fullstore = require('fullstore');
|
|
11
7
|
const tryCatch = require('try-catch');
|
|
12
|
-
const tryToCatch = require('try-to-catch');
|
|
13
8
|
const wraptile = require('wraptile');
|
|
9
|
+
const fullstore = require('fullstore');
|
|
10
|
+
|
|
11
|
+
const keyPress = require('@putout/cli-keypress');
|
|
14
12
|
const {version} = require('../../package.json');
|
|
15
13
|
const {simpleImport} = require('./simple-import');
|
|
16
|
-
|
|
17
|
-
const {env} = process;
|
|
18
|
-
const isIDE = /JetBrains/.test(env.TERMINAL_EMULATOR) || env.TERM_PROGRAM === 'vscode';
|
|
19
|
-
const chooseName = (name, resolvedName) => !isIDE ? name : resolvedName;
|
|
14
|
+
const {run} = require('./runner/runner.js');
|
|
20
15
|
|
|
21
16
|
const {
|
|
22
|
-
runProcessors,
|
|
23
17
|
getFilePatterns,
|
|
24
18
|
getProcessorRunners,
|
|
25
19
|
defaultProcessors,
|
|
26
20
|
} = require('@putout/engine-processor');
|
|
27
21
|
|
|
28
22
|
const merge = require('../merge');
|
|
29
|
-
const ignores = require('../ignores');
|
|
30
23
|
|
|
31
|
-
const initProcessFile = require('./process-file');
|
|
32
24
|
const getFiles = require('./get-files');
|
|
33
25
|
const {createCache} = require('@putout/cli-cache');
|
|
34
26
|
const supportedFiles = require('./supported-files');
|
|
35
27
|
const getFormatter = memo(require('./formatter').getFormatter);
|
|
36
28
|
const getOptions = require('./get-options');
|
|
37
|
-
|
|
38
|
-
const keyPress = require('@putout/cli-keypress');
|
|
29
|
+
|
|
39
30
|
const validateArgs = require('@putout/cli-validate-args');
|
|
40
|
-
const parseError = require('./parse-error');
|
|
41
31
|
|
|
42
32
|
const {
|
|
43
33
|
OK,
|
|
44
34
|
PLACE,
|
|
45
35
|
STAGE,
|
|
46
36
|
NO_FILES,
|
|
47
|
-
NO_PROCESSORS,
|
|
48
37
|
CANNOT_LOAD_PROCESSOR,
|
|
49
38
|
WAS_STOP,
|
|
50
39
|
INVALID_OPTION,
|
|
@@ -64,20 +53,6 @@ const getExitCode = (wasStop) => wasStop() ? WAS_STOP : OK;
|
|
|
64
53
|
|
|
65
54
|
const isStr = (a) => typeof a === 'string';
|
|
66
55
|
const {isArray} = Array;
|
|
67
|
-
const isParser = (rule) => /^parser/.test(rule);
|
|
68
|
-
const isParsingError = ({rule}) => isParser(rule);
|
|
69
|
-
|
|
70
|
-
const createFormatterProxy = (options) => {
|
|
71
|
-
return new Proxy(options, {
|
|
72
|
-
get(target, name) {
|
|
73
|
-
if (target[name])
|
|
74
|
-
return target[name];
|
|
75
|
-
|
|
76
|
-
if (name === 'source')
|
|
77
|
-
return readFileSync(target.name, 'utf8');
|
|
78
|
-
},
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
56
|
|
|
82
57
|
module.exports = async ({argv, halt, log, write, logError, readFile, writeFile}) => {
|
|
83
58
|
const {isStop} = keyPress();
|
|
@@ -299,114 +274,29 @@ module.exports = async ({argv, halt, log, write, logError, readFile, writeFile})
|
|
|
299
274
|
plugins,
|
|
300
275
|
};
|
|
301
276
|
|
|
302
|
-
const rawPlaces =
|
|
277
|
+
const {rawPlaces, exited} = await run({
|
|
278
|
+
fix,
|
|
279
|
+
exit,
|
|
280
|
+
readFile,
|
|
281
|
+
writeFile,
|
|
282
|
+
raw,
|
|
283
|
+
rulesdir,
|
|
284
|
+
names,
|
|
285
|
+
options,
|
|
286
|
+
fileCache,
|
|
287
|
+
currentFormat,
|
|
288
|
+
formatterOptions,
|
|
289
|
+
write,
|
|
290
|
+
log,
|
|
291
|
+
isStop,
|
|
292
|
+
wasStop,
|
|
293
|
+
noConfig,
|
|
294
|
+
plugins,
|
|
295
|
+
transform,
|
|
296
|
+
});
|
|
303
297
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
for (let index = 0; index < length; index++) {
|
|
308
|
-
if (wasStop())
|
|
309
|
-
break;
|
|
310
|
-
|
|
311
|
-
wasStop(isStop());
|
|
312
|
-
|
|
313
|
-
const currentIndex = isStop() ? length - 1 : index;
|
|
314
|
-
const name = names[index];
|
|
315
|
-
const resolvedName = resolve(name)
|
|
316
|
-
.replace(/^\./, cwd);
|
|
317
|
-
|
|
318
|
-
const [configError, options] = tryCatch(getOptions, {
|
|
319
|
-
name: resolvedName,
|
|
320
|
-
rulesdir,
|
|
321
|
-
noConfig,
|
|
322
|
-
transform,
|
|
323
|
-
plugins,
|
|
324
|
-
});
|
|
325
|
-
|
|
326
|
-
if (configError)
|
|
327
|
-
return exit(INVALID_CONFIG, configError);
|
|
328
|
-
|
|
329
|
-
const {dir} = options;
|
|
330
|
-
|
|
331
|
-
if (fileCache.canUseCache(name, options)) {
|
|
332
|
-
const places = fileCache.getPlaces(name);
|
|
333
|
-
const formatterProxy = createFormatterProxy({
|
|
334
|
-
report,
|
|
335
|
-
formatterOptions,
|
|
336
|
-
name: chooseName(name, resolvedName),
|
|
337
|
-
places,
|
|
338
|
-
index: currentIndex,
|
|
339
|
-
count: length,
|
|
340
|
-
});
|
|
341
|
-
|
|
342
|
-
const line = await report(currentFormat, formatterProxy);
|
|
343
|
-
|
|
344
|
-
write(line || '');
|
|
345
|
-
rawPlaces.push(places);
|
|
346
|
-
continue;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
let isProcessed = true;
|
|
350
|
-
let places = [];
|
|
351
|
-
let rawSource = '';
|
|
352
|
-
let processedSource = '';
|
|
353
|
-
|
|
354
|
-
if (!ignores(dir, resolvedName, options)) {
|
|
355
|
-
rawSource = await readFile(resolvedName, 'utf8');
|
|
356
|
-
|
|
357
|
-
const [error, result] = await tryToCatch(runProcessors, {
|
|
358
|
-
name: resolvedName,
|
|
359
|
-
fix,
|
|
360
|
-
processFile,
|
|
361
|
-
options,
|
|
362
|
-
rawSource,
|
|
363
|
-
processorRunners,
|
|
364
|
-
});
|
|
365
|
-
|
|
366
|
-
if (error) {
|
|
367
|
-
places = parseError(error);
|
|
368
|
-
|
|
369
|
-
isProcessed = true;
|
|
370
|
-
processedSource = rawSource;
|
|
371
|
-
|
|
372
|
-
if (raw)
|
|
373
|
-
log(error);
|
|
374
|
-
} else {
|
|
375
|
-
({
|
|
376
|
-
isProcessed,
|
|
377
|
-
places,
|
|
378
|
-
processedSource,
|
|
379
|
-
} = result);
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
const line = await report(currentFormat, {
|
|
384
|
-
report,
|
|
385
|
-
formatterOptions,
|
|
386
|
-
name: chooseName(name, resolvedName),
|
|
387
|
-
source: rawSource,
|
|
388
|
-
places,
|
|
389
|
-
index: currentIndex,
|
|
390
|
-
count: length,
|
|
391
|
-
});
|
|
392
|
-
|
|
393
|
-
write(line || '');
|
|
394
|
-
|
|
395
|
-
if (!isProcessed)
|
|
396
|
-
return exit(NO_PROCESSORS, Error(`No processors found for ${name}`));
|
|
397
|
-
|
|
398
|
-
if (rawSource !== processedSource) {
|
|
399
|
-
fileCache.removeEntry(name);
|
|
400
|
-
await writeFile(name, processedSource);
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
const fixable = !places.filter(isParsingError).length;
|
|
404
|
-
|
|
405
|
-
if (fixable)
|
|
406
|
-
fileCache.setInfo(name, places, options);
|
|
407
|
-
|
|
408
|
-
rawPlaces.push(places);
|
|
409
|
-
}
|
|
298
|
+
if (exited)
|
|
299
|
+
return;
|
|
410
300
|
|
|
411
301
|
const mergedPlaces = merge(...rawPlaces);
|
|
412
302
|
|
|
@@ -445,6 +335,10 @@ const getExit = ({halt, raw, logError}) => (code, e) => {
|
|
|
445
335
|
|
|
446
336
|
logError(message);
|
|
447
337
|
halt(code);
|
|
338
|
+
|
|
339
|
+
return {
|
|
340
|
+
exited: true,
|
|
341
|
+
};
|
|
448
342
|
};
|
|
449
343
|
|
|
450
344
|
module.exports._addOnce = addOnce;
|
|
@@ -452,4 +346,3 @@ function addOnce(emitter, name, fn) {
|
|
|
452
346
|
if (!emitter.listenerCount(name))
|
|
453
347
|
emitter.on(name, fn);
|
|
454
348
|
}
|
|
455
|
-
|
package/lib/cli/process-file.js
CHANGED
|
@@ -3,13 +3,12 @@
|
|
|
3
3
|
const tryCatch = require('try-catch');
|
|
4
4
|
|
|
5
5
|
const putout = require('../..');
|
|
6
|
+
const merge = require('../merge');
|
|
7
|
+
const parseMatch = require('../parse-options/parse-match');
|
|
6
8
|
|
|
7
9
|
const eslint = require('./eslint');
|
|
8
10
|
const parseError = require('./parse-error');
|
|
9
11
|
|
|
10
|
-
const merge = require('../merge');
|
|
11
|
-
const parseMatch = require('../parse-options/parse-match');
|
|
12
|
-
|
|
13
12
|
const getMatchedOptions = (name, options) => {
|
|
14
13
|
if (!name.includes('{'))
|
|
15
14
|
return options;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const runWorker = require('./worker.js');
|
|
4
|
+
const initProcessFile = require('../process-file.js');
|
|
5
|
+
const Report = require('../report.js');
|
|
6
|
+
|
|
7
|
+
const report = Report();
|
|
8
|
+
|
|
9
|
+
module.exports.run = async ({transform, plugins, noConfig, readFile, writeFile, exit, isStop, wasStop, names, write, log, rulesdir, fix, processorRunners, fileCache, currentFormat, formatterOptions, options, raw}) => {
|
|
10
|
+
const processFile = initProcessFile(options);
|
|
11
|
+
const {length} = names;
|
|
12
|
+
const rawPlaces = [];
|
|
13
|
+
|
|
14
|
+
for (let index = 0; index < length; index++) {
|
|
15
|
+
if (wasStop())
|
|
16
|
+
break;
|
|
17
|
+
|
|
18
|
+
const {exited} = await runWorker({
|
|
19
|
+
readFile,
|
|
20
|
+
writeFile,
|
|
21
|
+
exit,
|
|
22
|
+
isStop,
|
|
23
|
+
wasStop,
|
|
24
|
+
fix,
|
|
25
|
+
processorRunners,
|
|
26
|
+
rulesdir,
|
|
27
|
+
currentFormat,
|
|
28
|
+
formatterOptions,
|
|
29
|
+
index,
|
|
30
|
+
names,
|
|
31
|
+
length,
|
|
32
|
+
rawPlaces,
|
|
33
|
+
processFile,
|
|
34
|
+
fileCache,
|
|
35
|
+
raw,
|
|
36
|
+
write,
|
|
37
|
+
log,
|
|
38
|
+
report,
|
|
39
|
+
noConfig,
|
|
40
|
+
plugins,
|
|
41
|
+
transform,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
if (exited)
|
|
45
|
+
return {exited, rawPlaces};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return {rawPlaces};
|
|
49
|
+
};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const {resolve} = require('path');
|
|
4
|
+
const {
|
|
5
|
+
cwd,
|
|
6
|
+
env,
|
|
7
|
+
} = require('process');
|
|
8
|
+
const tryCatch = require('try-catch');
|
|
9
|
+
const {readFileSync} = require('fs');
|
|
10
|
+
const tryToCatch = require('try-to-catch');
|
|
11
|
+
const {runProcessors} = require('@putout/engine-processor');
|
|
12
|
+
|
|
13
|
+
const parseError = require('../parse-error.js');
|
|
14
|
+
const getOptions = require('../get-options.js');
|
|
15
|
+
const {
|
|
16
|
+
INVALID_CONFIG,
|
|
17
|
+
NO_PROCESSORS,
|
|
18
|
+
} = require('../exit-codes.js');
|
|
19
|
+
const ignores = require('../../ignores.js');
|
|
20
|
+
|
|
21
|
+
const isParser = (rule) => /^parser/.test(rule);
|
|
22
|
+
const isParsingError = ({rule}) => isParser(rule);
|
|
23
|
+
const chooseName = (name, resolvedName) => !isIDE ? name : resolvedName;
|
|
24
|
+
const isIDE = /JetBrains/.test(env.TERMINAL_EMULATOR) || env.TERM_PROGRAM === 'vscode';
|
|
25
|
+
|
|
26
|
+
const createFormatterProxy = (options) => {
|
|
27
|
+
return new Proxy(options, {
|
|
28
|
+
get(target, name) {
|
|
29
|
+
if (target[name])
|
|
30
|
+
return target[name];
|
|
31
|
+
|
|
32
|
+
if (name === 'source')
|
|
33
|
+
return readFileSync(target.name, 'utf8');
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
module.exports = async ({readFile, report, writeFile, exit, raw, write, log, currentFormat, rulesdir, formatterOptions, noConfig, transform, plugins, index, fix, processFile, processorRunners, fileCache, rawPlaces, wasStop, isStop, names, length}) => {
|
|
39
|
+
wasStop(isStop());
|
|
40
|
+
|
|
41
|
+
const currentIndex = isStop() ? length - 1 : index;
|
|
42
|
+
const name = names[index];
|
|
43
|
+
const resolvedName = resolve(name)
|
|
44
|
+
.replace(/^\./, cwd);
|
|
45
|
+
|
|
46
|
+
const [configError, options] = tryCatch(getOptions, {
|
|
47
|
+
name: resolvedName,
|
|
48
|
+
rulesdir,
|
|
49
|
+
noConfig,
|
|
50
|
+
transform,
|
|
51
|
+
plugins,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
if (configError)
|
|
55
|
+
return exit(INVALID_CONFIG, configError);
|
|
56
|
+
|
|
57
|
+
const {dir} = options;
|
|
58
|
+
|
|
59
|
+
if (fileCache.canUseCache(name, options)) {
|
|
60
|
+
const places = fileCache.getPlaces(name);
|
|
61
|
+
const formatterProxy = createFormatterProxy({
|
|
62
|
+
report,
|
|
63
|
+
formatterOptions,
|
|
64
|
+
name: chooseName(name, resolvedName),
|
|
65
|
+
places,
|
|
66
|
+
index: currentIndex,
|
|
67
|
+
count: length,
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const line = await report(currentFormat, formatterProxy);
|
|
71
|
+
|
|
72
|
+
write(line || '');
|
|
73
|
+
rawPlaces.push(places);
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
success: true,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
let isProcessed = true;
|
|
81
|
+
let places = [];
|
|
82
|
+
let rawSource = '';
|
|
83
|
+
let processedSource = '';
|
|
84
|
+
|
|
85
|
+
if (!ignores(dir, resolvedName, options)) {
|
|
86
|
+
rawSource = await readFile(resolvedName, 'utf8');
|
|
87
|
+
|
|
88
|
+
const [error, result] = await tryToCatch(runProcessors, {
|
|
89
|
+
name: resolvedName,
|
|
90
|
+
fix,
|
|
91
|
+
processFile,
|
|
92
|
+
options,
|
|
93
|
+
rawSource,
|
|
94
|
+
processorRunners,
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
if (error) {
|
|
98
|
+
places = parseError(error);
|
|
99
|
+
|
|
100
|
+
isProcessed = true;
|
|
101
|
+
processedSource = rawSource;
|
|
102
|
+
|
|
103
|
+
if (raw)
|
|
104
|
+
log(error);
|
|
105
|
+
} else {
|
|
106
|
+
({
|
|
107
|
+
isProcessed,
|
|
108
|
+
places,
|
|
109
|
+
processedSource,
|
|
110
|
+
} = result);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const line = await report(currentFormat, {
|
|
115
|
+
report,
|
|
116
|
+
formatterOptions,
|
|
117
|
+
name: chooseName(name, resolvedName),
|
|
118
|
+
source: rawSource,
|
|
119
|
+
places,
|
|
120
|
+
index: currentIndex,
|
|
121
|
+
count: length,
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
write(line || '');
|
|
125
|
+
|
|
126
|
+
if (!isProcessed)
|
|
127
|
+
return exit(NO_PROCESSORS, Error(`No processors found for ${name}`));
|
|
128
|
+
|
|
129
|
+
if (rawSource !== processedSource) {
|
|
130
|
+
fileCache.removeEntry(name);
|
|
131
|
+
await writeFile(name, processedSource);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const fixable = !places.filter(isParsingError).length;
|
|
135
|
+
|
|
136
|
+
if (fixable)
|
|
137
|
+
fileCache.setInfo(name, places, options);
|
|
138
|
+
|
|
139
|
+
rawPlaces.push(places);
|
|
140
|
+
|
|
141
|
+
return {
|
|
142
|
+
rawPlaces,
|
|
143
|
+
success: true,
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "putout",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.4.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 and babel plugins support of js, jsx typescript, flow files, markdown, yaml and json",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"./process-file": "./lib/cli/process-file.js",
|
|
17
17
|
"./exit-codes": "./lib/cli/exit-codes.mjs",
|
|
18
18
|
"./cli": "./lib/cli/index.js",
|
|
19
|
+
"./cli/run": "./lib/cli/runner/work",
|
|
19
20
|
"./loader": "./lib/loader.mjs",
|
|
20
21
|
"./eslint": "./lib/cli/eslint/index.js",
|
|
21
22
|
"./package.json": "./package.json"
|
|
@@ -66,7 +67,7 @@
|
|
|
66
67
|
"@putout/formatter-progress-bar": "^2.0.0",
|
|
67
68
|
"@putout/formatter-stream": "^3.0.0",
|
|
68
69
|
"@putout/operate": "^7.0.0",
|
|
69
|
-
"@putout/operator-add-args": "^
|
|
70
|
+
"@putout/operator-add-args": "^2.0.0",
|
|
70
71
|
"@putout/operator-declare": "^3.0.0",
|
|
71
72
|
"@putout/operator-regexp": "^1.0.0",
|
|
72
73
|
"@putout/plugin-apply-await-import": "^1.0.0",
|
|
@@ -86,10 +87,10 @@
|
|
|
86
87
|
"@putout/plugin-convert-comparison-to-boolean": "^2.0.0",
|
|
87
88
|
"@putout/plugin-convert-concat-to-flat": "^1.0.0",
|
|
88
89
|
"@putout/plugin-convert-equal-to-strict-equal": "^1.0.0",
|
|
89
|
-
"@putout/plugin-convert-esm-to-commonjs": "^
|
|
90
|
+
"@putout/plugin-convert-esm-to-commonjs": "^4.0.0",
|
|
90
91
|
"@putout/plugin-convert-for-each-to-for-of": "^7.0.0",
|
|
91
92
|
"@putout/plugin-convert-for-in-to-for-of": "^2.0.0",
|
|
92
|
-
"@putout/plugin-convert-for-to-for-of": "^
|
|
93
|
+
"@putout/plugin-convert-for-to-for-of": "^3.0.0",
|
|
93
94
|
"@putout/plugin-convert-index-of-to-includes": "^1.0.0",
|
|
94
95
|
"@putout/plugin-convert-map-to-for-of": "^1.0.0",
|
|
95
96
|
"@putout/plugin-convert-math-pow": "^4.0.0",
|
|
@@ -130,7 +131,7 @@
|
|
|
130
131
|
"@putout/plugin-remove-unreachable-code": "^1.0.0",
|
|
131
132
|
"@putout/plugin-remove-unreferenced-variables": "^1.0.0",
|
|
132
133
|
"@putout/plugin-remove-unused-expressions": "^4.0.0",
|
|
133
|
-
"@putout/plugin-remove-unused-for-of-variables": "^
|
|
134
|
+
"@putout/plugin-remove-unused-for-of-variables": "^2.0.0",
|
|
134
135
|
"@putout/plugin-remove-unused-private-fields": "^1.0.0",
|
|
135
136
|
"@putout/plugin-remove-unused-variables": "*",
|
|
136
137
|
"@putout/plugin-remove-useless-arguments": "^5.0.0",
|
|
@@ -151,7 +152,7 @@
|
|
|
151
152
|
"@putout/plugin-remove-useless-template-expressions": "^1.0.0",
|
|
152
153
|
"@putout/plugin-remove-useless-type-conversion": "^1.0.0",
|
|
153
154
|
"@putout/plugin-remove-useless-typeof": "^1.0.0",
|
|
154
|
-
"@putout/plugin-remove-useless-variables": "^
|
|
155
|
+
"@putout/plugin-remove-useless-variables": "^6.0.0",
|
|
155
156
|
"@putout/plugin-reuse-duplicate-init": "^3.0.0",
|
|
156
157
|
"@putout/plugin-simplify-assignment": "^1.0.0",
|
|
157
158
|
"@putout/plugin-simplify-logical-expressions": "^1.0.0",
|
|
@@ -159,7 +160,7 @@
|
|
|
159
160
|
"@putout/plugin-split-nested-destructuring": "^1.0.0",
|
|
160
161
|
"@putout/plugin-split-variable-declarations": "^2.0.0",
|
|
161
162
|
"@putout/plugin-strict-mode": "^2.0.0",
|
|
162
|
-
"@putout/plugin-tape": "^
|
|
163
|
+
"@putout/plugin-tape": "^8.0.0",
|
|
163
164
|
"@putout/plugin-typescript": "^1.0.0",
|
|
164
165
|
"@putout/plugin-webpack": "^1.0.0",
|
|
165
166
|
"@putout/processor-css": "^3.0.0",
|
|
@@ -184,6 +185,7 @@
|
|
|
184
185
|
"nano-memoize": "^1.1.11",
|
|
185
186
|
"once": "^1.4.0",
|
|
186
187
|
"picomatch": "^2.2.2",
|
|
188
|
+
"thread-it": "^1.1.3",
|
|
187
189
|
"try-catch": "^3.0.0",
|
|
188
190
|
"try-to-catch": "^3.0.0",
|
|
189
191
|
"wraptile": "^3.0.0",
|