putout 26.0.1 β 26.1.1
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 +85 -32
- package/README.md +1 -1
- package/lib/cli/formatter.js +8 -52
- package/lib/cli/index.js +4 -1
- package/lib/parse-options/validate-options/schema.json +1 -1
- package/package.json +5 -5
package/ChangeLog
CHANGED
|
@@ -1,3 +1,56 @@
|
|
|
1
|
+
2022.05.13, v26.1.1
|
|
2
|
+
|
|
3
|
+
fix:
|
|
4
|
+
- (@putout/engine-loader) loadProcessors: when no default, return the module
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
feature:
|
|
8
|
+
- (package) @putout/processor-markdown v7.0.0
|
|
9
|
+
- (@putout/test) processor: export ESM
|
|
10
|
+
- (@putout/processor-markdown) convert to ESM
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
2022.05.13, v26.1.0
|
|
14
|
+
|
|
15
|
+
fix:
|
|
16
|
+
- (@putout/processor-css) rm once
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
feature:
|
|
20
|
+
- (package) @putout/engine-processor v6.0.0
|
|
21
|
+
- (package) @putout/engine-loader v7.0.0
|
|
22
|
+
- (package) @putout/engine-loader v7.0.0
|
|
23
|
+
- (@putout/engine-processor) getProcessorRunners: sync -> async
|
|
24
|
+
- (putout) getProcessors: sync -> async
|
|
25
|
+
- (@putout/engine-loader) loadProcessors -> loadProcessorsAsync
|
|
26
|
+
- (@putout/plugin-remove-useless-variables) exclude mirrored renames (used in tests)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
2022.05.12, v26.0.2
|
|
30
|
+
|
|
31
|
+
fix:
|
|
32
|
+
- (@putout/plugin-reuse-deuplicate-init) description
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
feature:
|
|
36
|
+
- (package) @putout/plugin-reuse-duplicate-init v4.0.0
|
|
37
|
+
- (@putout/plugin-reuse-duplicate-init) drop support of π < 26
|
|
38
|
+
- (@putout/plugin-reuse-duplicate-init) report message: simplify
|
|
39
|
+
- (@putout/plugin-remove-useless-variables) remove: add support of AssignmentExpression
|
|
40
|
+
- (@putout/operate) remove: improve comments support
|
|
41
|
+
- (@putout/plugin-remove-useless-variables) await: improve report message
|
|
42
|
+
- (@putout/plugin-putout) add: replace-test-message
|
|
43
|
+
- (@putout/plugin-apply-array-at) improve report
|
|
44
|
+
- (@putout/plugin-convert-reduce-to-for-of) exclude CallExpression
|
|
45
|
+
- (@putout/plugin-tape) convert-ok-to-match: test: add support of message
|
|
46
|
+
- (@putout/plugin-remove-useless-operand) check operand type when string could be used
|
|
47
|
+
- (@putout/plugin-madrun) convert-lint-lib: parseObject -> getProperty
|
|
48
|
+
- (@putout/plugin-madrun) convert-nyc-to-c8: add support of CommonJS
|
|
49
|
+
- (@putout/operator-add-args) exclude not calls
|
|
50
|
+
- (@putout/eslint-config) add array-bracket-spacing
|
|
51
|
+
- (@putout/plugin-putout) add-args: add support of process
|
|
52
|
+
|
|
53
|
+
|
|
1
54
|
2022.05.09, v26.0.1
|
|
2
55
|
|
|
3
56
|
fix:
|
|
@@ -221,7 +274,7 @@ feature:
|
|
|
221
274
|
- (package) @putout/plugin-typescript v2.0.0
|
|
222
275
|
- (@putout/plugin-typescript) drop support of π < 16
|
|
223
276
|
- (@putout/plugin-typescript) remove-duplicates-from-union: avoid duplicates reporting
|
|
224
|
-
- (@putout/plugin-extract-object-properties) not-equal-deep: link to listStore() results -> call linkStore() when
|
|
277
|
+
- (@putout/plugin-extract-object-properties) not-equal-deep: link to listStore() results -> call linkStore() when needed
|
|
225
278
|
- (@putout/engine-runner) store: listStore: use Set() inside to prevent duplicates and return array
|
|
226
279
|
|
|
227
280
|
|
|
@@ -1266,7 +1319,7 @@ feature:
|
|
|
1266
1319
|
2021.11.28, v22.2.1
|
|
1267
1320
|
|
|
1268
1321
|
fix:
|
|
1269
|
-
- (@putout/plugin-remove-constant-conditions) report: "constant
|
|
1322
|
+
- (@putout/plugin-remove-constant-conditions) report: "constant conditions should not be used" -> "Avoid constant conditions"
|
|
1270
1323
|
|
|
1271
1324
|
feature:
|
|
1272
1325
|
- (package) @putout/plugin-madrun v11.0.0
|
|
@@ -1281,7 +1334,7 @@ feature:
|
|
|
1281
1334
|
fix:
|
|
1282
1335
|
- (@putout/plugin-remove-unused-variables) OptionalMemberExpression: computed property
|
|
1283
1336
|
- (eslint-plugin-putout) array-element-newline: minimum elements: 4 -> 5
|
|
1284
|
-
- (eslint-plugin-putout) add-newlinew-before-function-call:
|
|
1337
|
+
- (eslint-plugin-putout) add-newlinew-before-function-call: trimmed whitespaces on empty line
|
|
1285
1338
|
- (eslint-plugin-putout) add-newline-before-function-call: add support of comments
|
|
1286
1339
|
- (eslint-plugin-putout) add-newline-before-function-call: continue -> return
|
|
1287
1340
|
|
|
@@ -1296,7 +1349,7 @@ feature:
|
|
|
1296
1349
|
- (@putout/eslint-config) padding-line-between-statements: add support of while
|
|
1297
1350
|
- (eslint-plugin-putout) add add-newline-before-function-call
|
|
1298
1351
|
- (@putout/eslint-config) add func-call-spacing (https://eslint.org/docs/rules/func-call-spacing)
|
|
1299
|
-
- (eslint-plugin-putout) plugin-tape-remove-newline-before-t-end: add support of
|
|
1352
|
+
- (eslint-plugin-putout) plugin-tape-remove-newline-before-t-end: add support of trimmed newline
|
|
1300
1353
|
- (eslint-plugin-putout) add add-newline-before-t-end
|
|
1301
1354
|
- (@putout/plugin-declare-undefined-variables) add maybeEmptyArray
|
|
1302
1355
|
- (eslint-plugin-putout) array-element-newline: add support of Identifier
|
|
@@ -1727,7 +1780,7 @@ feature:
|
|
|
1727
1780
|
2021.09.25, v20.5.0
|
|
1728
1781
|
|
|
1729
1782
|
fix:
|
|
1730
|
-
- (@putout/test)
|
|
1783
|
+
- (@putout/test) leak of plugins used in `t.transform()`
|
|
1731
1784
|
- (@putout/plugin-tape) apply-with-name: not declared
|
|
1732
1785
|
- (@putout/plugin-declare-undefined-variables) get back record, to have eslint-plugin-putout support
|
|
1733
1786
|
|
|
@@ -1949,11 +2002,11 @@ fix:
|
|
|
1949
2002
|
2021.09.01, v19.3.0
|
|
1950
2003
|
|
|
1951
2004
|
fix:
|
|
1952
|
-
- feature(putout) exit with error when "--fix" used with "--enable(-all)" or "--
|
|
2005
|
+
- feature(putout) exit with error when "--fix" used with "--enable(-all)" or "--disable(-all)" (#77)
|
|
1953
2006
|
- (@putout/plugin-declare-undefined-variables) mockImport: multiple declarations
|
|
1954
2007
|
|
|
1955
2008
|
feature:
|
|
1956
|
-
- (putout) exit with error when "--fix" used with "--enable(-all)" or "--
|
|
2009
|
+
- (putout) exit with error when "--fix" used with "--enable(-all)" or "--disable(-all)" (#77)
|
|
1957
2010
|
- (@putout/plugin-regexp) remove-useless-group: allow only test, search match (#74)
|
|
1958
2011
|
- (@putout/plugin-apply-filter-boolean) add
|
|
1959
2012
|
- (eslint-plugin-putout) rm category (https://eslint.org/blog/2021/08/eslint-v8.0.0-beta.1-released)
|
|
@@ -2016,8 +2069,8 @@ feature:
|
|
|
2016
2069
|
2021.08.23, v19.0.0
|
|
2017
2070
|
|
|
2018
2071
|
fix:
|
|
2019
|
-
- (@putout/cli-validate-args) switch to
|
|
2020
|
-
- (@putout/plugin-regexp) convert-to-string: false
|
|
2072
|
+
- (@putout/cli-validate-args) switch to dynamic import
|
|
2073
|
+
- (@putout/plugin-regexp) convert-to-string: false positive with Char of kind meta: \d
|
|
2021
2074
|
- (@putout/eslint-config) peerDependency
|
|
2022
2075
|
- (eslint-plugin-putout) peerDependencies: eslint
|
|
2023
2076
|
|
|
@@ -2046,7 +2099,7 @@ feature:
|
|
|
2046
2099
|
fix:
|
|
2047
2100
|
- (@putout/compare) link: arrays
|
|
2048
2101
|
- (putout) parse-options: read rules with "putout-plugin" prefix
|
|
2049
|
-
- (eslint-plugin-putout) rm
|
|
2102
|
+
- (eslint-plugin-putout) rm additional esm handling
|
|
2050
2103
|
- (@putout/engine-runner) empty key
|
|
2051
2104
|
|
|
2052
2105
|
feature:
|
|
@@ -2191,7 +2244,7 @@ feature:
|
|
|
2191
2244
|
|
|
2192
2245
|
fix:
|
|
2193
2246
|
- (@putout/compare) exclude: range, parent (#67)
|
|
2194
|
-
- (@putout/plugin-regexp) remove-useless-group:
|
|
2247
|
+
- (@putout/plugin-regexp) remove-useless-group: exclude named capturing groups (#67)
|
|
2195
2248
|
|
|
2196
2249
|
feature:
|
|
2197
2250
|
- (ruler) exclude rules not related to putout
|
|
@@ -2739,7 +2792,7 @@ fix:
|
|
|
2739
2792
|
|
|
2740
2793
|
|
|
2741
2794
|
feature:
|
|
2742
|
-
- feature(@putout/plugin-remove-useless-await) add
|
|
2795
|
+
- feature(@putout/plugin-remove-useless-await) add support of not async functions
|
|
2743
2796
|
- feature(putout) bin: disable remove-empty/import, ESM: disable strict-mode/add
|
|
2744
2797
|
- feature(eslint-plugin-putout) single-property-destructuring: add support of ImportDeclaration
|
|
2745
2798
|
- feature(eslint-plugin-putout) ide: remove-empty/block -> remove-empty
|
|
@@ -3007,7 +3060,7 @@ feature:
|
|
|
3007
3060
|
2021.01.30, v14.0.3
|
|
3008
3061
|
|
|
3009
3062
|
fix:
|
|
3010
|
-
- (putout) prevent unhandled
|
|
3063
|
+
- (putout) prevent unhandled exceptions
|
|
3011
3064
|
- (@putout/processor-ignore) windows line endings
|
|
3012
3065
|
|
|
3013
3066
|
feature:
|
|
@@ -3027,7 +3080,7 @@ feature:
|
|
|
3027
3080
|
2021.01.27, v14.0.1
|
|
3028
3081
|
|
|
3029
3082
|
fix:
|
|
3030
|
-
- (putout) cache-files: rm useless logical operation: "" always
|
|
3083
|
+
- (putout) cache-files: rm useless logical operation: "" always positive after condition
|
|
3031
3084
|
|
|
3032
3085
|
feature:
|
|
3033
3086
|
- (package) eslint-plugin-putout v7.0.0
|
|
@@ -3160,7 +3213,7 @@ feature:
|
|
|
3160
3213
|
- (putout) cli: cache: add ability to detect eslintrc change
|
|
3161
3214
|
- (putout) cache-files: add ability to detect node_modules changes
|
|
3162
3215
|
- (@putout/plugin-tape) add convert-emitter-to-promise
|
|
3163
|
-
- (@putout/formatter-memory) add
|
|
3216
|
+
- (@putout/formatter-memory) add support of PUTOUT_PROGRESS_BAR
|
|
3164
3217
|
- (@putout/plugin-nodejs) add convert-promisify-to-fs-promises
|
|
3165
3218
|
|
|
3166
3219
|
|
|
@@ -3435,7 +3488,7 @@ feature:
|
|
|
3435
3488
|
2020.12.07, v12.0.1
|
|
3436
3489
|
|
|
3437
3490
|
fix:
|
|
3438
|
-
- (putout) parse-match: memory
|
|
3491
|
+
- (putout) parse-match: memory leak: 400mb -> 140mb: rm memo
|
|
3439
3492
|
|
|
3440
3493
|
feature:
|
|
3441
3494
|
- (@putout/plugin-convert-commonjs-to-esm) require: exclude declared require
|
|
@@ -4418,7 +4471,7 @@ fix:
|
|
|
4418
4471
|
- (@putout/engine-loader) load-plugin: rm useless Module.plugins (used for webpack bundle build)
|
|
4419
4472
|
|
|
4420
4473
|
feature:
|
|
4421
|
-
- (putout) add --debug flag to switch formatter into reason of a crash (when
|
|
4474
|
+
- (putout) add --debug flag to switch formatter into reason of a crash (when occurs)
|
|
4422
4475
|
- (@putout/eslint-cofig) .eslintrc.json -> eslintrc.json
|
|
4423
4476
|
|
|
4424
4477
|
|
|
@@ -5110,7 +5163,7 @@ feature:
|
|
|
5110
5163
|
|
|
5111
5164
|
feature:
|
|
5112
5165
|
- (putout) parse-options: readRules: plugins: object -> array
|
|
5113
|
-
- (@putout/codemod-convert-tape-to-supertape)
|
|
5166
|
+
- (@putout/codemod-convert-tape-to-supertape) convert to replace
|
|
5114
5167
|
- (@putout/codemod-cut-legacy) convert to include
|
|
5115
5168
|
- (@putout/engine-runner) filter: replace -> include
|
|
5116
5169
|
- (@putout/engine-runner) rm unused check
|
|
@@ -5179,7 +5232,7 @@ feature:
|
|
|
5179
5232
|
2020.01.17, v7.6.1
|
|
5180
5233
|
|
|
5181
5234
|
fix:
|
|
5182
|
-
- feature(@putout/eslint-config) disable no-empty-pattern: no
|
|
5235
|
+
- feature(@putout/eslint-config) disable no-empty-pattern: no
|
|
5183
5236
|
- (putout) parseOptions: custom optionsmore important then merged options, custom match more important then custom options
|
|
5184
5237
|
|
|
5185
5238
|
feature:
|
|
@@ -6399,13 +6452,13 @@ fix:
|
|
|
6399
6452
|
- (eslintrc) overrides does not supported by eslint
|
|
6400
6453
|
- (@putout/plugin-extract-sequence-epxressions) add support of WhileStatement
|
|
6401
6454
|
- (@putout/eslint-config) rm overrides: does not supported by eslint
|
|
6402
|
-
- (@putout/eslint-config) no-
|
|
6455
|
+
- (@putout/eslint-config) no-unneeded-ternary: default-assignment: defaultAssignment
|
|
6403
6456
|
|
|
6404
6457
|
feature:
|
|
6405
6458
|
- (putout) rm shebang check
|
|
6406
6459
|
- (putout) improve directives support
|
|
6407
6460
|
- (@putout/eslint-config) overrids "bin": disable rules: no-console, no-process-exit
|
|
6408
|
-
- (@putout/eslint-config) no-
|
|
6461
|
+
- (@putout/eslint-config) no-unneeded-ternary: default-assignment: false
|
|
6409
6462
|
|
|
6410
6463
|
|
|
6411
6464
|
2019.07.24, v4.60.0
|
|
@@ -6664,7 +6717,7 @@ fix:
|
|
|
6664
6717
|
- (@putout/plugin-convert-apply-to-spread) rm quotes
|
|
6665
6718
|
|
|
6666
6719
|
feature:
|
|
6667
|
-
- (putout) add ability to handle
|
|
6720
|
+
- (putout) add ability to handle overlapped plugins: missing node
|
|
6668
6721
|
- (@putout/plugin-remove-unused-variables) add support of named FunctionExpression in ReturnStatement
|
|
6669
6722
|
- (package) eslint-plugin-node v9.1.0
|
|
6670
6723
|
- (package) eslint v6.0.1
|
|
@@ -6694,7 +6747,7 @@ fix:
|
|
|
6694
6747
|
feature:
|
|
6695
6748
|
- (putout) enable typescript only for .ts files
|
|
6696
6749
|
- (package) eslint v6.0.1
|
|
6697
|
-
- (@putout/plugin-remove-empty) add support of empty
|
|
6750
|
+
- (@putout/plugin-remove-empty) add support of empty consequent block, and not empty alternate block if IfStatement
|
|
6698
6751
|
- (@putout/plugin-remove-unused-variables) add support of TSInterfaceDeclaration, TSMethodSignature
|
|
6699
6752
|
- (package) eslint-plugin-node v9.1.0
|
|
6700
6753
|
- (package) eslint v6.0.1
|
|
@@ -7012,7 +7065,7 @@ fix:
|
|
|
7012
7065
|
|
|
7013
7066
|
feature:
|
|
7014
7067
|
- (@putout/plugin-putout) add
|
|
7015
|
-
- (@putout/eslint-config) padding-line-
|
|
7068
|
+
- (@putout/eslint-config) padding-line-between-statements: add empty line before if condition
|
|
7016
7069
|
- (@putout/plugin-remove-empty-pattern) add support of function argument
|
|
7017
7070
|
- (@putout/plugin-remove-empty) add support of css
|
|
7018
7071
|
|
|
@@ -7177,7 +7230,7 @@ feature:
|
|
|
7177
7230
|
- (@putout/plugin-remove-unused-variables) add support of ClassDeclaration in ExportDefaultDeclaration
|
|
7178
7231
|
- (@putotu/plugin-remove-unused-variables) condition isObjectExpression -> traverse ObjectExpression
|
|
7179
7232
|
- (putout) isTemplateLiteral checks -> TemplateLiteral key
|
|
7180
|
-
- (putout) add support of TemplateLiteral in
|
|
7233
|
+
- (putout) add support of TemplateLiteral in ConditionalExpression
|
|
7181
7234
|
- (@putout/plugin-remove-unused-variables) add support of Identifier in JSXSpreadAttribute
|
|
7182
7235
|
- (@putout/plugin-remove-unused-variables) add support of marking as used elements before RestElement when destructuring used as a function param
|
|
7183
7236
|
- (@putout/plugin-remove-unused-variables) add support of specifiers in ExportNamedDeclaration
|
|
@@ -7245,7 +7298,7 @@ fix:
|
|
|
7245
7298
|
|
|
7246
7299
|
fix:
|
|
7247
7300
|
- (run-plugins) add early return when no need to apply changes
|
|
7248
|
-
- docs(changelog) rm
|
|
7301
|
+
- docs(changelog) rm
|
|
7249
7302
|
|
|
7250
7303
|
|
|
7251
7304
|
2019.02.22, v4.3.0
|
|
@@ -7272,7 +7325,7 @@ fix:
|
|
|
7272
7325
|
|
|
7273
7326
|
feature:
|
|
7274
7327
|
- (plugin-madrun) call-series -> call-run
|
|
7275
|
-
- (eslint-plugin-putout) add
|
|
7328
|
+
- (eslint-plugin-putout) add support of multiple-properties-destructuring
|
|
7276
7329
|
- (eslint-config) add object-property-newline
|
|
7277
7330
|
|
|
7278
7331
|
|
|
@@ -7352,7 +7405,7 @@ feature:
|
|
|
7352
7405
|
- (putout) set defaults for bin
|
|
7353
7406
|
- (putout) remove support of putout section of package.json
|
|
7354
7407
|
- (putout) rm --config
|
|
7355
|
-
- (eslint-config) prefer-destructuring: AssignmentExpression: disable
|
|
7408
|
+
- (eslint-config) prefer-destructuring: AssignmentExpression: disable object
|
|
7356
7409
|
- (eslint-config) prefer-destructuring
|
|
7357
7410
|
- (putout) madrun v2.0.0
|
|
7358
7411
|
|
|
@@ -7368,7 +7421,7 @@ feature:
|
|
|
7368
7421
|
|
|
7369
7422
|
fix:
|
|
7370
7423
|
- (@putout/plugin-madrun) add .spec.js to ignore
|
|
7371
|
-
- (@putout/test) report/reportCode: disable
|
|
7424
|
+
- (@putout/test) report/reportCode: disable
|
|
7372
7425
|
|
|
7373
7426
|
feature:
|
|
7374
7427
|
- (@putout/plugin-madrun) add
|
|
@@ -7760,12 +7813,12 @@ feature:
|
|
|
7760
7813
|
|
|
7761
7814
|
fix:
|
|
7762
7815
|
- (plugin-remove-only) description
|
|
7763
|
-
- feature(putout) change plugin structure: find,
|
|
7816
|
+
- feature(putout) change plugin structure: find,
|
|
7764
7817
|
|
|
7765
7818
|
feature:
|
|
7766
7819
|
- (parse-match) move out from bin/putout.js
|
|
7767
7820
|
- (putout) add support of match/ignore
|
|
7768
|
-
- (putout) add plugin name in
|
|
7821
|
+
- (putout) add plugin name in errors output
|
|
7769
7822
|
- (plugin-remove-skip) add
|
|
7770
7823
|
- (putout) add ability to set config path
|
|
7771
7824
|
- (putout) cherow -> espree: comments support
|
|
@@ -8080,7 +8133,7 @@ feature:
|
|
|
8080
8133
|
2018.12.21, v2.1.0
|
|
8081
8134
|
|
|
8082
8135
|
fix:
|
|
8083
|
-
- test(putout) fn vars
|
|
8136
|
+
- test(putout) fn vars
|
|
8084
8137
|
- test(putout) arrow-vars-
|
|
8085
8138
|
|
|
8086
8139
|
feature:
|
package/README.md
CHANGED
|
@@ -187,7 +187,7 @@ putout lib test --fix
|
|
|
187
187
|
|
|
188
188
|
## Plugins
|
|
189
189
|
|
|
190
|
-
By default π**Putout** uses all enabled by default plugins, anyways it can be run with a couple mentioned plugins (
|
|
190
|
+
By default π**Putout** uses all enabled by default plugins, anyways it can be run with a couple mentioned plugins (split with ","):
|
|
191
191
|
|
|
192
192
|
```sh
|
|
193
193
|
putout lib --plugins remove-debugger,remove-unused-variables
|
package/lib/cli/formatter.js
CHANGED
|
@@ -1,72 +1,28 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const tryToCatch = require('try-to-catch');
|
|
4
|
+
const {createAsyncLoader} = require('@putout/engine-loader');
|
|
4
5
|
|
|
5
6
|
const {
|
|
6
7
|
NO_FORMATTER,
|
|
7
8
|
CANNOT_LOAD_FORMATTER,
|
|
8
9
|
} = require('./exit-codes');
|
|
9
10
|
|
|
10
|
-
const {simpleImportDefault} = require('./simple-import');
|
|
11
|
-
|
|
12
|
-
const stub = () => () => {};
|
|
13
|
-
|
|
14
11
|
const {isArray} = Array;
|
|
15
|
-
const {assign} = Object;
|
|
16
12
|
const maybeArray = (a) => isArray(a) ? a : [a, {}];
|
|
17
13
|
|
|
18
|
-
module.exports.getFormatter = async (
|
|
19
|
-
const [
|
|
20
|
-
|
|
21
|
-
return [
|
|
22
|
-
await getReporter(name, exit),
|
|
23
|
-
formatterOptions,
|
|
24
|
-
];
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
module.exports.getReporter = getReporter;
|
|
28
|
-
async function getReporter(name, exit) {
|
|
29
|
-
if (name === 'none')
|
|
30
|
-
return stub();
|
|
14
|
+
module.exports.getFormatter = async (formatterOptional, exit) => {
|
|
15
|
+
const [formatterName, formatterOptions] = maybeArray(formatterOptional);
|
|
16
|
+
const loadFormatter = createAsyncLoader('formatter');
|
|
31
17
|
|
|
32
|
-
const [error,
|
|
33
|
-
`@putout/formatter-${name}`,
|
|
34
|
-
`putout-formatter-${name}`,
|
|
35
|
-
]);
|
|
18
|
+
const [error, formatter] = await tryToCatch(loadFormatter, formatterName, exit);
|
|
36
19
|
|
|
37
|
-
if (
|
|
38
|
-
return
|
|
20
|
+
if (formatter)
|
|
21
|
+
return [formatter, formatterOptions];
|
|
39
22
|
|
|
40
23
|
if (error.code === 'ERR_MODULE_NOT_FOUND')
|
|
41
24
|
return exit(NO_FORMATTER, error);
|
|
42
25
|
|
|
43
26
|
exit(CANNOT_LOAD_FORMATTER, error);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
async function loadFormatter(names) {
|
|
47
|
-
let e;
|
|
48
|
-
let reporter;
|
|
49
|
-
|
|
50
|
-
for (const name of names) {
|
|
51
|
-
[e, reporter] = await tryToCatch(simpleImportDefault, name);
|
|
52
|
-
|
|
53
|
-
if (!e)
|
|
54
|
-
return [null, reporter];
|
|
55
|
-
|
|
56
|
-
if (e.code === 'ERR_MODULE_NOT_FOUND')
|
|
57
|
-
continue;
|
|
58
|
-
|
|
59
|
-
assign(e, {
|
|
60
|
-
message: `${name}: ${e.message}`,
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
return [e];
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
assign(e, {
|
|
67
|
-
message: e.message.replace(/\simported.*/, ''),
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
return [e];
|
|
71
|
-
}
|
|
27
|
+
};
|
|
72
28
|
|
package/lib/cli/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const tryToCatch = require('try-to-catch');
|
|
4
|
+
|
|
3
5
|
const yargsParser = require('yargs-parser');
|
|
4
6
|
const {isCI} = require('ci-info');
|
|
5
7
|
const memo = require('nano-memoize');
|
|
@@ -213,7 +215,7 @@ module.exports = async ({argv, halt, log, write, logError, readFile, writeFile})
|
|
|
213
215
|
} = config;
|
|
214
216
|
|
|
215
217
|
const [currentFormat, formatterOptions] = await getFormatter(format || formatter, exit);
|
|
216
|
-
const [error, processorRunners] =
|
|
218
|
+
const [error, processorRunners] = await tryToCatch(getProcessorRunners, processors);
|
|
217
219
|
|
|
218
220
|
if (error)
|
|
219
221
|
return exit(CANNOT_LOAD_PROCESSOR, error);
|
|
@@ -350,3 +352,4 @@ function addOnce(emitter, name, fn) {
|
|
|
350
352
|
if (!emitter.listenerCount(name))
|
|
351
353
|
emitter.on(name, fn);
|
|
352
354
|
}
|
|
355
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "putout",
|
|
3
|
-
"version": "26.
|
|
3
|
+
"version": "26.1.1",
|
|
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",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"@putout/cli-ruler": "^2.0.0",
|
|
54
54
|
"@putout/cli-validate-args": "^1.0.0",
|
|
55
55
|
"@putout/compare": "^9.0.0",
|
|
56
|
-
"@putout/engine-loader": "^
|
|
56
|
+
"@putout/engine-loader": "^7.0.0",
|
|
57
57
|
"@putout/engine-parser": "^5.0.0",
|
|
58
|
-
"@putout/engine-processor": "^
|
|
58
|
+
"@putout/engine-processor": "^6.0.0",
|
|
59
59
|
"@putout/engine-runner": "^13.0.0",
|
|
60
60
|
"@putout/formatter-codeframe": "^4.0.0",
|
|
61
61
|
"@putout/formatter-dump": "^4.0.0",
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
"@putout/plugin-remove-useless-type-conversion": "^2.0.0",
|
|
159
159
|
"@putout/plugin-remove-useless-typeof": "^1.0.0",
|
|
160
160
|
"@putout/plugin-remove-useless-variables": "^7.0.0",
|
|
161
|
-
"@putout/plugin-reuse-duplicate-init": "^
|
|
161
|
+
"@putout/plugin-reuse-duplicate-init": "^4.0.0",
|
|
162
162
|
"@putout/plugin-simplify-assignment": "^1.0.0",
|
|
163
163
|
"@putout/plugin-simplify-logical-expressions": "^2.0.0",
|
|
164
164
|
"@putout/plugin-simplify-ternary": "^2.0.0",
|
|
@@ -173,7 +173,7 @@
|
|
|
173
173
|
"@putout/processor-ignore": "^2.0.0",
|
|
174
174
|
"@putout/processor-javascript": "^3.0.0",
|
|
175
175
|
"@putout/processor-json": "^3.0.0",
|
|
176
|
-
"@putout/processor-markdown": "^
|
|
176
|
+
"@putout/processor-markdown": "^7.0.0",
|
|
177
177
|
"@putout/processor-yaml": "^3.0.0",
|
|
178
178
|
"@putout/traverse": "^5.0.0",
|
|
179
179
|
"ajv": "^8.8.2",
|