@putout/eslint 2.3.0 → 3.0.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/lib/create-plugin/index.js +21 -9
- package/lib/eslint.js +2 -2
- package/package.json +6 -6
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
const prepare = (plugin, context, options) => (node) => {
|
|
4
4
|
const {filter, report} = plugin;
|
|
5
5
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const getText =
|
|
9
|
-
const getCommentsBefore =
|
|
10
|
-
const getCommentsAfter =
|
|
11
|
-
const getCommentsInside =
|
|
6
|
+
const {sourceCode, filename} = context;
|
|
7
|
+
|
|
8
|
+
const getText = sourceCode.getText.bind(sourceCode);
|
|
9
|
+
const getCommentsBefore = sourceCode.getCommentsBefore.bind(sourceCode);
|
|
10
|
+
const getCommentsAfter = sourceCode.getCommentsAfter.bind(sourceCode);
|
|
11
|
+
const getCommentsInside = sourceCode.getCommentsInside.bind(sourceCode);
|
|
12
12
|
|
|
13
13
|
const getSpacesBeforeNode = createGetSpacesBeforeNode({
|
|
14
14
|
getText,
|
|
@@ -20,7 +20,20 @@ const prepare = (plugin, context, options) => (node) => {
|
|
|
20
20
|
|
|
21
21
|
const text = getText(node);
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const path = {
|
|
24
|
+
text,
|
|
25
|
+
node,
|
|
26
|
+
options,
|
|
27
|
+
getText,
|
|
28
|
+
getCommentsBefore,
|
|
29
|
+
getCommentsAfter,
|
|
30
|
+
getCommentsInside,
|
|
31
|
+
getSpacesBeforeNode,
|
|
32
|
+
getSpacesAfterNode,
|
|
33
|
+
filename,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const result = filter(path, options);
|
|
24
37
|
|
|
25
38
|
if (!result)
|
|
26
39
|
return;
|
|
@@ -133,9 +146,8 @@ function isLastNodeInBody(node) {
|
|
|
133
146
|
const {length} = node.parent.body;
|
|
134
147
|
const n = length - 1;
|
|
135
148
|
|
|
136
|
-
if (node === node.parent?.body?.[n])
|
|
149
|
+
if (node === node.parent?.body?.[n])
|
|
137
150
|
return true;
|
|
138
|
-
}
|
|
139
151
|
}
|
|
140
152
|
|
|
141
153
|
return false;
|
package/lib/eslint.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const process = require('process');
|
|
3
4
|
const {simpleImport} = require('./simple-import.js');
|
|
4
5
|
const tryToCatch = require('try-to-catch');
|
|
5
6
|
|
|
@@ -70,8 +71,7 @@ module.exports = async ({name, code, fix, config, putout = false}) => {
|
|
|
70
71
|
}
|
|
71
72
|
|
|
72
73
|
!putout && disablePutout(finalConfig);
|
|
73
|
-
// that's right, we disabled "putout" rules in "config"
|
|
74
|
-
// and now it located in eslint's cache
|
|
74
|
+
// that's right, we disabled "putout" rules in "config" // and now it located in eslint's cache
|
|
75
75
|
|
|
76
76
|
const results = await eslint.lintText(code, {
|
|
77
77
|
filePath: name,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/eslint",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.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",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"report": "madrun report"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"find-up": "^
|
|
32
|
+
"find-up": "^7.0.0",
|
|
33
33
|
"try-to-catch": "^3.0.1"
|
|
34
34
|
},
|
|
35
35
|
"keywords": [
|
|
@@ -41,20 +41,20 @@
|
|
|
41
41
|
"c8": "^8.0.0",
|
|
42
42
|
"eslint": "^8.45.0",
|
|
43
43
|
"eslint-plugin-n": "^16.0.0",
|
|
44
|
-
"eslint-plugin-putout": "^
|
|
44
|
+
"eslint-plugin-putout": "^22.0.0",
|
|
45
45
|
"just-camel-case": "^4.0.2",
|
|
46
46
|
"lerna": "^6.0.1",
|
|
47
|
-
"madrun": "^
|
|
47
|
+
"madrun": "^10.0.0",
|
|
48
48
|
"mock-require": "^3.0.3",
|
|
49
49
|
"montag": "^1.0.0",
|
|
50
50
|
"nodemon": "^3.0.1",
|
|
51
51
|
"putout": "*",
|
|
52
|
-
"supertape": "^
|
|
52
|
+
"supertape": "^9.0.0",
|
|
53
53
|
"try-catch": "^3.0.0"
|
|
54
54
|
},
|
|
55
55
|
"license": "MIT",
|
|
56
56
|
"engines": {
|
|
57
|
-
"node": ">=
|
|
57
|
+
"node": ">=18"
|
|
58
58
|
},
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|