putout 24.2.2 → 24.6.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 +63 -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 +6 -5
package/ChangeLog
CHANGED
|
@@ -1,3 +1,66 @@
|
|
|
1
|
+
2022.02.07, v24.6.0
|
|
2
|
+
|
|
3
|
+
fix:
|
|
4
|
+
- (eslint-plugin-putout) remove parent: after parse -> before print
|
|
5
|
+
- (eslint-plugin-putout) npmignore: add lib/**/*.md
|
|
6
|
+
- chore(madrun) add fresh:fix
|
|
7
|
+
|
|
8
|
+
feature:
|
|
9
|
+
- (package) @putout/plugin-remove-empty v7.0.0
|
|
10
|
+
- (package) @putout/plugin-promises v7.0.0
|
|
11
|
+
- (@putout/plugin-remove-empty) drop support of 🐊Putout < 24
|
|
12
|
+
- (@putout/plugin-remove-empty) merge remove-empty-pattern
|
|
13
|
+
- (@putout/plugin-promises) merge remove-useless-await
|
|
14
|
+
- (@putout/plugin-promises) merged remove-useless-async
|
|
15
|
+
- (@putout/plugin-promises) drop support of 🐊Putout < 24
|
|
16
|
+
- (@putout/plugin-promises) merged apply-top-level-await
|
|
17
|
+
- (@putout/plugin-remove-useless-variables) destruct: add support of AssignmentPattern
|
|
18
|
+
- (@putout/plugin-remove-useless-variables) destr: add support of RestElement
|
|
19
|
+
- (eslint-plugin-putout) function-declaration-parent-newline: improve support of destructuring
|
|
20
|
+
- (@putout/engine-parser) add support of wasm-based hermes-parser (5 times slower then babel 🤔)
|
|
21
|
+
- (@putout/plugin-remove-unused-variables) add support of ClassProperty (#96)
|
|
22
|
+
- (@putout/plugin-apply-try-catch) await: add support of async
|
|
23
|
+
- (@putout/plugin-putout) check-replace-code: exclude plugins containing match
|
|
24
|
+
- (@putout/plugin-apply-try-catch) add await
|
|
25
|
+
- (eslint-plugin-putout) function-declaration-paren-newline: add FunctionExpression support
|
|
26
|
+
- (@putout/plugin-remove-useless-variables) add destruct
|
|
27
|
+
- (eslint-plugin-putout) safe: disable remove-useless-spread
|
|
28
|
+
- (@putout/eslint-config) operator-linebreak: add ":", "?"
|
|
29
|
+
- (@putout/eslint-config) operand-linebreak: |, || - before, others - after
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
2022.01.26, v24.5.0
|
|
33
|
+
|
|
34
|
+
fix:
|
|
35
|
+
- (putout) rm unused thread-it
|
|
36
|
+
|
|
37
|
+
feature:
|
|
38
|
+
- (package) @putout/plugin-strict-mode v3.0.0
|
|
39
|
+
- (package) @putout/compare v8.7.0
|
|
40
|
+
- (@putout/compare) add findUp option
|
|
41
|
+
- (@putout/compare) add support of findUp
|
|
42
|
+
- (@putout/plugin-strict-mode) drop support of putout < 24
|
|
43
|
+
- (@putout/plugin-strict-mode) commonjs -> CommonJS
|
|
44
|
+
- (@putout/plugin-strict-mode) is esm -> in ESM
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
2022.01.25, v24.4.0
|
|
48
|
+
|
|
49
|
+
feature:
|
|
50
|
+
- (putout) cli: move out runner
|
|
51
|
+
- (@putout/eslint-config) padding-line-between-statements: add import
|
|
52
|
+
- (@putout/eslint-config) padding-line-between-statements: add export
|
|
53
|
+
- (@putout/eslint-config) enable operator-linebreak
|
|
54
|
+
- (@putout/test) add ESLint support
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
2022.01.24, v24.3.0
|
|
58
|
+
|
|
59
|
+
feature:
|
|
60
|
+
- (putout) eslint: add ability to enable putout/putout rule with a flag
|
|
61
|
+
- (putout/eslint) add ability to enable putout
|
|
62
|
+
|
|
63
|
+
|
|
1
64
|
2022.01.24, v24.2.2
|
|
2
65
|
|
|
3
66
|
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.6.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"
|
|
@@ -51,7 +52,7 @@
|
|
|
51
52
|
"@putout/cli-match": "^1.0.0",
|
|
52
53
|
"@putout/cli-ruler": "^2.0.0",
|
|
53
54
|
"@putout/cli-validate-args": "^1.0.0",
|
|
54
|
-
"@putout/compare": "^8.
|
|
55
|
+
"@putout/compare": "^8.7.0",
|
|
55
56
|
"@putout/engine-loader": "^5.0.0",
|
|
56
57
|
"@putout/engine-parser": "^4.0.0",
|
|
57
58
|
"@putout/engine-processor": "^4.0.0",
|
|
@@ -112,7 +113,7 @@
|
|
|
112
113
|
"@putout/plugin-nodejs": "^2.0.0",
|
|
113
114
|
"@putout/plugin-npmignore": "^2.0.0",
|
|
114
115
|
"@putout/plugin-package-json": "^3.0.0",
|
|
115
|
-
"@putout/plugin-promises": "^
|
|
116
|
+
"@putout/plugin-promises": "^7.0.0",
|
|
116
117
|
"@putout/plugin-putout": "^10.0.0",
|
|
117
118
|
"@putout/plugin-putout-config": "^2.0.0",
|
|
118
119
|
"@putout/plugin-regexp": "^4.0.0",
|
|
@@ -124,7 +125,7 @@
|
|
|
124
125
|
"@putout/plugin-remove-duplicate-case": "^1.0.0",
|
|
125
126
|
"@putout/plugin-remove-duplicate-keys": "^2.0.0",
|
|
126
127
|
"@putout/plugin-remove-duplicates-from-logical-expressions": "^1.0.0",
|
|
127
|
-
"@putout/plugin-remove-empty": "^
|
|
128
|
+
"@putout/plugin-remove-empty": "^7.0.0",
|
|
128
129
|
"@putout/plugin-remove-iife": "^1.0.0",
|
|
129
130
|
"@putout/plugin-remove-nested-blocks": "^5.0.0",
|
|
130
131
|
"@putout/plugin-remove-unreachable-code": "^1.0.0",
|
|
@@ -158,7 +159,7 @@
|
|
|
158
159
|
"@putout/plugin-simplify-ternary": "^2.0.0",
|
|
159
160
|
"@putout/plugin-split-nested-destructuring": "^1.0.0",
|
|
160
161
|
"@putout/plugin-split-variable-declarations": "^2.0.0",
|
|
161
|
-
"@putout/plugin-strict-mode": "^
|
|
162
|
+
"@putout/plugin-strict-mode": "^3.0.0",
|
|
162
163
|
"@putout/plugin-tape": "^8.0.0",
|
|
163
164
|
"@putout/plugin-typescript": "^1.0.0",
|
|
164
165
|
"@putout/plugin-webpack": "^1.0.0",
|