putout 20.0.1 → 20.3.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 +62 -1
- package/README.md +13 -13
- package/help.json +12 -12
- package/lib/cli/help.js +1 -1
- package/lib/parse-options/apply-module-type-rules.js +21 -0
- package/lib/parse-options/index.js +5 -2
- package/package.json +3 -2
package/ChangeLog
CHANGED
|
@@ -1,7 +1,68 @@
|
|
|
1
|
-
2021.09.
|
|
1
|
+
2021.09.19, v20.3.1
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- (package) @putout/plugin-putout v7.0.0
|
|
5
|
+
- (@putout/plugin-putout) drop support of putout < 20
|
|
6
|
+
- (@putout/plugin-putout) declare: add
|
|
7
|
+
- (@putout/plugin-declare-undefined-variables) add support of lazy building of nodes
|
|
8
|
+
- (@putout/plugin-declare-undefined-variables) export declare
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
2021.09.19, v20.3.0
|
|
12
|
+
|
|
13
|
+
fix:
|
|
14
|
+
- (@putout/plugin-convert-esm-to-commonjs) duplicate report
|
|
15
|
+
|
|
16
|
+
feature:
|
|
17
|
+
- (@putout/plugin-remove-useless-escape) "\+" -> "+"
|
|
18
|
+
- (@putout/plugin-remove-useless-escape) regexp: add support of slash
|
|
19
|
+
- (putout) add ability to detect package type (module/commonjs) and apply matching converters
|
|
20
|
+
- (@putout/plugin-declare-undefined-variables) values -> Object.values
|
|
21
|
+
- (@putout/plugin-remove-useless-escape) add support of regexp
|
|
22
|
+
- (@putout/plugin-tape) add remove-default-messages
|
|
23
|
+
- (@putout/plugin-tape) convert-match-regexp-to-string: add support of notMatch
|
|
24
|
+
- (@putout/tape) add declare-t
|
|
25
|
+
- (@putout/plugin-tape) convert-called-with-no-args-to-called-with: add support of identifier used as second arg
|
|
26
|
+
- (eslint-plugin-putout) no-unresolved: add support of "main" entry of "package.json"
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
2021.09.16, v20.2.0
|
|
30
|
+
|
|
31
|
+
fix:
|
|
32
|
+
- chore(nycrc) exclude: fixture -> *fixture
|
|
33
|
+
|
|
34
|
+
feature:
|
|
35
|
+
- (eslint-plugin-putout) no-resolve: add support of import directory
|
|
36
|
+
- (putout) export putout/eslint
|
|
37
|
+
- (eslint-plugin-putout) add no-unresolved
|
|
38
|
+
- (@putout/plugin-declare-undefined-variables) add support of basename, dirname, extname from path
|
|
39
|
+
- (package) @putout/plugin-remove-useless-async v4.0.0
|
|
40
|
+
- (@putout/plugin-remove-useless-async) drop support of node < 14
|
|
41
|
+
- (@putout/plugin-remove-useless-async) report: Useless async should be avoided -> Avoid useless async
|
|
42
|
+
- (@putout/plugin-declare-undefined-variables) add support of reImport, stopAll
|
|
43
|
+
- (@putout/plugin-remove-duplicate-keys) add support of rename while destructuring
|
|
44
|
+
- (eslint-plugin-putout) safe: disable remove-unused-for-of-variables
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
2021.09.15, v20.1.0
|
|
2
48
|
|
|
3
49
|
fix:
|
|
4
50
|
- (eslint-plugin-putout) putout/ide -> putout/safe
|
|
51
|
+
|
|
52
|
+
feature:
|
|
53
|
+
- (help) improve help (#81) (thanks a lot to @egilll 🎉!)
|
|
54
|
+
- (@putout/plugin-declare-undefined-variables) add support of Object.keys
|
|
55
|
+
- (@putout/plugin-tape) add convert-called-with-args
|
|
56
|
+
- (@putout/engine-loader) add ☝️ when cannot determine plugin type
|
|
57
|
+
- (@putout/engine-runner) add support of "include" not a function in Includer
|
|
58
|
+
- (package) @putout/plugin-eslint v2.0.0
|
|
59
|
+
- (@putout/plugin-eslint) drop support of putout < 20
|
|
60
|
+
- (@putout/plugin-eslint) add convert-ide-to-safe
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
2021.09.12, v20.0.1
|
|
64
|
+
|
|
65
|
+
fix:
|
|
5
66
|
- (eslint-plugin-putout) putout/ide -> putout/safe
|
|
6
67
|
|
|
7
68
|
feature:
|
package/README.md
CHANGED
|
@@ -107,26 +107,26 @@ npm i putout -D
|
|
|
107
107
|
|
|
108
108
|
```
|
|
109
109
|
Usage: putout [options] [path]
|
|
110
|
-
Options
|
|
110
|
+
Options:
|
|
111
111
|
-h, --help display this help and exit
|
|
112
112
|
-v, --version output version information and exit
|
|
113
|
-
-f, --format
|
|
113
|
+
-f, --format [formatter] use a specific output format, the default is: 'progress-bar' localy and 'dump' on CI
|
|
114
114
|
-s, --staged add staged files when in git repository
|
|
115
115
|
--fix apply fixes of errors to code
|
|
116
|
-
--fix-count
|
|
116
|
+
--fix-count [count = 10] count of fixes rounds
|
|
117
117
|
--rulesdir use additional rules from directory
|
|
118
|
-
--transform
|
|
119
|
-
--plugins
|
|
120
|
-
--enable
|
|
121
|
-
--disable
|
|
122
|
-
--enable-all enable all rules
|
|
123
|
-
--disable-all disable all rules
|
|
124
|
-
--match
|
|
118
|
+
--transform [replacer] apply Replacer, for example 'var __a = __b -> const __a = __b', read about Replacer https://git.io/JqcMn
|
|
119
|
+
--plugins [plugins list] a comma-separated list of plugins to use
|
|
120
|
+
--enable [rule] enable the rule and save it to '.putout.json' walking up parent directories
|
|
121
|
+
--disable [rule] disable the rule and save it to '.putout.json' walking up parent directories
|
|
122
|
+
--enable-all enable all found rules and save them to '.putout.json' walking up parent directories
|
|
123
|
+
--disable-all disable all found rules (set baseline) and save them '.putout.json' walking up parent directories
|
|
124
|
+
--match [file name] read .putout.json and convert 'rules' to 'match' using pattern
|
|
125
125
|
--flow enable flow
|
|
126
126
|
--fresh generate a fresh cache
|
|
127
|
-
--no-config avoid reading
|
|
128
|
-
--no-ci disable CI detection
|
|
129
|
-
--no-cache disable cache
|
|
127
|
+
--no-config avoid reading '.putout.json'
|
|
128
|
+
--no-ci disable the CI detection
|
|
129
|
+
--no-cache disable the cache
|
|
130
130
|
```
|
|
131
131
|
|
|
132
132
|
To find erros:
|
package/help.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"-h, --help ": "display this help and exit",
|
|
3
3
|
"-v, --version ": "output version information and exit",
|
|
4
|
-
"-f, --format
|
|
4
|
+
"-f, --format [formatter] ": "use a specific output format, the default is: 'progress-bar' localy and 'dump' on CI",
|
|
5
5
|
"-s, --staged ": "add staged files when in git repository",
|
|
6
6
|
"--fix ": "apply fixes of errors to code",
|
|
7
|
-
"--fix-count
|
|
7
|
+
"--fix-count [count = 10] ": "count of fixes rounds",
|
|
8
8
|
"--rulesdir ": "use additional rules from directory",
|
|
9
|
-
"--transform
|
|
10
|
-
"--plugins
|
|
11
|
-
"--enable
|
|
12
|
-
"--disable
|
|
13
|
-
"--enable-all ": "enable all rules
|
|
14
|
-
"--disable-all ": "disable all rules
|
|
15
|
-
"--match
|
|
9
|
+
"--transform [replacer] ": "apply Replacer, for example 'var __a = __b -> const __a = __b', read about Replacer https://git.io/JqcMn",
|
|
10
|
+
"--plugins [plugins list] ": "a comma-separated list of plugins to use",
|
|
11
|
+
"--enable [rule] ": "enable the rule and save it to '.putout.json' walking up parent directories",
|
|
12
|
+
"--disable [rule] ": "disable the rule and save it to '.putout.json' walking up parent directories",
|
|
13
|
+
"--enable-all ": "enable all found rules and save them to '.putout.json' walking up parent directories",
|
|
14
|
+
"--disable-all ": "disable all found rules (set baseline) and save them '.putout.json' walking up parent directories",
|
|
15
|
+
"--match [file name] ": "read .putout.json and convert 'rules' to 'match' using pattern",
|
|
16
16
|
"--flow ": "enable flow",
|
|
17
17
|
"--fresh ": "generate a fresh cache",
|
|
18
|
-
"--no-config ": "avoid reading
|
|
19
|
-
"--no-ci ": "disable CI detection",
|
|
20
|
-
"--no-cache ": "disable cache"
|
|
18
|
+
"--no-config ": "avoid reading '.putout.json'",
|
|
19
|
+
"--no-ci ": "disable the CI detection",
|
|
20
|
+
"--no-cache ": "disable the cache"
|
|
21
21
|
|
|
22
22
|
}
|
package/lib/cli/help.js
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const {assign} = Object;
|
|
4
|
+
|
|
5
|
+
const getRuleByType = (a) => a === 'module' ? 'convert-commonjs-to-esm' : 'convert-esm-to-commonjs';
|
|
6
|
+
|
|
7
|
+
module.exports = ({type}, options) => {
|
|
8
|
+
const rule = getRuleByType(type);
|
|
9
|
+
const js = '*.js';
|
|
10
|
+
|
|
11
|
+
assign(options, {
|
|
12
|
+
match: {
|
|
13
|
+
...options.match,
|
|
14
|
+
[js]: {
|
|
15
|
+
...options.match?.[js],
|
|
16
|
+
[rule]: 'on',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
@@ -15,6 +15,7 @@ const parseMatch = require('./parse-match');
|
|
|
15
15
|
const defaultOptions = require('../../putout.json');
|
|
16
16
|
const merge = require('../merge');
|
|
17
17
|
const recursiveRead = require('./recursive-read');
|
|
18
|
+
const applyModuleTypeRules = require('./apply-module-type-rules');
|
|
18
19
|
|
|
19
20
|
const home = homedir();
|
|
20
21
|
|
|
@@ -71,12 +72,14 @@ const includes = (name) => (dir, names) => names.includes(name) && name;
|
|
|
71
72
|
|
|
72
73
|
function _readOptions(name) {
|
|
73
74
|
const [dir, options] = recursiveRead(name, '.putout.json');
|
|
75
|
+
const [, packagePath] = tryCatch(escalade, name, includes('package.json'));
|
|
76
|
+
|
|
77
|
+
if (packagePath)
|
|
78
|
+
applyModuleTypeRules(require(packagePath), options);
|
|
74
79
|
|
|
75
80
|
if (dir)
|
|
76
81
|
return [dir, options];
|
|
77
82
|
|
|
78
|
-
const [, packagePath] = tryCatch(escalade, name, includes('package.json'));
|
|
79
|
-
|
|
80
83
|
if (packagePath)
|
|
81
84
|
return [
|
|
82
85
|
dirname(packagePath),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "putout",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.3.1",
|
|
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",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"./exit-codes": "./lib/cli/exit-codes.mjs",
|
|
17
17
|
"./cli": "./lib/cli/index.js",
|
|
18
18
|
"./loader": "./lib/loader.js",
|
|
19
|
+
"./eslint": "./lib/cli/eslint/index.js",
|
|
19
20
|
"./package.json": "./package.json"
|
|
20
21
|
},
|
|
21
22
|
"bin": {
|
|
@@ -110,7 +111,7 @@
|
|
|
110
111
|
"@putout/plugin-npmignore": "^2.0.0",
|
|
111
112
|
"@putout/plugin-package-json": "^1.0.0",
|
|
112
113
|
"@putout/plugin-promises": "^6.0.0",
|
|
113
|
-
"@putout/plugin-putout": "^
|
|
114
|
+
"@putout/plugin-putout": "^7.0.0",
|
|
114
115
|
"@putout/plugin-putout-config": "^1.0.0",
|
|
115
116
|
"@putout/plugin-regexp": "^2.0.0",
|
|
116
117
|
"@putout/plugin-remove-boolean-from-assertions": "^1.0.0",
|