putout 19.7.1 → 20.2.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 CHANGED
@@ -1,3 +1,80 @@
1
+ 2021.09.16, v20.2.0
2
+
3
+ fix:
4
+ - chore(nycrc) exclude: fixture -> *fixture
5
+
6
+ feature:
7
+ - (eslint-plugin-putout) no-resolve: add support of import directory
8
+ - (putout) export putout/eslint
9
+ - (eslint-plugin-putout) add no-unresolved
10
+ - (@putout/plugin-declare-undefined-variables) add support of basename, dirname, extname from path
11
+ - (package) @putout/plugin-remove-useless-async v4.0.0
12
+ - (@putout/plugin-remove-useless-async) drop support of node < 14
13
+ - (@putout/plugin-remove-useless-async) report: Useless async should be avoided -> Avoid useless async
14
+ - (@putout/plugin-declare-undefined-variables) add support of reImport, stopAll
15
+ - (@putout/plugin-remove-duplicate-keys) add support of rename while destructuring
16
+ - (eslint-plugin-putout) safe: disable remove-unused-for-of-variables
17
+
18
+
19
+ 2021.09.15, v20.1.0
20
+
21
+ fix:
22
+ - (eslint-plugin-putout) putout/ide -> putout/safe
23
+
24
+ feature:
25
+ - (help) improve help (#81) (thanks a lot to @egilll 🎉!)
26
+ - (@putout/plugin-declare-undefined-variables) add support of Object.keys
27
+ - (@putout/plugin-tape) add convert-called-with-args
28
+ - (@putout/engine-loader) add ☝️ when cannot determine plugin type
29
+ - (@putout/engine-runner) add support of "include" not a function in Includer
30
+ - (package) @putout/plugin-eslint v2.0.0
31
+ - (@putout/plugin-eslint) drop support of putout < 20
32
+ - (@putout/plugin-eslint) add convert-ide-to-safe
33
+
34
+
35
+ 2021.09.12, v20.0.1
36
+
37
+ fix:
38
+ - (eslint-plugin-putout) putout/ide -> putout/safe
39
+
40
+ feature:
41
+ - (package) @putout/plugin-eslint v2.0.0
42
+ - (@putout/plugin-eslint) drop support of putout < 20
43
+ - (@putout/plugin-eslint) add covert-ide-to-safe
44
+ - (@putout/engine-loader) parse-rules: validation: add ☝️
45
+ - (package) eslint-plugin-putout v10.0.0
46
+
47
+
48
+ 2021.09.12, v20.0.0
49
+
50
+ fix:
51
+ - (eslint-plugin-putout) package: description: plagin -> plugin
52
+ - (putout) export: putout/lib/parse-options -> putout/parse-options (#48)
53
+ - (@putout/plugin-putout-config) examples
54
+ - (@putout/test) homepage
55
+ - (@putout/engine-runner) rm "☝️ " -> "☝️""
56
+ - docs(@putout/test) add Autofix
57
+
58
+ feature:
59
+ - (putout) eslint-plugin-putout v10.0.0
60
+ - (eslint-plugin-putout) drop support of putout < 20
61
+ - (putout) add ability to import exit codes enum
62
+ - (package) improve description
63
+ - (putout) help: remove enabled by default options
64
+ - (putout) cli: add `🐊` to error messages
65
+ - (putout) cli: add ability to exit with error when ruler toggler used without a path
66
+ - (@putout/plugin-putout-config) add remove-empty
67
+ - (@putout/plugin-putout) add apply-processors-destructuring
68
+ - (@putout/engine-runner) add ☝️
69
+ - (@putout/plugin-putout) add convert-traverse-to-replace
70
+ - (@putout/engine-runner) improve error message when visitor provided to Traverser is not a function (https://github.com/coderaiser/putout/tree/v19.7.1/packages/engine-runner#traverser)
71
+ - (eslint-plugin-putout) ide: disable remove-unused-expressions
72
+ - (@putout/plugin-tape) add convert-called-with-no-args-to-called-with
73
+ - (@putout/plugin-putout) check-replace-code: __array: add support of CallExpression
74
+ - (@putout/engine-loader) validate-rules: throw when passing options to nested plugin (instead of go nowhere) (coderaiser/estrace#4)
75
+ - (@putout/engine-runner) throw error when no visitor
76
+
77
+
1
78
  2021.09.05, v19.7.1
2
79
 
3
80
  fix:
package/README.md CHANGED
@@ -107,28 +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 use a specific output format - default: progress-bar/dump on CI
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 count of fixes rounds (defaults to 10)
116
+ --fix-count [count = 10] count of fixes rounds
117
117
  --rulesdir use additional rules from directory
118
- --transform apply inline transform
119
- --plugins plugins to use splited by comma
120
- --enable enable rule by name in .putout.json
121
- --disable disable rule by name in .putout.json
122
- --enable-all enable all rules in .putout.json
123
- --disable-all disable all rules in .putout.json
124
- --match read .putout.json and convert "rules" to "match" using pattern
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
- --no-flow disable flow (default)
127
- --cache enable cache to speed up processing (default)
128
126
  --fresh generate a fresh cache
129
- --no-config avoid reading config file (.putout.json)
130
- --no-ci disable CI detection
131
- --no-cache disable cache
127
+ --no-config avoid reading '.putout.json'
128
+ --no-ci disable the CI detection
129
+ --no-cache disable the cache
132
130
  ```
133
131
 
134
132
  To find erros:
package/help.json CHANGED
@@ -1,24 +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 ": "use a specific output format - default: progress-bar/dump on CI",
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 ": "count of fixes rounds (defaults to 10)",
7
+ "--fix-count [count = 10] ": "count of fixes rounds",
8
8
  "--rulesdir ": "use additional rules from directory",
9
- "--transform ": "apply inline transform",
10
- "--plugins ": "plugins to use splited by comma",
11
- "--enable ": "enable rule by name in .putout.json",
12
- "--disable ": "disable rule by name in .putout.json",
13
- "--enable-all ": "enable all rules in .putout.json",
14
- "--disable-all ": "disable all rules in .putout.json",
15
- "--match ": "read .putout.json and convert \"rules\" to \"match\" using pattern",
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
- "--no-flow ": "disable flow (default)",
18
- "--cache ": "enable cache to speed up processing (default)",
19
17
  "--fresh ": "generate a fresh cache",
20
- "--no-config ": "avoid reading config file (.putout.json)",
21
- "--no-ci ": "disable CI detection",
22
- "--no-cache ": "disable cache"
18
+ "--no-config ": "avoid reading '.putout.json'",
19
+ "--no-ci ": "disable the CI detection",
20
+ "--no-cache ": "disable the cache"
23
21
 
24
22
  }
@@ -12,5 +12,6 @@ module.exports = {
12
12
  CANNOT_LOAD_PROCESSOR: 8,
13
13
  UNHANDLED: 9,
14
14
  RULLER_WITH_FIX: 10,
15
+ RULLER_NO_FILES: 11,
15
16
  };
16
17
 
@@ -0,0 +1,13 @@
1
+ export const OK = 0;
2
+ export const PLACE = 1;
3
+ export const STAGE = 2;
4
+ export const NO_FILES = 3;
5
+ export const NO_PROCESSORS = 4;
6
+ export const NO_FORMATTER = 5;
7
+ export const WAS_STOP = 6;
8
+ export const INVALID_OPTION = 7;
9
+ export const CANNOT_LOAD_PROCESSOR = 8;
10
+ export const UNHANDLED = 9;
11
+ export const RULLER_WITH_FIX = 10;
12
+ export const RULLER_NO_FILES = 11;
13
+
package/lib/cli/help.js CHANGED
@@ -5,7 +5,7 @@ module.exports = () => {
5
5
  const usage = 'Usage: putout [options] [path]';
6
6
  const result = [
7
7
  usage,
8
- 'Options',
8
+ 'Options: ',
9
9
  ];
10
10
 
11
11
  for (const name of Object.keys(bin)) {
package/lib/cli/index.js CHANGED
@@ -47,6 +47,7 @@ const {
47
47
  INVALID_OPTION,
48
48
  UNHANDLED,
49
49
  RULLER_WITH_FIX,
50
+ RULLER_NO_FILES,
50
51
  } = require('./exit-codes');
51
52
 
52
53
  const cwd = process.cwd();
@@ -257,7 +258,12 @@ module.exports = async ({argv, halt, log, write, logError, readFile, writeFile})
257
258
  if (e)
258
259
  return exit(NO_FILES, e);
259
260
 
260
- if (!names.length)
261
+ const noFiles = !names.length;
262
+
263
+ if (noFiles && (enableAll || disableAll))
264
+ return exit(RULLER_NO_FILES, Error('`path` is missing for ruler toggler (`--enable-all`, `--disable-all`)'));
265
+
266
+ if (noFiles)
261
267
  return exit();
262
268
 
263
269
  const fileCache = await cacheFiles({
@@ -424,7 +430,7 @@ const getExit = ({halt, raw, logError}) => (code, e) => {
424
430
  if (!e)
425
431
  return halt(code);
426
432
 
427
- const message = raw ? e : red(e.message || e);
433
+ const message = raw ? e : red(`🐊 ${e.message || e}`);
428
434
 
429
435
  logError(message);
430
436
  halt(code);
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "putout",
3
- "version": "19.7.1",
3
+ "version": "20.2.0",
4
4
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
5
- "description": "the pluggable code transformer",
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",
7
7
  "main": "./lib/putout.js",
8
8
  "exports": {
@@ -12,10 +12,11 @@
12
12
  },
13
13
  "./parse-options": "./lib/parse-options/index.js",
14
14
  "./parse-error": "./lib/cli/parse-error.js",
15
- "./lib/parse-options": "./lib/parse-options/index.js",
16
15
  "./process-file": "./lib/cli/process-file.js",
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": {
@@ -97,7 +98,7 @@
97
98
  "@putout/plugin-convert-to-arrow-function": "^3.0.0",
98
99
  "@putout/plugin-convert-top-level-return": "^4.0.0",
99
100
  "@putout/plugin-declare-undefined-variables": "^2.0.0",
100
- "@putout/plugin-eslint": "^1.0.0",
101
+ "@putout/plugin-eslint": "^2.0.0",
101
102
  "@putout/plugin-extract-object-properties": "^6.0.0",
102
103
  "@putout/plugin-extract-sequence-expressions": "^2.0.0",
103
104
  "@putout/plugin-github": "^1.0.0",
@@ -217,7 +218,7 @@
217
218
  "currify": "^4.0.0",
218
219
  "eslint": "^8.0.0-beta.0",
219
220
  "eslint-plugin-node": "^11.0.0",
220
- "eslint-plugin-putout": "^9.0.0",
221
+ "eslint-plugin-putout": "^10.0.0",
221
222
  "just-camel-case": "^4.0.2",
222
223
  "lerna": "^4.0.0",
223
224
  "madrun": "^8.6.0",