eslint-plugin-putout 11.10.0 → 11.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 +1 -1
- package/lib/array-element-newline/index.js +12 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[CoverageURL]: https://coveralls.io/github/coderaiser/putout?branch=master
|
|
6
6
|
[CoverageIMGURL]: https://coveralls.io/repos/coderaiser/putout/badge.svg?branch=master&service=github
|
|
7
7
|
|
|
8
|
-
[`ESLint`](https://eslint.org) plugin for [
|
|
8
|
+
[`ESLint`](https://eslint.org) plugin for 🐊[`Putout`](https://github.com/coderaiser/putout) with built-in rules from [@putout/eslint-config](https://github.com/coderaiser/eslint-plugin-putout/tree/master/packages/eslint-config).
|
|
9
9
|
|
|
10
10
|
## Installation
|
|
11
11
|
|
|
@@ -11,16 +11,24 @@ module.exports.report = () => 'Add newlines between array elements';
|
|
|
11
11
|
|
|
12
12
|
const regexp = /['\da-zA-Z]+, ['\da-zA-Z]/;
|
|
13
13
|
|
|
14
|
-
const
|
|
14
|
+
const isSupportedNode = (a) => {
|
|
15
|
+
if (a.type === 'Literal')
|
|
16
|
+
return true;
|
|
17
|
+
|
|
18
|
+
if (a.type === 'Identifier')
|
|
19
|
+
return true;
|
|
20
|
+
|
|
21
|
+
return false;
|
|
22
|
+
};
|
|
15
23
|
|
|
16
24
|
module.exports.filter = ({text, node}) => {
|
|
17
25
|
if (isMemberExpression(node.parent))
|
|
18
26
|
return false;
|
|
19
27
|
|
|
20
|
-
const
|
|
21
|
-
.every(
|
|
28
|
+
const supported = node.elements
|
|
29
|
+
.every(isSupportedNode);
|
|
22
30
|
|
|
23
|
-
if (!
|
|
31
|
+
if (!supported)
|
|
24
32
|
return false;
|
|
25
33
|
|
|
26
34
|
if (!isVariableDeclarator(node.parent))
|