putout 22.3.4 → 22.5.2
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 +78 -0
- package/README.md +2 -0
- package/lib/cli/formatter.js +12 -9
- package/lib/cli/get-options.js +18 -1
- package/lib/cli/index.js +3 -3
- package/lib/cli/report.js +2 -2
- package/package.json +10 -10
package/ChangeLog
CHANGED
|
@@ -1,3 +1,81 @@
|
|
|
1
|
+
2021.12.07, v22.5.2
|
|
2
|
+
|
|
3
|
+
fix:
|
|
4
|
+
- (@putout/operator-declare) simplify
|
|
5
|
+
|
|
6
|
+
feature:
|
|
7
|
+
- (package) @putout/formatter-dump v3.0.0
|
|
8
|
+
- (package) @putout/formatter-dump v3.0.0
|
|
9
|
+
- (@putout/formatter-dump) convert to ESM (#91)
|
|
10
|
+
- (package) @putout/plugin-remove-useless-escape v2.0.0
|
|
11
|
+
- (eslint-plugin-putout) objects-braces-inside-array: add support of newlines in the middle
|
|
12
|
+
- (@putout/plugin-remove-useless-escape) drop support of node < 14
|
|
13
|
+
- (@putout/plugin-remove-useless-escape) add support of comma
|
|
14
|
+
- (@putout/plugin-putout) add convert-putout-test-to-create-test
|
|
15
|
+
- (@putout/operator-declare) add ability to handle missing case of dual package
|
|
16
|
+
- (@putout/plugin-putout) add apply-async-formatter (#91)
|
|
17
|
+
- (@putout/tape) add support of reRequire
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
2021.12.05, v22.5.1
|
|
21
|
+
|
|
22
|
+
feature:
|
|
23
|
+
- (package) @putout/plugin-declare-undefined-variables v6.0.0
|
|
24
|
+
- (package) @putout/plugin-tape v7.0.0
|
|
25
|
+
- (package) @putout/operator-declare v2.0.0
|
|
26
|
+
- (@putout/operator-declare) drop support of putout < 22.5
|
|
27
|
+
- (@putout/plugin-tape) drop support of putout < 22.5
|
|
28
|
+
- (@putout/plugin-tape) declare: add mockImport
|
|
29
|
+
- (@putout/plugin-declare-undefined-variables) mv mock-import to @putout/plugin-tape
|
|
30
|
+
- (@putout/plugin-declare-undefined-variables) drop support of putout < 22.5
|
|
31
|
+
- (@putout/plugin-declare-undefined-variables) simport: add support of dual packages
|
|
32
|
+
- (@putout/operator-declare) add support of dual packages: esm and commonjs
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
2021.12.04, v22.5.0
|
|
36
|
+
|
|
37
|
+
fix:
|
|
38
|
+
- (@putout/plugin-convert-mock-require-to-mock-import) handle no stopAll case
|
|
39
|
+
|
|
40
|
+
feature:
|
|
41
|
+
- (@putout/plugin-declare-undefined-variables) add support of simport
|
|
42
|
+
- (package) @putout/formatter-progress-bar v2.0.0
|
|
43
|
+
- (@putout/test) format: improve ability to test ESM
|
|
44
|
+
- (@putout/plugin-convert-commonjs-to-esm) require: call: exclude dot dot
|
|
45
|
+
- (@putout/plugin-declare-undefined-variables) add fresh-import
|
|
46
|
+
- (@putout/formatter-progress-bar) convert to ESM
|
|
47
|
+
- (package) @putout/plugin-convert-commonjs-to-esm v6.0.0
|
|
48
|
+
- (package) @putout/formatter-progress v3.0.0
|
|
49
|
+
- (@putout/formatter-progress) convert to ESM
|
|
50
|
+
- (@putout/plugin-convert-commonjs-to-esm) drop support of putout < 22
|
|
51
|
+
- (@putout/plugin-convert-commonjs-to-esm) require: improve support of namespaces: PascalCase -> kebabCase
|
|
52
|
+
- (@putout/test) v4.0.0
|
|
53
|
+
- (putout) add support of ESM formatters
|
|
54
|
+
- (@putout/formatter-eslint) convert to ESM
|
|
55
|
+
- (@putout/formatter-eslint) convert to async
|
|
56
|
+
- (@putout/test) format: convert to async
|
|
57
|
+
- (putout) add support of async formatters
|
|
58
|
+
- (@putout/plugin-declare-undefined-variables) add support of zlib
|
|
59
|
+
- (@putout/plugin-declare-undefined-variables) logical: add id
|
|
60
|
+
- (@putout/plugin-declare-undefined-variables) add logical
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
2021.12.02, v22.4.0
|
|
64
|
+
|
|
65
|
+
feature:
|
|
66
|
+
- (putout) add env variable PUTOUT_CONFIG_FILE
|
|
67
|
+
- (eslint-plugin-putout) ts: add extension rules
|
|
68
|
+
- (eslint-plugin-putout) ts: enable @typescript-eslint/type-annotation-spacing
|
|
69
|
+
- (eslint-plugin-putout) safe: add remove-useless-arguments
|
|
70
|
+
- (eslint-plugin-putout) tape-remove-newline-before-t-end: add support of case when no assertions found before t.end()
|
|
71
|
+
- (eslint-plugin-putout) ts: disable: ban-types, no-explicit-any, no-empty-function
|
|
72
|
+
- (package) eslint-plugin-putout v12.0.0
|
|
73
|
+
- (eslint-plugin-putout) drop support of putout < 22
|
|
74
|
+
- (eslint-plugin-putout) add first class support of typescript
|
|
75
|
+
- (eslint-plugin-putout) improve support of add-newline-{before,after}-function-call
|
|
76
|
+
- (@putout/plugin-remove-empty-pattern) add support of nested ArrayPattern
|
|
77
|
+
|
|
78
|
+
|
|
1
79
|
2021.12.01, v22.3.4
|
|
2
80
|
|
|
3
81
|
fix:
|
package/README.md
CHANGED
|
@@ -153,6 +153,8 @@ putout lib --plugins remove-debugger,remove-unused-variables
|
|
|
153
153
|
🐊`Putout` supports next `environment variables`:
|
|
154
154
|
|
|
155
155
|
- `PUTOUT_FILES` - files that should be processed by putout, divided by ",";
|
|
156
|
+
- `PUTOUT_CONFIG_FILE` - path to 🐊`Putout` config file;
|
|
157
|
+
- `ESLINT_CONFIG_FILE` - path to `ESLint` config file;
|
|
156
158
|
|
|
157
159
|
```sh
|
|
158
160
|
PUTOUT_FILES=lib,test putout --fix
|
package/lib/cli/formatter.js
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const {createSimport} = require('simport');
|
|
4
|
+
const tryToCatch = require('try-to-catch');
|
|
5
|
+
|
|
4
6
|
const {NO_FORMATTER} = require('./exit-codes');
|
|
5
7
|
|
|
8
|
+
const simport = createSimport(__filename);
|
|
6
9
|
const stub = () => () => {};
|
|
7
10
|
|
|
8
11
|
const {isArray} = Array;
|
|
9
12
|
const maybeArray = (a) => isArray(a) ? a : [a, {}];
|
|
10
13
|
|
|
11
|
-
module.exports.getFormatter = (formatter, exit) => {
|
|
14
|
+
module.exports.getFormatter = async (formatter, exit) => {
|
|
12
15
|
const [name, formatterOptions] = maybeArray(formatter);
|
|
13
16
|
|
|
14
17
|
return [
|
|
15
|
-
getReporter(name, exit),
|
|
18
|
+
await getReporter(name, exit),
|
|
16
19
|
formatterOptions,
|
|
17
20
|
];
|
|
18
21
|
};
|
|
19
22
|
|
|
20
23
|
module.exports.getReporter = getReporter;
|
|
21
|
-
function getReporter(name, exit) {
|
|
24
|
+
async function getReporter(name, exit) {
|
|
22
25
|
let e;
|
|
23
26
|
let reporter;
|
|
24
27
|
|
|
@@ -26,16 +29,16 @@ function getReporter(name, exit) {
|
|
|
26
29
|
return stub();
|
|
27
30
|
}
|
|
28
31
|
|
|
29
|
-
[e, reporter] =
|
|
32
|
+
[e, reporter] = await tryToCatch(simport, `@putout/formatter-${name}`);
|
|
30
33
|
|
|
31
34
|
if (!e)
|
|
32
35
|
return reporter;
|
|
33
36
|
|
|
34
|
-
[e, reporter] =
|
|
37
|
+
[e, reporter] = await tryToCatch(simport, `putout-formatter-${name}`);
|
|
35
38
|
|
|
36
|
-
if (e)
|
|
37
|
-
|
|
39
|
+
if (!e)
|
|
40
|
+
return reporter;
|
|
38
41
|
|
|
39
|
-
|
|
42
|
+
exit(NO_FORMATTER, e);
|
|
40
43
|
}
|
|
41
44
|
|
package/lib/cli/get-options.js
CHANGED
|
@@ -1,19 +1,34 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const {
|
|
3
|
+
const {
|
|
4
|
+
join,
|
|
5
|
+
dirname,
|
|
6
|
+
} = require('path');
|
|
4
7
|
|
|
5
8
|
const buildPlugins = require('./build-plugins');
|
|
6
9
|
const parseOptions = require('../parse-options');
|
|
7
10
|
|
|
11
|
+
const {assign} = Object;
|
|
12
|
+
const {env} = process;
|
|
13
|
+
const {PUTOUT_CONFIG_FILE} = env;
|
|
14
|
+
|
|
15
|
+
const maybeConfig = {
|
|
16
|
+
plugins: [],
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
PUTOUT_CONFIG_FILE && assign(maybeConfig, require(join(process.cwd(), PUTOUT_CONFIG_FILE)));
|
|
20
|
+
|
|
8
21
|
module.exports = ({noConfig, plugins, name, transform, rulesdir}) => {
|
|
9
22
|
const transformPlugins = buildPlugins(transform);
|
|
10
23
|
|
|
11
24
|
if (noConfig)
|
|
12
25
|
return {
|
|
26
|
+
...maybeConfig,
|
|
13
27
|
dir: dirname(name),
|
|
14
28
|
plugins: [
|
|
15
29
|
...plugins,
|
|
16
30
|
...transformPlugins,
|
|
31
|
+
...maybeConfig.plugins,
|
|
17
32
|
],
|
|
18
33
|
};
|
|
19
34
|
|
|
@@ -24,9 +39,11 @@ module.exports = ({noConfig, plugins, name, transform, rulesdir}) => {
|
|
|
24
39
|
|
|
25
40
|
return {
|
|
26
41
|
...result,
|
|
42
|
+
...maybeConfig,
|
|
27
43
|
plugins: [
|
|
28
44
|
...result.plugins,
|
|
29
45
|
...transformPlugins,
|
|
46
|
+
...maybeConfig.plugins,
|
|
30
47
|
],
|
|
31
48
|
};
|
|
32
49
|
};
|
package/lib/cli/index.js
CHANGED
|
@@ -235,7 +235,7 @@ module.exports = async ({argv, halt, log, write, logError, readFile, writeFile})
|
|
|
235
235
|
processors = defaultProcessors,
|
|
236
236
|
} = config;
|
|
237
237
|
|
|
238
|
-
const [currentFormat, formatterOptions] = getFormatter(format || formatter, exit);
|
|
238
|
+
const [currentFormat, formatterOptions] = await getFormatter(format || formatter, exit);
|
|
239
239
|
const [error, processorRunners] = tryCatch(getProcessorRunners, processors);
|
|
240
240
|
|
|
241
241
|
if (error)
|
|
@@ -341,7 +341,7 @@ module.exports = async ({argv, halt, log, write, logError, readFile, writeFile})
|
|
|
341
341
|
count: length,
|
|
342
342
|
});
|
|
343
343
|
|
|
344
|
-
const line = report(currentFormat, formatterProxy);
|
|
344
|
+
const line = await report(currentFormat, formatterProxy);
|
|
345
345
|
|
|
346
346
|
write(line || '');
|
|
347
347
|
rawPlaces.push(places);
|
|
@@ -382,7 +382,7 @@ module.exports = async ({argv, halt, log, write, logError, readFile, writeFile})
|
|
|
382
382
|
}
|
|
383
383
|
}
|
|
384
384
|
|
|
385
|
-
const line = report(currentFormat, {
|
|
385
|
+
const line = await report(currentFormat, {
|
|
386
386
|
report,
|
|
387
387
|
formatterOptions,
|
|
388
388
|
name: chooseName(name, resolvedName),
|
package/lib/cli/report.js
CHANGED
|
@@ -4,7 +4,7 @@ module.exports = () => {
|
|
|
4
4
|
let filesCount = 0;
|
|
5
5
|
let errorsCount = 0;
|
|
6
6
|
|
|
7
|
-
return (formatter, options) => {
|
|
7
|
+
return async (formatter, options) => {
|
|
8
8
|
const {
|
|
9
9
|
name,
|
|
10
10
|
source,
|
|
@@ -19,7 +19,7 @@ module.exports = () => {
|
|
|
19
19
|
|
|
20
20
|
errorsCount += places.length;
|
|
21
21
|
|
|
22
|
-
return formatter({
|
|
22
|
+
return await formatter({
|
|
23
23
|
name,
|
|
24
24
|
options: formatterOptions,
|
|
25
25
|
source,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "putout",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.5.2",
|
|
4
4
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
5
5
|
"description": "🐊 Pluggable and configurable code transformer with built-in eslint, babel plugins and jscodeshift codemods support of js, jsx typescript, flow files, markdown, yaml and json",
|
|
6
6
|
"homepage": "http://github.com/coderaiser/putout",
|
|
@@ -56,17 +56,17 @@
|
|
|
56
56
|
"@putout/engine-processor": "^4.0.0",
|
|
57
57
|
"@putout/engine-runner": "^11.0.0",
|
|
58
58
|
"@putout/formatter-codeframe": "^2.0.0",
|
|
59
|
-
"@putout/formatter-dump": "^
|
|
59
|
+
"@putout/formatter-dump": "^3.0.0",
|
|
60
60
|
"@putout/formatter-frame": "^1.0.0",
|
|
61
61
|
"@putout/formatter-json": "^1.0.0",
|
|
62
62
|
"@putout/formatter-json-lines": "^1.0.0",
|
|
63
63
|
"@putout/formatter-memory": "^1.0.0",
|
|
64
|
-
"@putout/formatter-progress": "^
|
|
65
|
-
"@putout/formatter-progress-bar": "^
|
|
64
|
+
"@putout/formatter-progress": "^3.0.0",
|
|
65
|
+
"@putout/formatter-progress-bar": "^2.0.0",
|
|
66
66
|
"@putout/formatter-stream": "^2.0.0",
|
|
67
67
|
"@putout/operate": "^6.0.0",
|
|
68
68
|
"@putout/operator-add-args": "^1.0.0",
|
|
69
|
-
"@putout/operator-declare": "^
|
|
69
|
+
"@putout/operator-declare": "^2.0.0",
|
|
70
70
|
"@putout/operator-regexp": "^1.0.0",
|
|
71
71
|
"@putout/plugin-apply-array-at": "^1.0.0",
|
|
72
72
|
"@putout/plugin-apply-as-type-assertions": "^1.0.0",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"@putout/plugin-convert-assignment-to-arrow-function": "^1.0.0",
|
|
84
84
|
"@putout/plugin-convert-assignment-to-comparison": "^1.0.0",
|
|
85
85
|
"@putout/plugin-convert-bitwise-to-logical": "^1.0.0",
|
|
86
|
-
"@putout/plugin-convert-commonjs-to-esm": "^
|
|
86
|
+
"@putout/plugin-convert-commonjs-to-esm": "^6.0.0",
|
|
87
87
|
"@putout/plugin-convert-comparison-to-boolean": "^1.0.0",
|
|
88
88
|
"@putout/plugin-convert-concat-to-flat": "^1.0.0",
|
|
89
89
|
"@putout/plugin-convert-equal-to-strict-equal": "^1.0.0",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"@putout/plugin-convert-to-arrow-function": "^3.0.0",
|
|
103
103
|
"@putout/plugin-convert-top-level-return": "^4.0.0",
|
|
104
104
|
"@putout/plugin-convert-typeof-to-is-type": "^1.0.0",
|
|
105
|
-
"@putout/plugin-declare-undefined-variables": "^
|
|
105
|
+
"@putout/plugin-declare-undefined-variables": "^6.0.0",
|
|
106
106
|
"@putout/plugin-eslint": "^2.0.0",
|
|
107
107
|
"@putout/plugin-extract-object-properties": "^6.0.0",
|
|
108
108
|
"@putout/plugin-extract-sequence-expressions": "^2.0.0",
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
"@putout/plugin-remove-useless-conditions": "^1.0.0",
|
|
147
147
|
"@putout/plugin-remove-useless-constructor": "^1.0.0",
|
|
148
148
|
"@putout/plugin-remove-useless-continue": "^1.0.0",
|
|
149
|
-
"@putout/plugin-remove-useless-escape": "^
|
|
149
|
+
"@putout/plugin-remove-useless-escape": "^2.0.0",
|
|
150
150
|
"@putout/plugin-remove-useless-for-of": "^2.0.0",
|
|
151
151
|
"@putout/plugin-remove-useless-functions": "^2.0.0",
|
|
152
152
|
"@putout/plugin-remove-useless-map": "^1.0.0",
|
|
@@ -169,7 +169,7 @@
|
|
|
169
169
|
"@putout/plugin-split-nested-destructuring": "^1.0.0",
|
|
170
170
|
"@putout/plugin-split-variable-declarations": "^2.0.0",
|
|
171
171
|
"@putout/plugin-strict-mode": "^2.0.0",
|
|
172
|
-
"@putout/plugin-tape": "^
|
|
172
|
+
"@putout/plugin-tape": "^7.0.0",
|
|
173
173
|
"@putout/plugin-webpack": "^1.0.0",
|
|
174
174
|
"@putout/processor-css": "^3.0.0",
|
|
175
175
|
"@putout/processor-ignore": "^2.0.0",
|
|
@@ -220,7 +220,7 @@
|
|
|
220
220
|
"currify": "^4.0.0",
|
|
221
221
|
"eslint": "^8.0.1",
|
|
222
222
|
"eslint-plugin-node": "^11.0.0",
|
|
223
|
-
"eslint-plugin-putout": "^
|
|
223
|
+
"eslint-plugin-putout": "^12.0.0",
|
|
224
224
|
"just-camel-case": "^4.0.2",
|
|
225
225
|
"lerna": "^4.0.0",
|
|
226
226
|
"madrun": "^8.6.0",
|