eslint-plugin-putout 13.6.0 → 13.9.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/README.md CHANGED
@@ -121,6 +121,7 @@ Disabled 🐊`Putout` rules:
121
121
  - [`remove-unreferenced-variables`](https://github.com/coderaiser/putout/tree/24.1.0/packages);
122
122
  - [`remove-useless-return`](https://github.com/coderaiser/putout/tree/master/remove-useless-return);
123
123
  - [`remove-useless-arguments`](https://github.com/coderaiser/putout/tree/master/remove-useless-arguments);
124
+ - [`remove-useless-spread`](https://github.com/coderaiser/putout/tree/master/remove-useless-spread/#readme);
124
125
  - [`remove-useless-variables/rename`](https://github.com/coderaiser/putout/tree/master/remove-useless-arguments#rename);
125
126
  - [`remove-skip`](https://github.com/coderaiser/putout/tree/v24.0.0/packages/remove-skip);
126
127
  - [`remove-only`](https://github.com/coderaiser/putout/tree/v24.0.0/packages/remove-only);
@@ -132,4 +133,3 @@ Disabled 🐊`Putout` rules:
132
133
  ### safe+align
133
134
 
134
135
  When you want to enable ability to align spaces on empty lines, while have all benefits of `safe` preset: use `safe+align`.
135
-
@@ -14,6 +14,7 @@ module.exports.fix = ({text}) => fixNewLines(text);
14
14
 
15
15
  module.exports.include = () => [
16
16
  'FunctionDeclaration',
17
+ 'FunctionExpression',
17
18
  'ArrowFunctionExpression',
18
19
  ];
19
20
 
package/lib/index.js CHANGED
@@ -116,6 +116,7 @@ const safe = {
116
116
  'remove-useless-return': 'off',
117
117
  'remove-useless-arguments': 'off',
118
118
  'remove-useless-variables/rename': 'off',
119
+ 'remove-useless-spread': 'off',
119
120
  'remove-unreferenced-variables': 'off',
120
121
  'tape/remove-skip': 'off',
121
122
  'tape/remove-only': 'off',
@@ -16,10 +16,7 @@ const RELATIVE = '\\.\\.?\\/?';
16
16
  const isRelativeStart = (a) => RegExp(`^${RELATIVE}`).test(a);
17
17
  const isRelativeEnd = (a) => RegExp(`${RELATIVE}$`).test(a);
18
18
  const getDir = (a) => a === '<input>' ? cwd : dirname(a);
19
- const getValue = (node) => {
20
- const {source} = node;
21
- return source?.value;
22
- };
19
+ const getValue = ({source}) => source?.value;
23
20
 
24
21
  module.exports.category = 'errors';
25
22
  module.exports.report = () => 'Always add an extension to relative imports';
package/lib/ts.js CHANGED
@@ -44,7 +44,7 @@ const extensionRules = {
44
44
  '@typescript-eslint/object-curly-spacing': 'error',
45
45
 
46
46
  'padding-line-between-statements': 'off',
47
- '@typescript-eslint/padding-line-between-statements': rules['padding-line-between-statements'],
47
+ '@typescript-eslint/padding-line-between-statements': convertPaddingLines(rules['padding-line-between-statements']),
48
48
 
49
49
  'quotes': 'off',
50
50
  '@typescript-eslint/quotes': rules.quotes,
@@ -101,3 +101,24 @@ module.exports = [
101
101
  },
102
102
  ];
103
103
 
104
+ function convertPaddingLines([state, ...lines]) {
105
+ const newLines = [];
106
+ for (const line of lines) {
107
+ let {prev, next} = line;
108
+
109
+ if (prev.includes('cjs-'))
110
+ prev = prev.replace('cjs-', '');
111
+
112
+ if (next.includes('cjs-'))
113
+ next = next.replace('cjs-', '');
114
+
115
+ newLines.push({
116
+ ...line,
117
+ prev,
118
+ next,
119
+ });
120
+ }
121
+
122
+ return [state, ...newLines];
123
+ }
124
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-putout",
3
- "version": "13.6.0",
3
+ "version": "13.9.1",
4
4
  "type": "commonjs",
5
5
  "description": "eslint plugin for putout",
6
6
  "release": false,
@@ -48,6 +48,8 @@
48
48
  "typescript": "^4.5.2"
49
49
  },
50
50
  "devDependencies": {
51
+ "@babel/plugin-syntax-typescript": "^7.12.1",
52
+ "@putout/test": "^4.3.0",
51
53
  "c8": "^7.5.0",
52
54
  "eslint": "^8.0.1",
53
55
  "eslint-plugin-eslint-plugin": "^3.2.0",
@@ -55,9 +57,8 @@
55
57
  "mocha": "^9.0.1",
56
58
  "montag": "^1.0.0",
57
59
  "simport": "^1.2.0",
58
- "supertape": "^6.6.0",
59
- "try-to-catch": "^3.0.0",
60
- "@babel/plugin-syntax-typescript": "^7.12.1"
60
+ "supertape": "^6.13.1",
61
+ "try-to-catch": "^3.0.0"
61
62
  },
62
63
  "engines": {
63
64
  "node": ">=14"