putout 29.10.0 → 29.11.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,48 @@
1
+ 2023.06.03, v29.11.0
2
+
3
+ feature:
4
+ - dea4b68d1 putout: exit-codes: --staged: add CANNOT_LINT_STAGED
5
+ - 31c597a47 @putout/engine-parser: babel plugins: add back support of assert in ImportDeclartations
6
+ - a2e019aab @putout/plugin-minify: mangle-names: get back old behaviour since it is more optimal
7
+ - fd7535350 @putout/plugin-minify: mangle-names: use index of scope instead of global counter
8
+ - 885caad0f @putout/engine-parser: add support of import attributes (https://babeljs.io/blog/2023/05/26/7.22.0#import-attributes-15536-15620)
9
+ - 8b3492fb8 @putout/engine-parser: babel: plugins: remove enabled by default
10
+ - 825f6919a @putout/plugin-new: remove-useless: add TypeError
11
+ - be9c83b11 @putout/plugin-minify: expand-bindings: keep only Identifiers
12
+ - 3b3f6f9c4 @putout/plugin-minify: expand-variables: add
13
+ - 550493d90 @putout/plugin-minify: convert-strict-equal-to-equal: add
14
+ - 9150cce3e @putout/plugin-types: use @putout/printer
15
+ - d29eb0bd7 @putout/plugin-types: convert-typeof-to-is-type: improve support of node var binding
16
+ - 47af1a29a @putout/plugin-minify: shorten-names: improve support of freeze, defineProperty
17
+ - cc6f5f577 @putout/engine-runner: store: uplist: check node
18
+ - 806d1a483 @putout/plugin-minify: shorten-name
19
+ - 41dccd651 @putout/plugin-minify: shorten-names: improve support
20
+ - 72990c057 @putout/plugin-minify: merge-variables: add
21
+ - 0195c179d @putout/plugin-minify: convert-const-to-var: add
22
+ - 9edb1d2c8 @putout/plugin-minify: shorten: add ability to check printed
23
+ - ada9b57a2 @putout/plugin-minify: shorten-names: declared
24
+ - b1ff89935 @putout/plugin-minify: shorten names: add
25
+
26
+ 2023.05.30, v29.10.1
27
+
28
+ feature:
29
+ - 6ba50e15b package: @putout/plugin-convert-arguments-to-rest v2.0.0
30
+ - 7b802861c @putout/plugin-convert-arguments-to-reste: use @putout/printer
31
+ - db0627645 @putout/plugin-convert-arguments-to-reste: report
32
+ - f9155a5de @putout/plugin-convert-arguments-to-rest: drop support of 🐊 < 29
33
+ - 280ed412c @putout/plugin-minify: mangle-names: simplify
34
+ - 7ad0230ec @putout/plugin-cloudcmd: use @putout/printer
35
+ - de569a19d @putout/plugin-cloudcmd: drop support of 🐊 < 29
36
+ - bdf015905 @putout/plugin: use operator.rename
37
+ - eba4bf6de @putout/plugin-react-router: convert-switch-to-routes: simplify
38
+ - e25d371ca @putout/operate: rename: apply shorthand
39
+ - 046f4400a @putout/plugin-react-hook-form: drop support of 🐊 < 29
40
+ - c81a3c229 @putout/plugin-react-hook-form: use operator.rename
41
+ - a668addfc @putout/plugin-putout: use rename from operator
42
+ - 2a59b6d64 @putout/plugin-putout: declare: add rename, renameProperty
43
+ - 2cdcd0bb0 @putout/operate: rename: add
44
+ - 4827d77af @putout/operate: renameProperty: add
45
+
1
46
  2023.05.29, v29.10.0
2
47
 
3
48
  fix:
@@ -15,5 +15,6 @@ module.exports = {
15
15
  RULLER_NO_FILES: 11,
16
16
  INVALID_CONFIG: 12,
17
17
  UNHANDLED: 13,
18
+ CANNOT_LINT_STAGED: 14,
18
19
  };
19
20
 
@@ -12,3 +12,4 @@ export const RULLER_WITH_FIX = 10;
12
12
  export const RULLER_NO_FILES = 11;
13
13
  export const INVALID_CONFIG = 12;
14
14
  export const UNHANDLED = 13;
15
+ export const CANNOT_LINT_STAGED = 14;
package/lib/cli/index.js CHANGED
@@ -39,6 +39,7 @@ const {
39
39
  RULLER_WITH_FIX,
40
40
  RULLER_NO_FILES,
41
41
  INVALID_CONFIG,
42
+ CANNOT_LINT_STAGED,
42
43
  } = require('./exit-codes');
43
44
 
44
45
  const getFormatter = memo(require('./formatter').getFormatter);
@@ -230,7 +231,10 @@ module.exports = async ({argv, halt, log, write, logError, readFile, writeFile})
230
231
  if (staged) {
231
232
  const {get} = require('./staged');
232
233
  const {findUp} = await simpleImport('find-up');
233
- const names = await get({findUp});
234
+ const [error, names] = await tryToCatch(get, {findUp});
235
+
236
+ if (error)
237
+ return exit(CANNOT_LINT_STAGED, `--staged: ${error.message}`);
234
238
 
235
239
  stagedNames.push(...names);
236
240
  }
package/lib/cli/staged.js CHANGED
@@ -28,6 +28,9 @@ const findGit = once(async ({findUp}) => {
28
28
  type,
29
29
  });
30
30
 
31
+ if (!gitDir)
32
+ throw Error('not git repository');
33
+
31
34
  const dir = gitDir.replace(/\.git$/, '');
32
35
 
33
36
  return dir;
@@ -40,10 +43,6 @@ const joinDir = (a) => (b) => join(a, b);
40
43
 
41
44
  module.exports.get = async function get({findUp}) {
42
45
  const dir = await findGit({findUp});
43
-
44
- if (!dir)
45
- return [];
46
-
47
46
  const status = await git.statusMatrix({
48
47
  fs,
49
48
  dir,
@@ -72,10 +71,6 @@ async function getStatus(dir, filepath) {
72
71
 
73
72
  module.exports.set = async function set({findUp}) {
74
73
  const dir = await findGit({findUp});
75
-
76
- if (!dir)
77
- return;
78
-
79
74
  const names = namesStore();
80
75
  const statusPromises = [];
81
76
 
@@ -3,13 +3,14 @@
3
3
  const {normalize} = require('path');
4
4
  const picomatch = require('picomatch');
5
5
 
6
+ let isMatch = Boolean;
6
7
  let patterns = [];
7
- let isMatch;
8
8
 
9
9
  const rmDuplicates = (a) => Array.from(new Set(a));
10
10
 
11
11
  module.exports.add = (array) => {
12
12
  patterns = rmDuplicates(patterns.concat(array));
13
+
13
14
  isMatch = picomatch(patterns, {
14
15
  dot: true,
15
16
  matchBase: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "putout",
3
- "version": "29.10.0",
3
+ "version": "29.11.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",
@@ -79,7 +79,7 @@
79
79
  "@putout/plugin-browserlist": "^1.0.0",
80
80
  "@putout/plugin-conditions": "^1.0.0",
81
81
  "@putout/plugin-convert-apply-to-spread": "^3.0.0",
82
- "@putout/plugin-convert-arguments-to-rest": "^1.0.0",
82
+ "@putout/plugin-convert-arguments-to-rest": "^2.0.0",
83
83
  "@putout/plugin-convert-array-copy-to-slice": "^2.0.0",
84
84
  "@putout/plugin-convert-assignment-to-arrow-function": "^1.0.0",
85
85
  "@putout/plugin-convert-assignment-to-comparison": "^1.0.0",