putout 30.0.2 → 30.1.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 +16 -0
- package/README.md +2 -1
- package/help.json +2 -1
- package/lib/cli/index.js +4 -2
- package/lib/cli/process-file.js +2 -1
- package/lib/cli/runner/worker.js +3 -6
- package/lib/putout.js +9 -0
- package/package.json +3 -3
package/ChangeLog
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
2023.07.06, v30.1.0
|
|
2
|
+
|
|
3
|
+
feature:
|
|
4
|
+
- 91a14b37d putout: --no-force: add
|
|
5
|
+
- d2ac969c3 @putout/plugin-promise: convert-new-promise-to-async: arrow function without body
|
|
6
|
+
- 7c281c4f6 package: stylelint-config-standard v34.0.0
|
|
7
|
+
|
|
8
|
+
2023.07.06, v30.0.3
|
|
9
|
+
|
|
10
|
+
feature:
|
|
11
|
+
- f0e9054b0 package: @putout/engine-loader v10.0.0
|
|
12
|
+
- daf5b7fd9 package: @putout/engine-parser v7.1.0
|
|
13
|
+
- 1fc9ff504 @putout/engine-parser: add support of Explicit Resource Management (https://github.com/tc39/proposal-explicit-resource-management)
|
|
14
|
+
- 42b95219c package: eslint-plugin-putout v18.0.0
|
|
15
|
+
- 6ba4a3b38 eslint-plugin-putout: drop support of 🐊 < 30
|
|
16
|
+
|
|
1
17
|
2023.07.05, v30.0.2
|
|
2
18
|
|
|
3
19
|
feature:
|
package/README.md
CHANGED
|
@@ -174,13 +174,14 @@ Options:
|
|
|
174
174
|
--enable [rule] enable the rule and save it to '.putout.json' walking up parent directories
|
|
175
175
|
--disable [rule] disable the rule and save it to '.putout.json' walking up parent directories
|
|
176
176
|
--enable-all enable all found rules and save them to '.putout.json' walking up parent directories
|
|
177
|
-
--disable-all disable all found rules (set baseline) and save them '.putout.json' walking up parent directories
|
|
177
|
+
--disable-all disable all found rules (set baseline) and save them to '.putout.json' walking up parent directories
|
|
178
178
|
--match [pattern] read '.putout.json' and convert 'rules' to 'match' according to 'pattern'
|
|
179
179
|
--flow enable flow
|
|
180
180
|
--fresh generate a fresh cache
|
|
181
181
|
--no-config avoid reading '.putout.json'
|
|
182
182
|
--no-ci disable the CI detection
|
|
183
183
|
--no-cache disable the cache
|
|
184
|
+
--no-force avoid source change when no places found
|
|
184
185
|
```
|
|
185
186
|
|
|
186
187
|
To find errors:
|
package/help.json
CHANGED
|
@@ -17,5 +17,6 @@
|
|
|
17
17
|
"--fresh ": "generate a fresh cache",
|
|
18
18
|
"--no-config ": "avoid reading '.putout.json'",
|
|
19
19
|
"--no-ci ": "disable the CI detection",
|
|
20
|
-
"--no-cache ": "disable the cache"
|
|
20
|
+
"--no-cache ": "disable the cache",
|
|
21
|
+
"--no-force ": "avoid source change when no places found"
|
|
21
22
|
}
|
package/lib/cli/index.js
CHANGED
|
@@ -46,9 +46,7 @@ const {isSupported} = supportedFiles;
|
|
|
46
46
|
const getFormatter = nanomemoize(require('./formatter').getFormatter);
|
|
47
47
|
|
|
48
48
|
const cwd = process.cwd();
|
|
49
|
-
|
|
50
49
|
const {PUTOUT_FILES = '', PUTOUT_PRINTER} = process.env;
|
|
51
|
-
|
|
52
50
|
const envNames = !PUTOUT_FILES ? [] : PUTOUT_FILES.split(',');
|
|
53
51
|
|
|
54
52
|
const maybeFirst = (a) => isArray(a) ? a.pop() : a;
|
|
@@ -78,6 +76,7 @@ module.exports = async ({argv, halt, log, write, logError, readFile, writeFile})
|
|
|
78
76
|
'help',
|
|
79
77
|
'fix',
|
|
80
78
|
'fresh',
|
|
79
|
+
'force',
|
|
81
80
|
'raw',
|
|
82
81
|
'enable-all',
|
|
83
82
|
'disable-all',
|
|
@@ -114,6 +113,7 @@ module.exports = async ({argv, halt, log, write, logError, readFile, writeFile})
|
|
|
114
113
|
disableAll: false,
|
|
115
114
|
enableAll: false,
|
|
116
115
|
plugins: [],
|
|
116
|
+
force: true,
|
|
117
117
|
},
|
|
118
118
|
};
|
|
119
119
|
|
|
@@ -126,6 +126,7 @@ module.exports = async ({argv, halt, log, write, logError, readFile, writeFile})
|
|
|
126
126
|
|
|
127
127
|
const {
|
|
128
128
|
fix,
|
|
129
|
+
force,
|
|
129
130
|
fixCount,
|
|
130
131
|
raw,
|
|
131
132
|
rulesdir,
|
|
@@ -278,6 +279,7 @@ module.exports = async ({argv, halt, log, write, logError, readFile, writeFile})
|
|
|
278
279
|
|
|
279
280
|
const options = {
|
|
280
281
|
fix,
|
|
282
|
+
force,
|
|
281
283
|
isFlow,
|
|
282
284
|
fixCount,
|
|
283
285
|
raw,
|
package/lib/cli/process-file.js
CHANGED
|
@@ -16,12 +16,13 @@ const getMatchedOptions = (name, options) => {
|
|
|
16
16
|
return merge(options, parseMatch(name, options.match));
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
module.exports = ({fix, fixCount, isFlow, logError, raw, printer}) => async ({name, source, startLine, options}) => {
|
|
19
|
+
module.exports = ({fix, force, fixCount, isFlow, logError, raw, printer}) => async ({name, source, startLine, options}) => {
|
|
20
20
|
const isTS = /\.tsx?$/.test(name) || /{tsx?}$/.test(name);
|
|
21
21
|
const matchedOptions = getMatchedOptions(name, options);
|
|
22
22
|
|
|
23
23
|
const [e, result] = tryCatch(putout, source, {
|
|
24
24
|
fix,
|
|
25
|
+
force,
|
|
25
26
|
fixCount,
|
|
26
27
|
isTS,
|
|
27
28
|
isFlow,
|
package/lib/cli/runner/worker.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const {resolve} = require('path');
|
|
4
|
-
|
|
5
4
|
const {cwd, env} = require('process');
|
|
6
|
-
|
|
7
|
-
const tryCatch = require('try-catch');
|
|
8
5
|
const {readFileSync} = require('fs');
|
|
9
6
|
|
|
7
|
+
const tryCatch = require('try-catch');
|
|
10
8
|
const getOptions = require('../get-options.js');
|
|
11
|
-
|
|
12
9
|
const {INVALID_CONFIG, NO_PROCESSORS} = require('../exit-codes.js');
|
|
13
|
-
|
|
14
10
|
const {lint} = require('./lint.js');
|
|
15
11
|
|
|
16
12
|
const isParser = (rule) => rule.startsWith('parser');
|
|
@@ -30,7 +26,7 @@ const createFormatterProxy = (options) => {
|
|
|
30
26
|
});
|
|
31
27
|
};
|
|
32
28
|
|
|
33
|
-
module.exports = async ({readFile, report, writeFile, exit, raw, write, log, currentFormat, rulesdir, formatterOptions, noConfig, transform, plugins, index, fix, processFile, processorRunners, fileCache, name, count}) => {
|
|
29
|
+
module.exports = async ({readFile, report, writeFile, exit, raw, write, log, currentFormat, rulesdir, formatterOptions, noConfig, transform, plugins, index, fix, force, processFile, processorRunners, fileCache, name, count}) => {
|
|
34
30
|
const resolvedName = resolve(name).replace(/^\./, cwd);
|
|
35
31
|
|
|
36
32
|
const [configError, options] = tryCatch(getOptions, {
|
|
@@ -73,6 +69,7 @@ module.exports = async ({readFile, report, writeFile, exit, raw, write, log, cur
|
|
|
73
69
|
raw,
|
|
74
70
|
dir,
|
|
75
71
|
fix,
|
|
72
|
+
force,
|
|
76
73
|
options,
|
|
77
74
|
processorRunners,
|
|
78
75
|
log,
|
package/lib/putout.js
CHANGED
|
@@ -25,6 +25,7 @@ const defaultOpts = (opts = {}) => {
|
|
|
25
25
|
fixCount = 2,
|
|
26
26
|
loadPlugins = loader.loadPlugins,
|
|
27
27
|
runPlugins = runner.runPlugins,
|
|
28
|
+
force = true,
|
|
28
29
|
} = opts;
|
|
29
30
|
|
|
30
31
|
return {
|
|
@@ -32,6 +33,7 @@ const defaultOpts = (opts = {}) => {
|
|
|
32
33
|
parser,
|
|
33
34
|
printer,
|
|
34
35
|
fix,
|
|
36
|
+
force,
|
|
35
37
|
fixCount,
|
|
36
38
|
loadPlugins,
|
|
37
39
|
runPlugins,
|
|
@@ -50,6 +52,7 @@ module.exports = (source, opts) => {
|
|
|
50
52
|
sourceFileName,
|
|
51
53
|
sourceMapName,
|
|
52
54
|
printer,
|
|
55
|
+
force,
|
|
53
56
|
} = opts;
|
|
54
57
|
|
|
55
58
|
const [clearSource, shebang] = cutShebang(source);
|
|
@@ -65,6 +68,12 @@ module.exports = (source, opts) => {
|
|
|
65
68
|
|
|
66
69
|
const places = transform(ast, source, opts);
|
|
67
70
|
|
|
71
|
+
if (!places.length && !force)
|
|
72
|
+
return {
|
|
73
|
+
code: source,
|
|
74
|
+
places: [],
|
|
75
|
+
};
|
|
76
|
+
|
|
68
77
|
if (!opts.fix)
|
|
69
78
|
return {
|
|
70
79
|
code: source,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "putout",
|
|
3
|
-
"version": "30.0
|
|
3
|
+
"version": "30.1.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, Babel and support of js, jsx, typescript, flow, markdown, yaml and json",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@putout/cli-staged": "^1.0.0",
|
|
54
54
|
"@putout/cli-validate-args": "^1.0.0",
|
|
55
55
|
"@putout/compare": "^11.0.0",
|
|
56
|
-
"@putout/engine-loader": "^
|
|
56
|
+
"@putout/engine-loader": "^10.0.0",
|
|
57
57
|
"@putout/engine-parser": "^7.0.0",
|
|
58
58
|
"@putout/engine-processor": "^7.0.0",
|
|
59
59
|
"@putout/engine-runner": "^17.0.0",
|
|
@@ -209,7 +209,7 @@
|
|
|
209
209
|
"escover": "^3.2.2",
|
|
210
210
|
"eslint": "^8.0.1",
|
|
211
211
|
"eslint-plugin-n": "^16.0.0",
|
|
212
|
-
"eslint-plugin-putout": "^
|
|
212
|
+
"eslint-plugin-putout": "^18.0.0",
|
|
213
213
|
"just-camel-case": "^4.0.2",
|
|
214
214
|
"lerna": "^6.0.1",
|
|
215
215
|
"madrun": "^9.0.0",
|