eslint-plugin-putout 14.4.0 → 14.5.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/lib/keyword-spacing/index.js +4 -4
- package/lib/newline-function-call-arguments/README.md +5 -6
- package/lib/object-init/README.md +5 -5
- package/lib/objects-braces-inside-array/README.md +5 -4
- package/lib/remove-empty-newline-after-import/README.md +4 -6
- package/lib/remove-empty-newline-after-last-element/README.md +1 -1
- package/lib/remove-empty-newline-before-first-specifier/README.md +4 -5
- package/lib/remove-empty-specifiers/README.md +4 -5
- package/lib/remove-newline-from-empty-object/README.md +4 -5
- package/lib/ts.js +1 -3
- package/package.json +1 -1
|
@@ -87,13 +87,13 @@ function checkSwitch(text) {
|
|
|
87
87
|
|
|
88
88
|
function fixCatch(text) {
|
|
89
89
|
return text
|
|
90
|
-
.
|
|
91
|
-
.
|
|
92
|
-
.
|
|
90
|
+
.replaceAll('catch{', 'catch {')
|
|
91
|
+
.replaceAll('}catch', '} catch')
|
|
92
|
+
.replaceAll('catch (', 'catch(');
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
function fixSwitch(text) {
|
|
96
96
|
return text
|
|
97
|
-
.
|
|
97
|
+
.replaceAll('switch (', 'switch(');
|
|
98
98
|
}
|
|
99
99
|
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# newline-function-call-arguments
|
|
2
2
|
|
|
3
3
|
Addition to eslint's [function-paren-newline](https://eslint.org/docs/rules/function-paren-newline)
|
|
4
|
+
This rule aims to fix eslint transform adding new line after opening brace.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
Part of [**eslint-plugin-putout**](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Examples of **incorrect** code for this rule:
|
|
8
|
+
## ❌ Example of incorrect code
|
|
10
9
|
|
|
11
10
|
```js
|
|
12
11
|
const onConnectError = squad(superFn(connect_error),
|
|
@@ -15,7 +14,7 @@ const onConnectError = squad(superFn(connect_error),
|
|
|
15
14
|
getDescription);
|
|
16
15
|
```
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
## ✅ Example of correct code
|
|
19
18
|
|
|
20
19
|
```js
|
|
21
20
|
const onConnectError = squad(
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
#
|
|
1
|
+
# object-init
|
|
2
2
|
|
|
3
|
-
In the same way as
|
|
3
|
+
Keep each property on separate line when initializing an object. In the same way as **ESLint** [`object-property-newline`](https://eslint.org/docs/rules/object-property-newline) but for initializing variables with [**Object Expression**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Part of [**eslint-plugin-putout**](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## ❌ Example of incorrect code
|
|
8
8
|
|
|
9
9
|
```js
|
|
10
10
|
const user = {name};
|
|
@@ -12,7 +12,7 @@ const user = {name};
|
|
|
12
12
|
module.exports = {lint: 'putout lint'};
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
## ✅ Example of correct code
|
|
16
16
|
|
|
17
17
|
```js
|
|
18
18
|
const user = {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# object-braces-inside-array
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Keep braces on the same line as brackets.
|
|
4
|
+
Part of [**eslint-plugin-putout**](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
## ❌ Example of incorrect code
|
|
6
7
|
|
|
7
8
|
```js
|
|
8
9
|
const expected = [
|
|
@@ -15,7 +16,7 @@ const expected = [
|
|
|
15
16
|
];
|
|
16
17
|
```
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
## ✅ Example of correct code
|
|
19
20
|
|
|
20
21
|
```js
|
|
21
22
|
const expected = [{
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# remove-empty-newline-after-import
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This rule aims to remove empty newline after [`import` statement](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import). Part of [**eslint-plugin-putout**](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Examples of **incorrect** code for this rule:
|
|
5
|
+
## ❌ Example of incorrect code
|
|
8
6
|
|
|
9
7
|
```js
|
|
10
8
|
import {readFile} from 'fs';
|
|
@@ -14,7 +12,7 @@ import {promisify} from 'util';
|
|
|
14
12
|
import index from './index.js';
|
|
15
13
|
```
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
## ✅ Example of correct code
|
|
18
16
|
|
|
19
17
|
```js
|
|
20
18
|
import {readFile} from 'fs';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# remove-empty-newline-after-last-element
|
|
2
2
|
|
|
3
3
|
Remove empty newline after last element.
|
|
4
|
-
Part of [
|
|
4
|
+
Part of [**eslint-plugin-putout**](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
|
|
5
5
|
|
|
6
6
|
## ❌ Example of incorrect code
|
|
7
7
|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
## Rule Details
|
|
1
|
+
# remove-empty-newline-before-first-specifier
|
|
4
2
|
|
|
5
3
|
This rule aims to remove empty newline before first specifier.
|
|
4
|
+
Part of [`eslint-plugin-putout`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
## ❌ Example of incorrect code
|
|
8
7
|
|
|
9
8
|
```js
|
|
10
9
|
import {
|
|
@@ -20,7 +19,7 @@ push({
|
|
|
20
19
|
});
|
|
21
20
|
```
|
|
22
21
|
|
|
23
|
-
|
|
22
|
+
## ✅ Example of correct code
|
|
24
23
|
|
|
25
24
|
```js
|
|
26
25
|
import {
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
## Rule Details
|
|
1
|
+
# remove-empty-specifiers
|
|
4
2
|
|
|
5
3
|
This rule aims to remove empty specifiers.
|
|
4
|
+
Part of [**eslint-plugin-putout**](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
## ❌ Example of incorrect code
|
|
8
7
|
|
|
9
8
|
```js
|
|
10
9
|
import putout, {} from 'putout';
|
|
11
10
|
```
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
## ✅ Example of correct code
|
|
14
13
|
|
|
15
14
|
```js
|
|
16
15
|
import putout from 'putout';
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
## Rule Details
|
|
1
|
+
# remove-newline-from-empty-object
|
|
4
2
|
|
|
5
3
|
This rule aims to remove newline from empty object.
|
|
4
|
+
Part of [`eslint-plugin-putout`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
## ❌ Example of incorrect code
|
|
8
7
|
|
|
9
8
|
```js
|
|
10
9
|
const a = {
|
|
11
10
|
};
|
|
12
11
|
```
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
## ✅ Example of correct code
|
|
15
14
|
|
|
16
15
|
```js
|
|
17
16
|
const a = {};
|
package/lib/ts.js
CHANGED
|
@@ -25,9 +25,7 @@ const extensionRules = {
|
|
|
25
25
|
// broken
|
|
26
26
|
'@typescript-eslint/indent': 'off',
|
|
27
27
|
|
|
28
|
-
'lines-between-class-members': 'off',
|
|
29
|
-
'@typescript-eslint/lines-between-class-members': 'error',
|
|
30
|
-
|
|
28
|
+
'@typescript-eslint/lines-between-class-members': 'off',
|
|
31
29
|
'@typescript-eslint/no-array-constructor': 'off',
|
|
32
30
|
|
|
33
31
|
'no-extra-parens': 'off',
|