eslint-plugin-putout 13.10.0 → 13.11.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
@@ -10,7 +10,7 @@
10
10
  ## Installation
11
11
 
12
12
  ```
13
- $ npm i putout eslint eslint-plugin-putout -D
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,6 +52,7 @@ 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",
@@ -81,6 +82,7 @@ Then configure the rules you want to use under the rules section.
81
82
  - [Remove newline from empty object](/packages/eslint-plugin-putout/lib/remove-newline-from-empty-object#readme)
82
83
  - [Remove empty newline before first specifier](/packages/eslint-plugin-putout/lib/remove-empty-newline-before-first-specifier#readme)
83
84
  - [Remove empty newline after last specifier](/packages/eslint-plugin-putout/lib/remove-empty-newline-after-last-specifier#readme)
85
+ - [Remove empty newline after last element](/packages/eslint-plugin-putout/lib/remove-empty-newline-after-last-element#readme)
84
86
  - [Remove empty newline after import](/packages/eslint-plugin-putout/lib/remove-empty-newline-after-import#readme)
85
87
  - [Remove empty specifiers](/packages/eslint-plugin-putout/lib/remove-empty-specifiers#readme)
86
88
  - [Objects braces inside array](/packages/eslint-plugin-putout/lib/objects-braces-inside-array#readme)
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',
@@ -0,0 +1,25 @@
1
+ # remove-empty-newline-after-last-element
2
+
3
+ ## Rule Details
4
+
5
+ This rule aims to remove empty newline after last element.
6
+
7
+ ## ❌ Incorrect code example
8
+
9
+ ```js
10
+ push([
11
+ a,
12
+ b,
13
+
14
+ ]);
15
+ ```
16
+
17
+ ## ✅ Correct code example
18
+
19
+ ```js
20
+ push([
21
+ a,
22
+ b,
23
+
24
+ ]);
25
+ ```
@@ -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,10 @@
1
- # Remove empty new line after last specifier(`remove-empty-newline-after-last-specifier`)
1
+ # remove-empty-newline-after-last-specifier
2
2
 
3
3
  ## Rule Details
4
4
 
5
5
  This rule aims to remove empty newline after last specifier.
6
6
 
7
- Examples of **incorrect** code for this rule:
7
+ ## Incorrect code example
8
8
 
9
9
  ```js
10
10
  import {
@@ -20,7 +20,7 @@ push({
20
20
  });
21
21
  ```
22
22
 
23
- Examples of **correct** code for this rule:
23
+ ## Correct code example
24
24
 
25
25
  ```js
26
26
  import {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-putout",
3
- "version": "13.10.0",
3
+ "version": "13.11.0",
4
4
  "type": "commonjs",
5
5
  "description": "eslint plugin for putout",
6
6
  "release": false,