eslint-plugin-putout 10.8.0 → 11.1.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 +2 -0
- package/lib/index.js +5 -2
- package/lib/tape-add-newline-between-tests/README.md +42 -0
- package/lib/tape-add-newline-between-tests/index.js +27 -0
- package/lib/ts.js +1 -0
- package/lib/wrap.js +2 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -73,6 +73,7 @@ Then configure the rules you want to use under the rules section.
|
|
|
73
73
|
- [No unresolved](/packages/eslint-plugin-putout/lib/no-unresolved)
|
|
74
74
|
- [Evaluate](/packages/eslint-plugin-putout/lib/evaluate)
|
|
75
75
|
- [Tape: add new line before assertion]('/packages/eslint-plugin-putout/lib/tape-add-new-line-before-assertion)
|
|
76
|
+
- [Tape: add new line between tests]('/packages/eslint-plugin-putout/lib/tape-add-new-line-between-tests)
|
|
76
77
|
|
|
77
78
|
### Safe mode
|
|
78
79
|
|
|
@@ -93,6 +94,7 @@ List of disabled `putout` rules:
|
|
|
93
94
|
|
|
94
95
|
- [remove-empty](https://github.com/coderaiser/putout/tree/v20.0.0/packages/plugin-remove-empty);
|
|
95
96
|
- [remove-unused-variables](https://github.com/coderaiser/putout/tree/v20.0.0/packages/remove-unused-variables);
|
|
97
|
+
- [remove-unused-types](https://github.com/coderaiser/putout/tree/v20.0.0/packages/remove-unused-types);
|
|
96
98
|
- [remove-unused-for-of-variables](https://github.com/coderaiser/putout/tree/v20.0.0/packages/remove-unused-for-of-variables);
|
|
97
99
|
- [remove-unused-expressions](https://github.com/coderaiser/putout/tree/v20.0.0/packages);
|
|
98
100
|
- [remove-skip](https://github.com/coderaiser/putout/tree/v20.0.0/packages/remove-skip);
|
package/lib/index.js
CHANGED
|
@@ -31,6 +31,7 @@ module.exports.rules = {
|
|
|
31
31
|
...getWrapRule('no-unresolved'),
|
|
32
32
|
...getWrapRule('evaluate'),
|
|
33
33
|
...getWrapRule('tape-add-newline-before-assertion'),
|
|
34
|
+
...getWrapRule('tape-add-newline-between-tests'),
|
|
34
35
|
...getRule('putout'),
|
|
35
36
|
};
|
|
36
37
|
|
|
@@ -59,6 +60,7 @@ const recommended = {
|
|
|
59
60
|
'putout/no-unresolved': 'error',
|
|
60
61
|
'putout/evaluate': 'error',
|
|
61
62
|
'putout/tape-add-newline-before-assertion': 'error',
|
|
63
|
+
'putout/tape-add-newline-between-tests': 'error',
|
|
62
64
|
'putout/putout': 'error',
|
|
63
65
|
|
|
64
66
|
'node/no-unsupported-features/es-syntax': 'off',
|
|
@@ -83,11 +85,12 @@ const safe = {
|
|
|
83
85
|
'putout/putout': ['error', {
|
|
84
86
|
rules: {
|
|
85
87
|
'remove-empty': 'off',
|
|
88
|
+
'remove-unused-types': 'off',
|
|
86
89
|
'remove-unused-variables': 'off',
|
|
87
90
|
'remove-unused-expressions': 'off',
|
|
88
91
|
'remove-unused-for-of-variables': 'off',
|
|
89
|
-
'remove-skip': 'off',
|
|
90
|
-
'remove-only': 'off',
|
|
92
|
+
'tape/remove-skip': 'off',
|
|
93
|
+
'tape/remove-only': 'off',
|
|
91
94
|
'remove-console': 'off',
|
|
92
95
|
'remove-debugger': 'off',
|
|
93
96
|
'convert-for-to-for-of': 'off',
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Add new line between tests (add-newline-between-tests)
|
|
2
|
+
|
|
3
|
+
Add new line between tests, for [supertape](https://github.com/coderaiser/supertape).
|
|
4
|
+
|
|
5
|
+
## Rule Details
|
|
6
|
+
|
|
7
|
+
This rule aims to add new line between tests.
|
|
8
|
+
|
|
9
|
+
Examples of **incorrect** code for this rule:
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
test('lint: do some check', (t) => {
|
|
13
|
+
const result = 1 + 2;
|
|
14
|
+
|
|
15
|
+
t.equal(result, 3);
|
|
16
|
+
t.end();
|
|
17
|
+
});
|
|
18
|
+
test('lint: do some check', (t) => {
|
|
19
|
+
const result = 1 + 2;
|
|
20
|
+
|
|
21
|
+
t.equal(result, 3);
|
|
22
|
+
t.end();
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Examples of **correct** code for this rule:
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
test('lint: do some check', (t) => {
|
|
30
|
+
const result = 1 + 2;
|
|
31
|
+
|
|
32
|
+
t.equal(result, 3);
|
|
33
|
+
t.end();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test('lint: do some check', (t) => {
|
|
37
|
+
const result = 1 + 2;
|
|
38
|
+
|
|
39
|
+
t.equal(result, 3);
|
|
40
|
+
t.end();
|
|
41
|
+
});
|
|
42
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports.category = 'tape';
|
|
4
|
+
module.exports.report = () => 'Add new line between tests';
|
|
5
|
+
|
|
6
|
+
module.exports.filter = ({text, node, getText, getCommentsBefore}) => {
|
|
7
|
+
if (!/^test(\.only|\.skip)?\(/.test(text))
|
|
8
|
+
return false;
|
|
9
|
+
|
|
10
|
+
const comments = getCommentsBefore(node);
|
|
11
|
+
|
|
12
|
+
if (comments.length)
|
|
13
|
+
return false;
|
|
14
|
+
|
|
15
|
+
const [a] = getText(node, 2);
|
|
16
|
+
|
|
17
|
+
return a === ';';
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
module.exports.fix = ({text}) => {
|
|
21
|
+
return `\n${text}`;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
module.exports.include = () => [
|
|
25
|
+
'CallExpression ',
|
|
26
|
+
];
|
|
27
|
+
|
package/lib/ts.js
CHANGED
package/lib/wrap.js
CHANGED
|
@@ -6,6 +6,7 @@ const prepare = (plugin, context, options) => (node) => {
|
|
|
6
6
|
const source = context.getSourceCode();
|
|
7
7
|
const filename = context.getFilename();
|
|
8
8
|
const getText = source.getText.bind(source);
|
|
9
|
+
const getCommentsBefore = source.getCommentsBefore.bind(source);
|
|
9
10
|
|
|
10
11
|
const text = getText(node);
|
|
11
12
|
|
|
@@ -14,6 +15,7 @@ const prepare = (plugin, context, options) => (node) => {
|
|
|
14
15
|
node,
|
|
15
16
|
options,
|
|
16
17
|
getText,
|
|
18
|
+
getCommentsBefore,
|
|
17
19
|
filename,
|
|
18
20
|
});
|
|
19
21
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-putout",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.1.0",
|
|
4
4
|
"description": "eslint plugin for putout",
|
|
5
5
|
"release": false,
|
|
6
6
|
"tag": false,
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"watch:test": "madrun watch:test",
|
|
25
25
|
"lint": "madrun lint",
|
|
26
26
|
"lint:all": "madrun lint:all",
|
|
27
|
-
"lint:
|
|
27
|
+
"lint:safe": "madrun lint:safe",
|
|
28
28
|
"fresh:lint": "madrun fresh:lint",
|
|
29
29
|
"lint:fresh": "madrun lint:fresh",
|
|
30
30
|
"fix:lint": "madrun fix:lint",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"node": ">=14"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"eslint": ">=8.0.0
|
|
62
|
-
"putout": ">=
|
|
61
|
+
"eslint": ">=8.0.0",
|
|
62
|
+
"putout": ">=21"
|
|
63
63
|
},
|
|
64
64
|
"license": "MIT",
|
|
65
65
|
"publishConfig": {
|