eslint-plugin-putout 11.2.0 → 11.3.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/README.md
CHANGED
|
@@ -49,6 +49,7 @@ Then configure the rules you want to use under the rules section.
|
|
|
49
49
|
"putout/newline-function-call-arguments": "error",
|
|
50
50
|
"putout/function-declaration-paren-newline": "error",
|
|
51
51
|
"putout/remove-newline-after-default-import": "error",
|
|
52
|
+
"putout/remove-empty-newline-after-last-specifier": "error",
|
|
52
53
|
"putout/objects-braces-inside-array": "error",
|
|
53
54
|
"putout/object-init": "error"
|
|
54
55
|
}
|
|
@@ -68,6 +69,7 @@ Then configure the rules you want to use under the rules section.
|
|
|
68
69
|
- [Newline function call arguments](/packages/eslint-plugin-putout/lib/newline-function-call-arguments)
|
|
69
70
|
- [Function declaration paren newline](/packages/eslint-plugin-putout/lib/function-declaration-paren-newline)
|
|
70
71
|
- [Remove newline after default import](/packages/eslint-plugin-putout/lib/remove-newline-after-default-import)
|
|
72
|
+
- [Remove empty newline after last specifier](/packages/eslint-plugin-putout/lib/remove-empty-newline-after-last-specifier)
|
|
71
73
|
- [Objects braces inside array](/packages/eslint-plugin-putout/lib/objects-braces-inside-array)
|
|
72
74
|
- [Object init](/packages/eslint-plugin-putout/lib/object-init)
|
|
73
75
|
- [No unresolved](/packages/eslint-plugin-putout/lib/no-unresolved)
|
package/lib/index.js
CHANGED
|
@@ -26,6 +26,7 @@ module.exports.rules = {
|
|
|
26
26
|
...getWrapRule('newline-function-call-arguments'),
|
|
27
27
|
...getWrapRule('function-declaration-paren-newline'),
|
|
28
28
|
...getWrapRule('remove-newline-after-default-import'),
|
|
29
|
+
...getWrapRule('remove-empty-newline-after-last-specifier'),
|
|
29
30
|
...getWrapRule('objects-braces-inside-array'),
|
|
30
31
|
...getWrapRule('object-init'),
|
|
31
32
|
...getWrapRule('no-unresolved'),
|
|
@@ -55,6 +56,7 @@ const recommended = {
|
|
|
55
56
|
'putout/newline-function-call-arguments': 'error',
|
|
56
57
|
'putout/function-declaration-paren-newline': 'error',
|
|
57
58
|
'putout/remove-newline-after-default-import': 'error',
|
|
59
|
+
'putout/remove-empty-newline-after-last-specifier': 'error',
|
|
58
60
|
'putout/objects-braces-inside-array': 'error',
|
|
59
61
|
'putout/object-init': 'error',
|
|
60
62
|
'putout/no-unresolved': 'error',
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Remove empty new line after last specifier(remove-empty-newline-after-last-specifier)
|
|
2
|
+
|
|
3
|
+
## Rule Details
|
|
4
|
+
|
|
5
|
+
This rule aims to remove empty newline after last specifier.
|
|
6
|
+
|
|
7
|
+
Examples of **incorrect** code for this rule:
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
import {
|
|
11
|
+
a,
|
|
12
|
+
b,
|
|
13
|
+
|
|
14
|
+
} from 'y';
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Examples of **correct** code for this rule:
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
import {
|
|
21
|
+
a,
|
|
22
|
+
b,
|
|
23
|
+
} from 'y';
|
|
24
|
+
```
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports.category = 'import';
|
|
4
|
+
module.exports.report = () => 'Remove newline after last specifier';
|
|
5
|
+
|
|
6
|
+
const regExp = /\n\s+}/;
|
|
7
|
+
|
|
8
|
+
module.exports.filter = ({text}) => {
|
|
9
|
+
return regExp.test(text);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
module.exports.fix = ({text}) => {
|
|
13
|
+
return text
|
|
14
|
+
.replace(regExp, '\n}');
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
module.exports.include = () => [
|
|
18
|
+
'ImportDeclaration',
|
|
19
|
+
];
|
|
20
|
+
|