@putout/eslint 1.8.0 → 1.9.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.
@@ -120,13 +120,33 @@ const createGetSpacesBeforeNode = ({getText}) => (node, text = getText(node)) =>
120
120
  module.exports.createGetSpaceBeforeNode = createGetSpacesBeforeNode;
121
121
 
122
122
  const createGetSpacesAfterNode = ({getText}) => (node, {text = getText(node)}) => {
123
+ const reg = /^[ \n;]+$/;
124
+
125
+ if (isLastNodeInBody(node))
126
+ return '';
127
+
123
128
  let spaces = '';
124
129
  let i = 0;
125
130
 
126
- while (!spaces || /^[ \n;]+$/.test(spaces))
131
+ while (!spaces || reg.test(spaces))
127
132
  spaces = getText(node, 0, ++i)
128
133
  .replace(text, '');
129
134
 
130
135
  return spaces.slice(0, -1);
131
136
  };
137
+
132
138
  module.exports.createGetSpacesAfterNode = createGetSpacesAfterNode;
139
+
140
+ function isLastNodeInBody(node) {
141
+ if (node.parent.body) {
142
+ const {length} = node.parent.body;
143
+ const n = length - 1;
144
+
145
+ if (node === node.parent?.body?.[n]) {
146
+ return true;
147
+ }
148
+ }
149
+
150
+ return false;
151
+ }
152
+
package/package.json CHANGED
@@ -1,12 +1,11 @@
1
1
  {
2
2
  "name": "@putout/eslint",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "type": "commonjs",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Wrapper that simplifies ESLint API and makes it compatible with 🐊Putout",
7
7
  "homepage": "https://github.com/coderaiser/putout/tree/master/packages/eslint#readme",
8
8
  "main": "./lib/eslint.js",
9
- "commitType": "colon",
10
9
  "release": false,
11
10
  "tag": false,
12
11
  "changelog": false,
@@ -41,7 +40,7 @@
41
40
  "c8": "^7.5.0",
42
41
  "eslint": "^8.0.1",
43
42
  "eslint-plugin-n": "^15.2.4",
44
- "eslint-plugin-putout": "^16.0.0",
43
+ "eslint-plugin-putout": "^17.0.0",
45
44
  "just-camel-case": "^4.0.2",
46
45
  "lerna": "^6.0.1",
47
46
  "madrun": "^9.0.0",