eslint-plugin-putout 13.9.1 → 13.12.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 +67 -50
- package/lib/evaluate/README.md +5 -8
- package/lib/function-declaration-paren-newline/README.md +19 -8
- package/lib/function-declaration-paren-newline/index.js +17 -7
- package/lib/index.js +4 -1
- package/lib/putout/index.js +2 -1
- package/lib/remove-empty-newline-after-last-element/README.md +23 -0
- package/lib/remove-empty-newline-after-last-element/index.js +20 -0
- package/lib/remove-empty-newline-after-last-specifier/README.md +5 -6
- package/lib/remove-newline-after-default-import/README.md +5 -7
- package/lib/tape-add-newline-before-assertion/README.md +5 -8
- package/lib/tape-add-newline-between-tests/README.md +5 -8
- package/lib/tape-remove-newline-before-t-end/README.md +4 -7
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
## Installation
|
|
11
11
|
|
|
12
12
|
```
|
|
13
|
-
|
|
13
|
+
npm i putout eslint eslint-plugin-putout -D
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
**Note:** If you installed ESLint globally (using the `-g` flag) then you must also install `putout` and `eslint-plugin-putout` globally.
|
|
@@ -52,43 +52,59 @@ Then configure the rules you want to use under the rules section.
|
|
|
52
52
|
"putout/remove-newline-from-empty-object": "error",
|
|
53
53
|
"putout/remove-empty-newline-before-first-specifier": "error",
|
|
54
54
|
"putout/remove-empty-newline-after-last-specifier": "error",
|
|
55
|
+
"putout/remove-empty-newline-after-last-element": "error",
|
|
55
56
|
"putout/remove-empty-newline-after-import": "error",
|
|
56
57
|
"putout/remove-empty-specifiers": "error",
|
|
57
58
|
"putout/objects-braces-inside-array": "error",
|
|
58
|
-
"putout/object-init": "error"
|
|
59
|
+
"putout/object-init": "error",
|
|
60
|
+
"putout/tape-add-newline-between-tests": "error",
|
|
61
|
+
"putout/tape-add-newline-before-assertion": "error",
|
|
62
|
+
"putout/tape-remove-newline-before-t-end": "error"
|
|
59
63
|
}
|
|
60
64
|
}
|
|
61
65
|
```
|
|
62
66
|
|
|
63
|
-
##
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
- [
|
|
68
|
-
- [
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
- [
|
|
73
|
-
- [
|
|
74
|
-
- [
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
- [
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
- [
|
|
83
|
-
- [
|
|
84
|
-
- [
|
|
85
|
-
- [
|
|
86
|
-
- [
|
|
87
|
-
- [
|
|
88
|
-
- [
|
|
89
|
-
- [
|
|
90
|
-
- [
|
|
91
|
-
- [
|
|
67
|
+
## Rules
|
|
68
|
+
|
|
69
|
+
### 🐊 [Putout](https://github.com/coderaiser/putout#readme)
|
|
70
|
+
|
|
71
|
+
- ✅ [Putout](/packages/eslint-plugin-putout/lib/putout#readme)
|
|
72
|
+
- ✅ [Evaluate](/packages/eslint-plugin-putout/lib/evaluate#readme)
|
|
73
|
+
|
|
74
|
+
### 📼 [Supertape](https://github.com/coderaiser/supertape#readme)
|
|
75
|
+
|
|
76
|
+
- ✅ [add newline before assertion](/packages/eslint-plugin-putout/lib/tape-add-newline-before-assertion#readme)
|
|
77
|
+
- ✅ [add newline between tests](/packages/eslint-plugin-putout/lib/tape-add-newline-between-tests#readme)
|
|
78
|
+
- ✅ [remove newline before t.end()](/packages/eslint-plugin-putout/lib/tape-remove-newline-before-t-end#readme)
|
|
79
|
+
|
|
80
|
+
### TypeScript
|
|
81
|
+
|
|
82
|
+
- ✅ [Add newlines between types in union](/packages/eslint-plugin-putout/lib/add-newlines-between-types-in-union#readme)
|
|
83
|
+
|
|
84
|
+
### Formatting
|
|
85
|
+
|
|
86
|
+
- ✅ [Add newline before function call](/packages/eslint-plugin-putout/lib/add-newline-before-function-call#readme)
|
|
87
|
+
- ✅ [Add newline after function call](/packages/eslint-plugin-putout/lib/add-newline-after-function-call#readme)
|
|
88
|
+
- ✅ [Align spaces](/packages/eslint-plugin-putout/lib/align-spaces#readme)
|
|
89
|
+
- ✅ [Array element newline](/packages/eslint-plugin-putout/lib/array-element-newline#readme)
|
|
90
|
+
- ✅ [Single property destructuring](/packages/eslint-plugin-putout/lib/single-property-destructuring#readme)
|
|
91
|
+
- ✅ [Multiple properties destructuring](/packages/eslint-plugin-putout/lib/multiple-properties-destructuring#readme)
|
|
92
|
+
- ✅ [For-of multiple properties destructuring](/packages/eslint-plugin-putout/lib/for-of-multiple-properties-destructuring#readme)
|
|
93
|
+
- ✅ [Long properties destructuring](/packages/eslint-plugin-putout/lib/long-properties-destructuring#readme)
|
|
94
|
+
- ✅ [Destructuring as function argument](/packages/eslint-plugin-putout/lib/destructuring-as-function-argument#readme)
|
|
95
|
+
- ✅ [Keyword spacing](/packages/eslint-plugin-putout/lib/keyword-spacing#readme)
|
|
96
|
+
- ✅ [Newline function call arguments](/packages/eslint-plugin-putout/lib/newline-function-call-arguments#readme)
|
|
97
|
+
- ✅ [Function declaration paren newline](/packages/eslint-plugin-putout/lib/function-declaration-paren-newline#readme)
|
|
98
|
+
- ✅ [Remove newline after default import](/packages/eslint-plugin-putout/lib/remove-newline-after-default-import#readme)
|
|
99
|
+
- ✅ [Remove newline from empty object](/packages/eslint-plugin-putout/lib/remove-newline-from-empty-object#readme)
|
|
100
|
+
- ✅ [Remove empty newline before first specifier](/packages/eslint-plugin-putout/lib/remove-empty-newline-before-first-specifier#readme)
|
|
101
|
+
- ✅ [Remove empty newline after last specifier](/packages/eslint-plugin-putout/lib/remove-empty-newline-after-last-specifier#readme)
|
|
102
|
+
- ✅ [Remove empty newline after last element](/packages/eslint-plugin-putout/lib/remove-empty-newline-after-last-element#readme)
|
|
103
|
+
- ✅ [Remove empty newline after import](/packages/eslint-plugin-putout/lib/remove-empty-newline-after-import#readme)
|
|
104
|
+
- ✅ [Remove empty specifiers](/packages/eslint-plugin-putout/lib/remove-empty-specifiers#readme)
|
|
105
|
+
- ✅ [Objects braces inside array](/packages/eslint-plugin-putout/lib/objects-braces-inside-array#readme)
|
|
106
|
+
- ✅ [Object init](/packages/eslint-plugin-putout/lib/object-init#readme)
|
|
107
|
+
- ✅ [No unresolved](/packages/eslint-plugin-putout/lib/no-unresolved#readme)
|
|
92
108
|
|
|
93
109
|
### Safe mode
|
|
94
110
|
|
|
@@ -107,28 +123,29 @@ When using 🐊`Putout` in IDE with `--fix` on save, or when you want to disable
|
|
|
107
123
|
|
|
108
124
|
Disabled `ESLint` rules:
|
|
109
125
|
|
|
110
|
-
- [`no-useless-return`](https://eslint.org/docs/rules/no-useless-return)
|
|
111
|
-
- [`putout/remove-newline-from-empty-object`](https://
|
|
126
|
+
- [`no-useless-return`](https://eslint.org/docs/rules/no-useless-return#readme)
|
|
127
|
+
- [`putout/remove-newline-from-empty-object`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout/lib/remove-newline-from-empty-object#readme)
|
|
112
128
|
|
|
113
129
|
Disabled 🐊`Putout` rules:
|
|
114
130
|
|
|
115
|
-
- [`remove-empty`](https://github.com/coderaiser/putout/tree/v24.0.0/packages/plugin-remove-empty);
|
|
116
|
-
- [`nodejs/remove-process-exit`](https://github.com/coderaiser/putout/tree/v24.0.0/packages/plugin-nodejs#remove-process-exit);
|
|
117
|
-
- [`remove-unused-variables`](https://github.com/coderaiser/putout/tree/v24.0.0/packages/remove-unused-variables);
|
|
118
|
-
- [`typescript/remove-unused-types`](https://github.com/coderaiser/putout/tree/v24.0.2/packages/plugin-typescript#remove-unused-types);
|
|
119
|
-
- [`remove-unused-for-of-variables`](https://github.com/coderaiser/putout/tree/v24.0.0/packages/remove-unused-for-of-variables);
|
|
120
|
-
- [`remove-unused-expressions`](https://github.com/coderaiser/putout/tree/v24.0.0/packages);
|
|
121
|
-
- [`remove-unreferenced-variables`](https://github.com/coderaiser/putout/tree/24.1.0/packages);
|
|
122
|
-
- [`remove-useless-
|
|
123
|
-
- [`remove-useless-
|
|
124
|
-
- [`remove-useless-
|
|
125
|
-
- [`remove-useless-
|
|
126
|
-
- [`remove-
|
|
127
|
-
- [`remove-
|
|
128
|
-
- [`remove-
|
|
129
|
-
- [`remove-
|
|
130
|
-
- [`remove-
|
|
131
|
-
- [`
|
|
131
|
+
- 🐲[`remove-empty`](https://github.com/coderaiser/putout/tree/v24.0.0/packages/plugin-remove-empty#readme);
|
|
132
|
+
- 🐲[`nodejs/remove-process-exit`](https://github.com/coderaiser/putout/tree/v24.0.0/packages/plugin-nodejs#remove-process-exit#readme);
|
|
133
|
+
- 🐲[`remove-unused-variables`](https://github.com/coderaiser/putout/tree/v24.0.0/packages/plugin-remove-unused-variables#readme);
|
|
134
|
+
- 🐲[`typescript/remove-unused-types`](https://github.com/coderaiser/putout/tree/v24.0.2/packages/plugin-typescript#remove-unused-types#readme);
|
|
135
|
+
- 🐲[`remove-unused-for-of-variables`](https://github.com/coderaiser/putout/tree/v24.0.0/packages/plugin-remove-unused-for-of-variables#readme);
|
|
136
|
+
- 🐲[`remove-unused-expressions`](https://github.com/coderaiser/putout/tree/v24.0.0/packages/plugin-removeunused-expressions#readme);
|
|
137
|
+
- 🐲[`remove-unreferenced-variables`](https://github.com/coderaiser/putout/tree/24.1.0/packages/plugin-remove-unreferenced-variables#readme);
|
|
138
|
+
- 🐲[`remove-useless-arguments`](https://github.com/coderaiser/putout/tree/master/packages/plugin-remove-useless-arguments#readme);
|
|
139
|
+
- 🐲[`remove-useless-for-of`](https://github.com/coderaiser/putout/tree/master/packages/plugin-remove-useless-for-of#readme);
|
|
140
|
+
- 🐲[`remove-useless-return`](https://github.com/coderaiser/putout/tree/master/packages/plugin-remove-useless-return#readme);
|
|
141
|
+
- 🐲[`remove-useless-spread`](https://github.com/coderaiser/putout/tree/master/packages/plugin-remove-useless-spread/#readme#readme);
|
|
142
|
+
- 🐲[`remove-useless-variables/rename`](https://github.com/coderaiser/putout/tree/master/packages/plugin-remove-useless-arguments#rename#readme);
|
|
143
|
+
- 🐲[`remove-skip`](https://github.com/coderaiser/putout/tree/v24.0.0/packages/plugin-tape#remove-skip);
|
|
144
|
+
- 🐲[`remove-only`](https://github.com/coderaiser/putout/tree/v24.0.0/packages/plugin-tape#remove-only);
|
|
145
|
+
- 🐲[`remove-console`](https://github.com/coderaiser/putout/tree/v24.0.0/packages/plugin-remove-console#readme);
|
|
146
|
+
- 🐲[`remove-debugger`](https://github.com/coderaiser/putout/tree/v24.0.0/packages/plugin-remove-debugger#readme);
|
|
147
|
+
- 🐲[`remove-unreachable-code`](https://github.com/coderaiser/putout/tree/v24.0.0/packages/plugin-remove-unreachable-code#readme);
|
|
148
|
+
- 🐲[`convert-for-to-for-of`](https://github.com/coderaiser/putout/tree/v24.0.0/packages/plugin-convert-for-to-for-of#readme);
|
|
132
149
|
|
|
133
150
|
### safe+align
|
|
134
151
|
|
package/lib/evaluate/README.md
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
# evaluate
|
|
1
|
+
# evaluate
|
|
2
2
|
|
|
3
3
|
Evaluate expression started with `__putout_evaluate: `.
|
|
4
4
|
Provided code is processed with [`@putout/plugin-declare-undefined-variables`](https://github.com/coderaiser/putout/tree/master/packages/plugin-declare-undefined-variables). So next code:
|
|
5
5
|
|
|
6
6
|
```js
|
|
7
|
-
import {join} from 'path';
|
|
8
7
|
__putout_evaluate: join("hello", " ", "world");
|
|
9
8
|
```
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
Is converted to:
|
|
12
11
|
|
|
13
12
|
```js
|
|
14
13
|
const fn = (__filename, __dirname, require) => {
|
|
@@ -17,18 +16,16 @@ const fn = (__filename, __dirname, require) => {
|
|
|
17
16
|
};
|
|
18
17
|
```
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
When you want to evaluate expressions `source` of `ImportDeclaration`:
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
Examples of **incorrect** code located in `hello.spec.js` for this rule:
|
|
21
|
+
## ❌ Example of incorrect code
|
|
25
22
|
|
|
26
23
|
```js
|
|
27
24
|
import {readFile} from '__putout_evaluate: `./` + basename(__filename).replace(`.spec.js`, `.js`)';
|
|
28
25
|
|
|
29
26
|
```
|
|
30
27
|
|
|
31
|
-
|
|
28
|
+
## ✅ Example of correct code
|
|
32
29
|
|
|
33
30
|
```js
|
|
34
31
|
import {readFile} from './hello.js';
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# function-declaration-paren-newline
|
|
2
2
|
|
|
3
|
-
Similar to `
|
|
3
|
+
Remove newlines between parens in function declaration. Similar to `ESLint` rule [function-paren-newline](https://eslint.org/docs/rules/function-declaration-paren-newline), but forbids new lines in function declarations and expressions arguments.
|
|
4
|
+
Part of [`eslint-plugin-putout`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
|
|
4
5
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
This rule aims to add spaces around `catch`
|
|
8
|
-
|
|
9
|
-
Examples of **incorrect** code for this rule:
|
|
6
|
+
## ❌ Example of incorrect code
|
|
10
7
|
|
|
11
8
|
```js
|
|
12
9
|
function f(
|
|
@@ -16,9 +13,17 @@ function f(
|
|
|
16
13
|
const fn = (
|
|
17
14
|
{a, b, c},
|
|
18
15
|
) => {};
|
|
16
|
+
|
|
17
|
+
regexpTree.traverse(ast, {
|
|
18
|
+
RegExp(
|
|
19
|
+
{node},
|
|
20
|
+
) {
|
|
21
|
+
const {body} = node;
|
|
22
|
+
},
|
|
23
|
+
});
|
|
19
24
|
```
|
|
20
25
|
|
|
21
|
-
|
|
26
|
+
## ✅ Example of correct code
|
|
22
27
|
|
|
23
28
|
```js
|
|
24
29
|
function f({a, b, c}) {}
|
|
@@ -31,4 +36,10 @@ const fnWithCall = ({a, b, c}) => {
|
|
|
31
36
|
b,
|
|
32
37
|
);
|
|
33
38
|
};
|
|
39
|
+
|
|
40
|
+
regexpTree.traverse(ast, {
|
|
41
|
+
RegExp({node}) {
|
|
42
|
+
const {body} = node;
|
|
43
|
+
},
|
|
44
|
+
});
|
|
34
45
|
```
|
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const fixNewLines = (text) => {
|
|
4
|
-
return text
|
|
5
|
-
.replace(/\(\n\s+/, '(')
|
|
6
|
-
.replace(/,?\n\s+\)/, ')');
|
|
7
|
-
};
|
|
8
|
-
|
|
9
3
|
module.exports.report = () => {
|
|
10
4
|
return `Unexpected new lines around arguments`;
|
|
11
5
|
};
|
|
12
6
|
|
|
13
|
-
module.exports.fix = ({text}) =>
|
|
7
|
+
module.exports.fix = ({text, node, getText}) => {
|
|
8
|
+
const {body} = node.body;
|
|
9
|
+
node.body.body = [];
|
|
10
|
+
|
|
11
|
+
const paramsText = getText(node);
|
|
12
|
+
|
|
13
|
+
node.body.body = body;
|
|
14
|
+
|
|
15
|
+
const newText = paramsText
|
|
16
|
+
.replace(/\(\n(\s+)?/, '(')
|
|
17
|
+
.replace(/,?\n\s+\)/, ')')
|
|
18
|
+
.replace(/,\n(\s+)?{/, ', {')
|
|
19
|
+
.replace(/},\n(\s+)?\)/, '})')
|
|
20
|
+
.replace(/,\n(\s+)?/, ', ');
|
|
21
|
+
|
|
22
|
+
return text.replace(paramsText, newText);
|
|
23
|
+
};
|
|
14
24
|
|
|
15
25
|
module.exports.include = () => [
|
|
16
26
|
'FunctionDeclaration',
|
package/lib/index.js
CHANGED
|
@@ -33,6 +33,7 @@ module.exports.rules = {
|
|
|
33
33
|
...getWrapRule('remove-newline-from-empty-object'),
|
|
34
34
|
...getWrapRule('remove-empty-newline-before-first-specifier'),
|
|
35
35
|
...getWrapRule('remove-empty-newline-after-last-specifier'),
|
|
36
|
+
...getWrapRule('remove-empty-newline-after-last-element'),
|
|
36
37
|
...getWrapRule('remove-empty-specifiers'),
|
|
37
38
|
...getWrapRule('objects-braces-inside-array'),
|
|
38
39
|
...getWrapRule('object-init'),
|
|
@@ -72,6 +73,7 @@ const recommended = {
|
|
|
72
73
|
'putout/remove-newline-from-empty-object': 'error',
|
|
73
74
|
'putout/remove-empty-newline-before-first-specifier': 'error',
|
|
74
75
|
'putout/remove-empty-newline-after-last-specifier': 'error',
|
|
76
|
+
'putout/remove-empty-newline-after-last-element': 'error',
|
|
75
77
|
'putout/remove-empty-newline-after-import': 'error',
|
|
76
78
|
'putout/remove-empty-specifiers': 'error',
|
|
77
79
|
'putout/objects-braces-inside-array': 'error',
|
|
@@ -113,9 +115,10 @@ const safe = {
|
|
|
113
115
|
'remove-unused-expressions': 'off',
|
|
114
116
|
'remove-unused-for-of-variables': 'off',
|
|
115
117
|
'remove-unreachable-code': 'off',
|
|
116
|
-
'remove-useless-
|
|
118
|
+
'remove-useless-for-of': 'off',
|
|
117
119
|
'remove-useless-arguments': 'off',
|
|
118
120
|
'remove-useless-variables/rename': 'off',
|
|
121
|
+
'remove-useless-return': 'off',
|
|
119
122
|
'remove-useless-spread': 'off',
|
|
120
123
|
'remove-unreferenced-variables': 'off',
|
|
121
124
|
'tape/remove-skip': 'off',
|
package/lib/putout/index.js
CHANGED
|
@@ -96,6 +96,8 @@ const fix = ({ast, text, node, source, resultOptions}) => (fixer) => {
|
|
|
96
96
|
transform(ast, text, resultOptions);
|
|
97
97
|
|
|
98
98
|
const [, last] = lastToken.range;
|
|
99
|
+
|
|
100
|
+
removeParent(ast);
|
|
99
101
|
const code = print(ast);
|
|
100
102
|
|
|
101
103
|
return fixer.replaceTextRange([0, last], code);
|
|
@@ -103,7 +105,6 @@ const fix = ({ast, text, node, source, resultOptions}) => (fixer) => {
|
|
|
103
105
|
|
|
104
106
|
const createParser = (node) => {
|
|
105
107
|
const ast = copyAST(node);
|
|
106
|
-
removeParent(ast);
|
|
107
108
|
|
|
108
109
|
const parser = {
|
|
109
110
|
parse: returns(ast),
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# remove-empty-newline-after-last-element
|
|
2
|
+
|
|
3
|
+
Remove empty newline after last element.
|
|
4
|
+
Part of [`eslint-plugin-putout`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
|
|
5
|
+
|
|
6
|
+
## ❌ Example of incorrect code
|
|
7
|
+
|
|
8
|
+
```js
|
|
9
|
+
push([
|
|
10
|
+
a,
|
|
11
|
+
b,
|
|
12
|
+
|
|
13
|
+
]);
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## ✅ Example of correct code
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
push([
|
|
20
|
+
a,
|
|
21
|
+
b,
|
|
22
|
+
]);
|
|
23
|
+
```
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports.category = 'array';
|
|
4
|
+
module.exports.report = () => 'Remove newline after last element';
|
|
5
|
+
|
|
6
|
+
const regExp = /\n\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
|
+
'ArrayExpression',
|
|
19
|
+
];
|
|
20
|
+
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# remove-empty-newline-after-last-specifier
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Remove empty newline after last specifier.
|
|
4
|
+
Part of [`eslint-plugin-putout`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Examples of **incorrect** code for this rule:
|
|
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,12 +1,10 @@
|
|
|
1
|
-
#
|
|
1
|
+
# remove-newline-after-default-import
|
|
2
2
|
|
|
3
|
+
This rule aims to remove newline after default import, before opening curly brace (`{`).
|
|
3
4
|
Fixes [`object-curly-newline`](https://eslint.org/docs/rules/object-curly-newline) + [`eslint-plugin-modules-newline`](https://github.com/gmsorrow/eslint-plugin-modules-newline).
|
|
5
|
+
Part of [`eslint-plugin-putout`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
|
|
4
6
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
This rule aims to shorten destructuring of properties.
|
|
8
|
-
|
|
9
|
-
Examples of **incorrect** code for this rule:
|
|
7
|
+
## ❌ Example of incorrect code
|
|
10
8
|
|
|
11
9
|
```js
|
|
12
10
|
import x,
|
|
@@ -16,7 +14,7 @@ import x,
|
|
|
16
14
|
} from 'y';
|
|
17
15
|
```
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
## ✅ Example of correct code
|
|
20
18
|
|
|
21
19
|
```js
|
|
22
20
|
import x, {
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# add-newline-before-assertion
|
|
2
2
|
|
|
3
|
-
Add newline before `t.equal()` etc, for [`
|
|
3
|
+
Add newline before `t.equal()` etc, for 📼[`Supertape`](https://github.com/coderaiser/supertape).
|
|
4
|
+
Part of [`eslint-plugin-putout`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
|
|
4
5
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
This rule aims to add newline before assertion.
|
|
8
|
-
|
|
9
|
-
Examples of **incorrect** code for this rule:
|
|
6
|
+
## ❌ Example of incorrect code
|
|
10
7
|
|
|
11
8
|
```js
|
|
12
9
|
test('lint: do some check', (t) => {
|
|
@@ -18,7 +15,7 @@ test('lint: do some check', (t) => {
|
|
|
18
15
|
});
|
|
19
16
|
```
|
|
20
17
|
|
|
21
|
-
|
|
18
|
+
## ✅ Example of correct code
|
|
22
19
|
|
|
23
20
|
```js
|
|
24
21
|
test('lint: do some check', (t) => {
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# add-newline-between-tests
|
|
2
2
|
|
|
3
|
-
Add newline between tests, for [`
|
|
3
|
+
Add newline between tests, for 📼[`Supertape`](https://github.com/coderaiser/supertape).
|
|
4
|
+
Part of [`eslint-plugin-putout`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
|
|
4
5
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
This rule aims to add newline between tests.
|
|
8
|
-
|
|
9
|
-
Examples of **incorrect** code for this rule:
|
|
6
|
+
## ❌ Example of incorrect code
|
|
10
7
|
|
|
11
8
|
```js
|
|
12
9
|
test('lint: do some check', (t) => {
|
|
@@ -23,7 +20,7 @@ test('lint: do some check', (t) => {
|
|
|
23
20
|
});
|
|
24
21
|
```
|
|
25
22
|
|
|
26
|
-
|
|
23
|
+
## ✅ Example of correct code
|
|
27
24
|
|
|
28
25
|
```js
|
|
29
26
|
test('lint: do some check', (t) => {
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# remove-newline-before-t-end
|
|
2
2
|
|
|
3
3
|
Remove newline before `t.end()`, for [`supertape`](https://github.com/coderaiser/supertape).
|
|
4
|
+
Part of [`eslint-plugin-putout`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#rules).
|
|
4
5
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
This rule aims to remove newline before `t.end()`.
|
|
8
|
-
|
|
9
|
-
Examples of **incorrect** code for this rule:
|
|
6
|
+
## ❌ Example of incorrect code
|
|
10
7
|
|
|
11
8
|
```js
|
|
12
9
|
test('lint: do some check', (t) => {
|
|
@@ -18,7 +15,7 @@ test('lint: do some check', (t) => {
|
|
|
18
15
|
});
|
|
19
16
|
```
|
|
20
17
|
|
|
21
|
-
|
|
18
|
+
## ✅ Example of correct code
|
|
22
19
|
|
|
23
20
|
```js
|
|
24
21
|
test('lint: do some check', (t) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-putout",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.12.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"description": "eslint plugin for putout",
|
|
6
6
|
"release": false,
|
|
@@ -49,15 +49,15 @@
|
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@babel/plugin-syntax-typescript": "^7.12.1",
|
|
52
|
-
"@putout/test": "^
|
|
52
|
+
"@putout/test": "^5.0.0",
|
|
53
53
|
"c8": "^7.5.0",
|
|
54
54
|
"eslint": "^8.0.1",
|
|
55
55
|
"eslint-plugin-eslint-plugin": "^3.2.0",
|
|
56
|
-
"madrun": "^
|
|
56
|
+
"madrun": "^9.0.0",
|
|
57
57
|
"mocha": "^9.0.1",
|
|
58
58
|
"montag": "^1.0.0",
|
|
59
59
|
"simport": "^1.2.0",
|
|
60
|
-
"supertape": "^
|
|
60
|
+
"supertape": "^7.0.0",
|
|
61
61
|
"try-to-catch": "^3.0.0"
|
|
62
62
|
},
|
|
63
63
|
"engines": {
|