eslint-plugin-putout 17.7.0 → 18.0.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.
Files changed (42) hide show
  1. package/README.md +5 -1
  2. package/lib/add-newline-after-function-call/index.js +1 -1
  3. package/lib/add-newline-before-function-call/index.js +1 -4
  4. package/lib/add-newline-before-return/index.js +2 -5
  5. package/lib/add-newlines-between-specifiers/index.js +0 -1
  6. package/lib/add-newlines-between-types-in-union/README.md +2 -2
  7. package/lib/add-newlines-between-types-in-union/index.js +0 -1
  8. package/lib/align-spaces/index.js +1 -4
  9. package/lib/array-element-newline/index.js +9 -11
  10. package/lib/common.js +0 -1
  11. package/lib/config/index.js +0 -1
  12. package/lib/destructuring-as-function-argument/index.js +0 -1
  13. package/lib/evaluate/index.js +5 -6
  14. package/lib/for-of-multiple-properties-destructuring/index.js +2 -8
  15. package/lib/function-declaration-paren-newline/index.js +1 -1
  16. package/lib/html.js +0 -1
  17. package/lib/index.js +12 -1
  18. package/lib/json.js +24 -7
  19. package/lib/jsx.js +0 -1
  20. package/lib/keyword-spacing/index.js +10 -9
  21. package/lib/long-properties-destructuring/index.js +4 -6
  22. package/lib/markdown.js +10 -6
  23. package/lib/multiple-properties-destructuring/index.js +3 -1
  24. package/lib/newline-function-call-arguments/index.js +1 -5
  25. package/lib/no-unresolved/index.js +0 -1
  26. package/lib/nonblock-statement-body-newline/index.js +1 -4
  27. package/lib/object-property-newline/index.js +1 -5
  28. package/lib/objects-braces-inside-array/index.js +0 -1
  29. package/lib/remove-empty-newline-after-import/index.js +2 -4
  30. package/lib/remove-empty-newline-after-last-element/index.js +1 -3
  31. package/lib/remove-empty-newline-after-last-specifier/index.js +1 -3
  32. package/lib/remove-empty-newline-before-first-specifier/index.js +1 -3
  33. package/lib/remove-empty-newline-between-declarations/index.js +1 -0
  34. package/lib/remove-empty-specifiers/index.js +0 -1
  35. package/lib/remove-newline-after-default-import/index.js +1 -3
  36. package/lib/remove-newline-from-empty-object/index.js +0 -1
  37. package/lib/single-property-destructuring/index.js +3 -12
  38. package/lib/tape-add-newline-between-tests/index.js +0 -1
  39. package/lib/tape-remove-newline-before-t-end/index.js +5 -6
  40. package/lib/ts.js +19 -32
  41. package/lib/yaml.js +0 -1
  42. package/package.json +4 -4
package/README.md CHANGED
@@ -197,7 +197,11 @@ The time is came for a [FlatConfig](https://eslint.org/blog/2022/08/new-config-s
197
197
 
198
198
  ```js
199
199
  const {recommended} = require('eslint-plugin-putout/config');
200
- module.exports = [...recommended, {}];
200
+
201
+ module.exports = [
202
+ ...recommended,
203
+ {},
204
+ ];
201
205
  ```
202
206
 
203
207
  `safe` and `safeAlign` supported as well.
@@ -69,6 +69,7 @@ module.exports.filter = ({node, getCommentsAfter, getSpacesAfterNode}) => {
69
69
  return true;
70
70
 
71
71
  const spacesAfterPrev = getSpacesAfterNode(prev);
72
+
72
73
  return !regExp.test(spacesAfterPrev);
73
74
  }
74
75
 
@@ -82,4 +83,3 @@ module.exports.fix = ({text}) => {
82
83
  module.exports.include = () => [
83
84
  'CallExpression',
84
85
  ];
85
-
@@ -54,10 +54,7 @@ module.exports.filter = ({text, node, getCommentsBefore, getSpacesBeforeNode}) =
54
54
 
55
55
  const spaces = getSpacesBeforeNode(prevA);
56
56
 
57
- if (regExp.test(spaces))
58
- return false;
59
-
60
- return true;
57
+ return !regExp.test(spaces);
61
58
  }
62
59
 
63
60
  return false;
@@ -27,7 +27,7 @@ module.exports.filter = ({text, node, getCommentsBefore, getSpacesBeforeNode}) =
27
27
  let i = n - 1;
28
28
  let count = 0;
29
29
 
30
- while(--i) {
30
+ while (--i) {
31
31
  const prevA = body[i];
32
32
  const spaces = getSpacesBeforeNode(prevA);
33
33
 
@@ -37,10 +37,7 @@ module.exports.filter = ({text, node, getCommentsBefore, getSpacesBeforeNode}) =
37
37
  ++count;
38
38
  }
39
39
 
40
- if (count < 1)
41
- return false;
42
-
43
- return true;
40
+ return !(count < 1);
44
41
  };
45
42
 
46
43
  module.exports.fix = ({text}) => {
@@ -24,4 +24,3 @@ module.exports.filter = ({text, node}) => {
24
24
 
25
25
  return regExp.test(text);
26
26
  };
27
-
@@ -5,13 +5,13 @@ This rule aims to add newlines between types in union. Part of [`eslint-plugin-p
5
5
  ## ❌ Example of incorrect code
6
6
 
7
7
  ```js
8
- const a = string | number | object | boolean;
8
+ type a = string | number | object | boolean;
9
9
  ```
10
10
 
11
11
  ## ✅ Example of correct code
12
12
 
13
13
  ```js
14
- const a = string
14
+ type a = string
15
15
  | number
16
16
  | object
17
17
  | boolean;
@@ -28,4 +28,3 @@ module.exports.fix = ({text}) => {
28
28
  module.exports.include = () => [
29
29
  'TSUnionType',
30
30
  ];
31
-
@@ -5,9 +5,7 @@ const alignedMap = new Map();
5
5
 
6
6
  module.exports.report = () => 'Spaces should be aligned on empty lines';
7
7
 
8
- module.exports.include = () => [
9
- 'Program',
10
- ];
8
+ module.exports.include = () => ['Program'];
11
9
 
12
10
  module.exports.fix = ({text}) => {
13
11
  return alignedMap.get(text);
@@ -23,4 +21,3 @@ module.exports.filter = ({text}) => {
23
21
 
24
22
  return true;
25
23
  };
26
-
@@ -15,6 +15,7 @@ module.exports.category = 'array';
15
15
  module.exports.report = () => 'Add newlines between array elements';
16
16
 
17
17
  const regexp = /['"\da-zA-Z]+, ['"\da-zA-Z]/;
18
+
18
19
  const isSupportedNode = (a) => {
19
20
  if (!a)
20
21
  return false;
@@ -22,10 +23,7 @@ const isSupportedNode = (a) => {
22
23
  if (a.type === 'Literal')
23
24
  return true;
24
25
 
25
- if (a.type === 'Identifier')
26
- return true;
27
-
28
- return false;
26
+ return a.type === 'Identifier';
29
27
  };
30
28
 
31
29
  module.exports.filter = ({text, node}) => {
@@ -61,16 +59,17 @@ module.exports.filter = ({text, node}) => {
61
59
  if (node.elements.length < 5 && isShortValues(node.elements))
62
60
  return false;
63
61
 
64
- if (regexp.test(text))
65
- return true;
66
-
67
- return false;
62
+ return regexp.test(text);
68
63
  };
69
64
  module.exports.fix = ({text}) => {
70
- return text.replace(/\[/g, '[\n').replace(/\]/g, '\n]')
65
+ return text
66
+ .replace(/\[/g, '[\n')
67
+ .replace(/\]/g, '\n]')
71
68
  .replace(/,/g, ',\n');
72
69
  };
73
- module.exports.include = () => ['ArrayExpression'];
70
+ module.exports.include = () => [
71
+ 'ArrayExpression',
72
+ ];
74
73
 
75
74
  function isShortValues(elements) {
76
75
  for (const {type, value} of elements) {
@@ -126,4 +125,3 @@ function differentTypes({elements}) {
126
125
 
127
126
  return false;
128
127
  }
129
-
package/lib/common.js CHANGED
@@ -22,4 +22,3 @@ module.exports.isCorrectImportLoc = (line, specifiers) => {
22
22
 
23
23
  return true;
24
24
  };
25
-
@@ -36,4 +36,3 @@ module.exports.safeAlign = [
36
36
  ...getPutoutConfig('safe+align'),
37
37
  ...plugins,
38
38
  ];
39
-
@@ -21,4 +21,3 @@ module.exports.include = () => [
21
21
  'FunctionExpression > .params[type=ObjectPattern]',
22
22
  'FunctionDeclaration > .params[type=ObjectPattern]',
23
23
  ];
24
-
@@ -5,15 +5,13 @@ const putout = require('putout');
5
5
 
6
6
  module.exports.category = 'evaluate';
7
7
  module.exports.report = () => 'Evaluate expression';
8
- module.exports.include = () => ['ImportDeclaration'];
8
+ module.exports.include = () => [
9
+ 'ImportDeclaration',
10
+ ];
9
11
 
10
12
  module.exports.filter = ({node}) => {
11
13
  const {value} = node.source;
12
-
13
- if (!value.startsWith('__putout_evaluate:'))
14
- return false;
15
-
16
- return true;
14
+ return value.startsWith('__putout_evaluate:');
17
15
  };
18
16
 
19
17
  module.exports.fix = ({text, node, filename}) => {
@@ -42,5 +40,6 @@ function evaluate({value, filename}) {
42
40
  });
43
41
 
44
42
  const fn = Function('__filename', '__dirname', 'require', code);
43
+
45
44
  return fn(filename, dirname(filename), require);
46
45
  }
@@ -6,19 +6,14 @@ module.exports.report = () => 'Keep all properties in one line when using destru
6
6
  module.exports.include = ({options}) => {
7
7
  const {maxProperties = 8} = options[0] || {};
8
8
 
9
- return [
10
- `VariableDeclarator[id.type="ObjectPattern"][id.properties.length<${maxProperties}]`,
11
- ];
9
+ return [`VariableDeclarator[id.type="ObjectPattern"][id.properties.length<${maxProperties}]`];
12
10
  };
13
11
 
14
12
  module.exports.filter = ({node, text}) => {
15
13
  if (node.parent.parent.type !== 'ForOfStatement')
16
14
  return false;
17
15
 
18
- if (!text.includes('\n'))
19
- return false;
20
-
21
- return true;
16
+ return text.includes('\n');
22
17
  };
23
18
 
24
19
  module.exports.fix = ({text}) => {
@@ -28,4 +23,3 @@ module.exports.fix = ({text}) => {
28
23
  .replace(/{\s*/g, '{')
29
24
  .replace(/\s*}/g, '}');
30
25
  };
31
-
@@ -6,6 +6,7 @@ module.exports.report = () => {
6
6
 
7
7
  module.exports.fix = ({text, node, getText}) => {
8
8
  const {body} = node.body;
9
+
9
10
  node.body.body = [];
10
11
 
11
12
  const paramsText = getText(node);
@@ -41,4 +42,3 @@ function checkFunction(text) {
41
42
 
42
43
  return before || after;
43
44
  }
44
-
package/lib/html.js CHANGED
@@ -6,4 +6,3 @@ module.exports = [{
6
6
  browser: true,
7
7
  },
8
8
  }];
9
-
package/lib/index.js CHANGED
@@ -7,9 +7,11 @@ const yaml = require('./yaml');
7
7
  const html = require('./html');
8
8
  const ts = require('./ts');
9
9
  const jsx = require('./jsx');
10
+
10
11
  const getRule = (a) => ({
11
12
  [a]: require(`./${a}`),
12
13
  });
14
+
13
15
  const getWrapRule = (a) => ({
14
16
  [a]: createPlugin(require(`./${a}`)),
15
17
  });
@@ -51,6 +53,7 @@ module.exports.rules = {
51
53
  };
52
54
  const config = require('@putout/eslint-config');
53
55
  const {rules} = config;
56
+
54
57
  const recommended = {
55
58
  ...config,
56
59
  rules: {
@@ -95,9 +98,17 @@ const recommended = {
95
98
  'n/no-missing-require': 'off',
96
99
  'n/no-process-exit': 'off',
97
100
  },
98
- overrides: [...markdown, ...json, ...yaml, ...html, ...ts, ...jsx],
101
+ overrides: [
102
+ ...markdown,
103
+ ...json,
104
+ ...yaml,
105
+ ...html,
106
+ ...ts,
107
+ ...jsx,
108
+ ],
99
109
  plugins: ['n'],
100
110
  };
111
+
101
112
  const safe = {
102
113
  ...recommended,
103
114
  rules: {
package/lib/json.js CHANGED
@@ -1,21 +1,39 @@
1
1
  'use strict';
2
2
 
3
3
  module.exports = [{
4
- files: ['*.json', '*{json}'],
4
+ files: [
5
+ '*.json',
6
+ '*{json}',
7
+ ],
5
8
  rules: {
6
- 'quotes': ['error', 'double'],
7
- 'quote-props': ['error', 'always'],
8
- 'comma-dangle': ['error', 'never'],
9
+ 'quotes': [
10
+ 'error',
11
+ 'double',
12
+ ],
13
+ 'quote-props': [
14
+ 'error',
15
+ 'always',
16
+ ],
17
+ 'comma-dangle': [
18
+ 'error',
19
+ 'never',
20
+ ],
9
21
  'comma-spacing': 'off',
10
22
  'function-paren-newline': 'off',
11
23
  'no-undef': 'off',
12
- 'eol-last': ['error', 'always'],
24
+ 'eol-last': [
25
+ 'error',
26
+ 'always',
27
+ ],
13
28
  'no-multi-spaces': 'off',
14
29
  },
15
30
  }, {
16
31
  files: 'package.json',
17
32
  rules: {
18
- indent: ['error', 2],
33
+ indent: [
34
+ 'error',
35
+ 2,
36
+ ],
19
37
  },
20
38
  }, {
21
39
  files: '*ignore{json}',
@@ -28,4 +46,3 @@ module.exports = [{
28
46
  indent: 'off',
29
47
  },
30
48
  }];
31
-
package/lib/jsx.js CHANGED
@@ -24,4 +24,3 @@ module.exports = [{
24
24
  }];
25
25
 
26
26
  module.exports.jsx = jsx;
27
-
@@ -20,10 +20,7 @@ const checkNodeSpace = ({text, node}) => {
20
20
  if (text.includes(`${key}(`))
21
21
  return true;
22
22
 
23
- if (key_ && text.includes(`${key_}(`))
24
- return true;
25
-
26
- return false;
23
+ return key_ && text.includes(`${key_}(`);
27
24
  };
28
25
 
29
26
  const fixNodeSpace = ({node, text}) => {
@@ -52,7 +49,10 @@ module.exports.fix = ({node, text}) => {
52
49
  if (isSwitchStatement(node))
53
50
  return fixSwitch(text);
54
51
 
55
- return fixNodeSpace({node, text});
52
+ return fixNodeSpace({
53
+ node,
54
+ text,
55
+ });
56
56
  };
57
57
 
58
58
  module.exports.include = () => [
@@ -70,7 +70,10 @@ module.exports.filter = ({node, text}) => {
70
70
  if (isSwitchStatement(node))
71
71
  return checkSwitch(text);
72
72
 
73
- return checkNodeSpace({node, text});
73
+ return checkNodeSpace({
74
+ node,
75
+ text,
76
+ });
74
77
  };
75
78
 
76
79
  function checkCatch(text) {
@@ -93,7 +96,5 @@ function fixCatch(text) {
93
96
  }
94
97
 
95
98
  function fixSwitch(text) {
96
- return text
97
- .replaceAll('switch (', 'switch(');
99
+ return text.replaceAll('switch (', 'switch(');
98
100
  }
99
-
@@ -11,7 +11,9 @@ module.exports.include = () => [
11
11
 
12
12
  module.exports.fix = ({text}) => {
13
13
  const end = text.indexOf('}') + 1;
14
- const startText = text.slice(0, end)
14
+
15
+ const startText = text
16
+ .slice(0, end)
15
17
  .replace(/,/g, ',\n ')
16
18
  .replace('{', '{\n ')
17
19
  .replace('}', '\n}');
@@ -33,10 +35,7 @@ module.exports.filter = ({node}) => {
33
35
  const isLoc = isCorrectLoc(line, properties);
34
36
  const isLength = isCorrectLength(properties);
35
37
 
36
- if (isLoc || isLength)
37
- return false;
38
-
39
- return true;
38
+ return !(isLoc || isLength);
40
39
  };
41
40
 
42
41
  function isCorrectLength(properties) {
@@ -49,4 +48,3 @@ function isCorrectLength(properties) {
49
48
 
50
49
  return true;
51
50
  }
52
-
package/lib/markdown.js CHANGED
@@ -8,7 +8,10 @@ const {jsx} = require('./jsx');
8
8
  const commonRules = {
9
9
  'no-undef': 'off',
10
10
  'no-empty': 'off',
11
- 'eol-last': ['error', 'never'],
11
+ 'eol-last': [
12
+ 'error',
13
+ 'never',
14
+ ],
12
15
  'no-unreachable': 'off',
13
16
  'no-constant-condition': 'off',
14
17
  'n/no-extraneous-require': 'off',
@@ -21,6 +24,7 @@ const commonRules = {
21
24
  'n/no-unsupported-features/n-builtins': 'off',
22
25
  'n/no-process-exit': 'off',
23
26
  };
27
+
24
28
  const parserOptions = {
25
29
  requireConfigFile: false,
26
30
  babelOptions: {
@@ -32,9 +36,7 @@ const parserOptions = {
32
36
  ...parserPlugins,
33
37
  ],
34
38
  },
35
- plugins: [
36
- '@babel/plugin-syntax-class-properties',
37
- ],
39
+ plugins: ['@babel/plugin-syntax-class-properties'],
38
40
  },
39
41
  };
40
42
 
@@ -81,7 +83,9 @@ module.exports = [{
81
83
  }, {
82
84
  files: '*.md{json}',
83
85
  rules: {
84
- 'eol-last': ['error', 'never'],
86
+ 'eol-last': [
87
+ 'error',
88
+ 'never',
89
+ ],
85
90
  },
86
91
  }];
87
-
@@ -2,6 +2,7 @@
2
2
 
3
3
  const {isImportDeclaration} = require('putout').types;
4
4
  const {parseImportSpecifiers} = require('parse-import-specifiers');
5
+
5
6
  const {
6
7
  isCorrectLoc,
7
8
  isCorrectImportLoc,
@@ -12,6 +13,7 @@ module.exports.report = () => 'Keep each property on separate lines when using m
12
13
 
13
14
  const parseOptions = (options) => {
14
15
  const {minProperties = 2} = options[0] || {};
16
+
15
17
  return {
16
18
  minProperties,
17
19
  };
@@ -29,6 +31,7 @@ module.exports.include = ({options}) => {
29
31
  module.exports.filter = ({node}, options) => {
30
32
  const {minProperties} = parseOptions(options);
31
33
  const {line} = node.loc.start;
34
+
32
35
  const {
33
36
  id,
34
37
  specifiers,
@@ -59,4 +62,3 @@ module.exports.fix = ({text}) => {
59
62
  .replace('}', '\n}')
60
63
  .replace(/\n\s*?\n/g, '\n');
61
64
  };
62
-
@@ -31,10 +31,7 @@ module.exports.filter = ({node, text}) => {
31
31
  const isOpenBracket = /^\(\n/.test(textPeace);
32
32
  const isCloseBracket = /\n\s*\)$/.test(textPeace);
33
33
 
34
- if (isOpenBracket && isCloseBracket)
35
- return false;
36
-
37
- return true;
34
+ return !(isOpenBracket && isCloseBracket);
38
35
  };
39
36
 
40
37
  module.exports.fix = ({text}) => {
@@ -43,4 +40,3 @@ module.exports.fix = ({text}) => {
43
40
  .replace(/,\s?/g, ',\n')
44
41
  .replace(/\)$/, '\n)');
45
42
  };
46
-
@@ -75,4 +75,3 @@ function resolveSource({dir, value}) {
75
75
 
76
76
  return `${value}.js`;
77
77
  }
78
-
@@ -27,10 +27,7 @@ module.exports.filter = ({text, node}) => {
27
27
  if (isIf(text, node))
28
28
  return true;
29
29
 
30
- if (isBody(text, node))
31
- return true;
32
-
33
- return false;
30
+ return isBody(text, node);
34
31
  };
35
32
 
36
33
  function isIf(text, node) {
@@ -20,10 +20,7 @@ module.exports.include = () => [
20
20
  ];
21
21
 
22
22
  module.exports.filter = ({node}) => {
23
- const {
24
- loc,
25
- right,
26
- } = node;
23
+ const {loc, right} = node;
27
24
 
28
25
  if (isVariableDeclarator(node)) {
29
26
  const {init} = node;
@@ -60,4 +57,3 @@ module.exports.fix = ({text}) => {
60
57
  .replace(/}/g, '\n}')
61
58
  .replace(/\n(\s+)?\n/g, '\n');
62
59
  };
63
-
@@ -36,4 +36,3 @@ module.exports.fix = ({text}) => {
36
36
  .replace(/},\n(\s+)?{/g, '}, {')
37
37
  .replace(badEndReg, '}]');
38
38
  };
39
-
@@ -8,10 +8,7 @@ const isSameGroup = (a, b) => {
8
8
  if (isLocal(a) && isLocal(b))
9
9
  return true;
10
10
 
11
- if (isNode(a) && isNode(b))
12
- return true;
13
-
14
- return false;
11
+ return isNode(a) && isNode(b);
15
12
  };
16
13
 
17
14
  module.exports = {
@@ -30,6 +27,7 @@ module.exports = {
30
27
  ImportDeclaration(node) {
31
28
  const source = context.sourceCode;
32
29
  const text = source.getText(node);
30
+
33
31
  const newline = source
34
32
  .getText(node, 0, 2)
35
33
  .replace(text, '');
@@ -10,11 +10,9 @@ module.exports.filter = ({text}) => {
10
10
  };
11
11
 
12
12
  module.exports.fix = ({text}) => {
13
- return text
14
- .replace(regExp, '\n]');
13
+ return text.replace(regExp, '\n]');
15
14
  };
16
15
 
17
16
  module.exports.include = () => [
18
17
  'ArrayExpression',
19
18
  ];
20
-
@@ -10,12 +10,10 @@ module.exports.filter = ({text}) => {
10
10
  };
11
11
 
12
12
  module.exports.fix = ({text}) => {
13
- return text
14
- .replace(regExp, '\n}');
13
+ return text.replace(regExp, '\n}');
15
14
  };
16
15
 
17
16
  module.exports.include = () => [
18
17
  'ImportDeclaration',
19
18
  'ObjectExpression',
20
19
  ];
21
-
@@ -10,12 +10,10 @@ module.exports.filter = ({text}) => {
10
10
  };
11
11
 
12
12
  module.exports.fix = ({text}) => {
13
- return text
14
- .replace(regExp, '{\n');
13
+ return text.replace(regExp, '{\n');
15
14
  };
16
15
 
17
16
  module.exports.include = () => [
18
17
  'ImportDeclaration',
19
18
  'ObjectExpression',
20
19
  ];
21
-
@@ -18,6 +18,7 @@ module.exports = {
18
18
  VariableDeclaration(node) {
19
19
  const source = context.sourceCode;
20
20
  const text = source.getText(node);
21
+
21
22
  const newline = source
22
23
  .getText(node, 0, 2)
23
24
  .replace(text, '');
@@ -21,4 +21,3 @@ module.exports.fix = ({text}) => {
21
21
  module.exports.include = () => [
22
22
  'ImportDeclaration',
23
23
  ];
24
-
@@ -10,11 +10,9 @@ module.exports.filter = ({text}) => {
10
10
  };
11
11
 
12
12
  module.exports.fix = ({text}) => {
13
- return text
14
- .replace(regExp, ', {');
13
+ return text.replace(regExp, ', {');
15
14
  };
16
15
 
17
16
  module.exports.include = () => [
18
17
  'ImportDeclaration',
19
18
  ];
20
-
@@ -28,4 +28,3 @@ module.exports.fix = () => '{}';
28
28
  module.exports.include = () => [
29
29
  'ObjectExpression',
30
30
  ];
31
-
@@ -1,9 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const {
4
- operator,
5
- types,
6
- } = require('putout');
3
+ const {operator, types} = require('putout');
7
4
 
8
5
  const {
9
6
  isRestElement,
@@ -15,9 +12,7 @@ const {
15
12
  const NewLinesReg = /([\s,]+)?\n(\s+)?/g;
16
13
  const AssignRegExp = /{\n?.*=.*\n?.*}/;
17
14
 
18
- const {
19
- compare,
20
- } = operator;
15
+ const {compare} = operator;
21
16
 
22
17
  module.exports.category = 'destructuring';
23
18
  module.exports.report = () => 'Keep curly braces on one line when you have one destructuring property';
@@ -46,10 +41,7 @@ module.exports.filter = ({node, text, getText, getCommentsInside}) => {
46
41
  const [property] = node.id.properties;
47
42
  const {value} = property;
48
43
 
49
- if (isAssignmentPattern(value))
50
- return false;
51
-
52
- return true;
44
+ return !isAssignmentPattern(value);
53
45
  }
54
46
 
55
47
  return false;
@@ -76,4 +68,3 @@ module.exports.fix = ({text, node, getText}) => {
76
68
 
77
69
  return text.replace(idText, `{${key.name}: ${value.name}}`);
78
70
  };
79
-
@@ -24,4 +24,3 @@ module.exports.fix = ({text}) => {
24
24
  module.exports.include = () => [
25
25
  'CallExpression ',
26
26
  ];
27
-
@@ -1,9 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const {
4
- operator,
5
- types,
6
- } = require('putout');
3
+ const {operator, types} = require('putout');
7
4
 
8
5
  const {
9
6
  isCallExpression,
@@ -38,7 +35,10 @@ module.exports.filter = ({text, node}) => {
38
35
  break;
39
36
 
40
37
  const {callee} = prev.expression;
41
- return isIdentifier(callee.object, {name: 't'});
38
+
39
+ return isIdentifier(callee.object, {
40
+ name: 't',
41
+ });
42
42
  }
43
43
 
44
44
  return false;
@@ -51,4 +51,3 @@ module.exports.fix = ({text}) => {
51
51
  module.exports.include = () => [
52
52
  'CallExpression',
53
53
  ];
54
-
package/lib/ts.js CHANGED
@@ -8,25 +8,16 @@ const warnOnUnsupportedTypeScriptVersion = false;
8
8
  const extensionRules = {
9
9
  'no-undef': 'off',
10
10
  'no-var': 'off',
11
-
12
- // putout/object-property-newline instead
13
- '@typescript-eslint/brace-style': 'off',
14
-
11
+ '@typescript-eslint/brace-style': 'off', // putout/object-property-newline instead
15
12
  'comma-dangle': 'off',
16
13
  '@typescript-eslint/comma-dangle': rules['comma-dangle'],
17
14
 
18
15
  'comma-spacing': 'off',
19
16
  '@typescript-eslint/comma-spacing': 'error',
20
-
21
- // requires type information
22
- '@typescript-eslint/dot-notation': 'off',
23
-
17
+ '@typescript-eslint/dot-notation': 'off', // requires type information
24
18
  'func-call-spacing': 'off',
25
19
  '@typescript-eslint/func-call-spacing': 'error',
26
-
27
- // broken
28
- '@typescript-eslint/indent': 'off',
29
-
20
+ '@typescript-eslint/indent': 'off', // broken
30
21
  '@typescript-eslint/lines-between-class-members': 'off',
31
22
  '@typescript-eslint/no-array-constructor': 'off',
32
23
 
@@ -59,7 +50,7 @@ const extensionRules = {
59
50
  '@typescript-eslint/space-before-function-paren': rules['space-before-function-paren'],
60
51
 
61
52
  'space-infix-ops': 'off',
62
- '@typescript-eslint/space-infix-ops': rules[ 'space-infix-ops'],
53
+ '@typescript-eslint/space-infix-ops': rules['space-infix-ops'],
63
54
 
64
55
  'no-redecalre': 'off',
65
56
  '@typescript-eslint/no-redeclare': 'error',
@@ -74,12 +65,8 @@ const ts = {
74
65
  jsx: false,
75
66
  },
76
67
  },
77
- plugins: [
78
- '@typescript-eslint',
79
- ],
80
- extends: [
81
- 'plugin:@typescript-eslint/recommended',
82
- ],
68
+ plugins: ['@typescript-eslint'],
69
+ extends: ['plugin:@typescript-eslint/recommended'],
83
70
  rules: {
84
71
  ...extensionRules,
85
72
  'putout/no-unresolved': 'off',
@@ -90,19 +77,17 @@ const ts = {
90
77
  },
91
78
  };
92
79
 
93
- module.exports = [
94
- ts, {
95
- ...ts,
96
- ...jsx.jsx,
97
- files: '*.tsx',
98
- parserOptions: {
99
- warnOnUnsupportedTypeScriptVersion,
100
- ecmaFeatures: {
101
- jsx: true,
102
- },
80
+ module.exports = [ts, {
81
+ ...ts,
82
+ ...jsx.jsx,
83
+ files: '*.tsx',
84
+ parserOptions: {
85
+ warnOnUnsupportedTypeScriptVersion,
86
+ ecmaFeatures: {
87
+ jsx: true,
103
88
  },
104
89
  },
105
- ];
90
+ }];
106
91
 
107
92
  function convertPaddingLines([state, ...lines]) {
108
93
  const newLines = [];
@@ -123,6 +108,8 @@ function convertPaddingLines([state, ...lines]) {
123
108
  });
124
109
  }
125
110
 
126
- return [state, ...newLines];
111
+ return [
112
+ state,
113
+ ...newLines,
114
+ ];
127
115
  }
128
-
package/lib/yaml.js CHANGED
@@ -7,4 +7,3 @@ module.exports = [{
7
7
  'putout/objects-braces-inside-array': 'off',
8
8
  },
9
9
  }];
10
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-putout",
3
- "version": "17.7.0",
3
+ "version": "18.0.0",
4
4
  "type": "commonjs",
5
5
  "description": "ESLint plugin for 🐊Putout",
6
6
  "release": false,
@@ -43,7 +43,7 @@
43
43
  "@babel/plugin-syntax-class-properties": "^7.12.1",
44
44
  "@babel/traverse": "^7.16.3",
45
45
  "@eslint/eslintrc": "^2.0.2",
46
- "@putout/engine-parser": "^6.0.0",
46
+ "@putout/engine-parser": "^7.0.0",
47
47
  "@putout/eslint": "^2.0.0",
48
48
  "@putout/eslint-config": "^7.0.0",
49
49
  "@typescript-eslint/eslint-plugin": "^5.5.0",
@@ -59,7 +59,7 @@
59
59
  "@babel/plugin-syntax-typescript": "^7.12.1",
60
60
  "@putout/plugin-eslint-plugin": "*",
61
61
  "@putout/test": "^6.0.0",
62
- "c8": "^7.5.0",
62
+ "c8": "^8.0.0",
63
63
  "eslint": "^8.0.1",
64
64
  "eslint-plugin-eslint-plugin": "^5.0.6",
65
65
  "madrun": "^9.0.0",
@@ -74,7 +74,7 @@
74
74
  },
75
75
  "peerDependencies": {
76
76
  "eslint": ">=8.0.0",
77
- "putout": ">=29"
77
+ "putout": ">=30"
78
78
  },
79
79
  "license": "MIT",
80
80
  "publishConfig": {