eslint-plugin-putout 11.7.0 → 11.8.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
@@ -47,6 +47,7 @@ Then configure the rules you want to use under the rules section.
47
47
  "putout/add-newlines-between-types-in-union": "error",
48
48
  "putout/remove-newline-after-default-import": "error",
49
49
  "putout/remove-newline-from-empty-object": "error",
50
+ "putout/remove-empty-newline-before-first-specifier": "error",
50
51
  "putout/remove-empty-newline-after-last-specifier": "error",
51
52
  "putout/objects-braces-inside-array": "error",
52
53
  "putout/object-init": "error"
@@ -69,6 +70,7 @@ Then configure the rules you want to use under the rules section.
69
70
  - [Add newlines between types in union](/packages/eslint-plugin-putout/lib/add-newlines-between-types-in-union)
70
71
  - [Remove newline after default import](/packages/eslint-plugin-putout/lib/remove-newline-after-default-import)
71
72
  - [Remove newline from empty object](/packages/eslint-plugin-putout/lib/remove-newline-from-empty-object)
73
+ - [Remove empty newline before first specifier](/packages/eslint-plugin-putout/lib/remove-empty-newline-before-first-specifier)
72
74
  - [Remove empty newline after last specifier](/packages/eslint-plugin-putout/lib/remove-empty-newline-after-last-specifier)
73
75
  - [Objects braces inside array](/packages/eslint-plugin-putout/lib/objects-braces-inside-array)
74
76
  - [Object init](/packages/eslint-plugin-putout/lib/object-init)
package/lib/index.js CHANGED
@@ -28,6 +28,7 @@ module.exports.rules = {
28
28
  ...getWrapRule('add-newlines-between-types-in-union'),
29
29
  ...getWrapRule('remove-newline-after-default-import'),
30
30
  ...getWrapRule('remove-newline-from-empty-object'),
31
+ ...getWrapRule('remove-empty-newline-before-first-specifier'),
31
32
  ...getWrapRule('remove-empty-newline-after-last-specifier'),
32
33
  ...getWrapRule('objects-braces-inside-array'),
33
34
  ...getWrapRule('object-init'),
@@ -60,6 +61,7 @@ const recommended = {
60
61
  'putout/add-newlines-between-types-in-union': 'error',
61
62
  'putout/remove-newline-after-default-import': 'error',
62
63
  'putout/remove-newline-from-empty-object': 'error',
64
+ 'putout/remove-empty-newline-before-first-specifier': 'error',
63
65
  'putout/remove-empty-newline-after-last-specifier': 'error',
64
66
  'putout/objects-braces-inside-array': 'error',
65
67
  'putout/object-init': 'error',
@@ -0,0 +1,35 @@
1
+ # Remove empty new line before first specifier(remove-empty-newline-before-first-specifier)
2
+
3
+ ## Rule Details
4
+
5
+ This rule aims to remove empty newline before first specifier.
6
+
7
+ Examples of **incorrect** code for this rule:
8
+
9
+ ```js
10
+ import {
11
+
12
+ a,
13
+ b,
14
+ } from 'y';
15
+
16
+ push({
17
+
18
+ a,
19
+ b,
20
+ });
21
+ ```
22
+
23
+ Examples of **correct** code for this rule:
24
+
25
+ ```js
26
+ import {
27
+ a,
28
+ b,
29
+ } from 'y';
30
+
31
+ push({
32
+ a,
33
+ b,
34
+ });
35
+ ```
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ module.exports.category = 'import';
4
+ module.exports.report = () => 'Remove newline before first specifier';
5
+
6
+ const regExp = /{\n(\s+)?\n/;
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
+ 'ObjectExpression',
20
+ ];
21
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-putout",
3
- "version": "11.7.0",
3
+ "version": "11.8.0",
4
4
  "description": "eslint plugin for putout",
5
5
  "release": false,
6
6
  "tag": false,