@putout/eslint 2.2.0 → 2.3.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 +2 -6
- package/lib/create-plugin/index.js +2 -16
- package/lib/eslint.js +1 -4
- package/lib/get-eslint.mjs +5 -10
- package/lib/lint/index.js +1 -4
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -55,9 +55,7 @@ const [source, places] = await eslint({
|
|
|
55
55
|
code: `const t = 'hi'\n`,
|
|
56
56
|
fix: false,
|
|
57
57
|
config: {
|
|
58
|
-
extends: [
|
|
59
|
-
'plugin:putout/recommended',
|
|
60
|
-
],
|
|
58
|
+
extends: ['plugin:putout/recommended'],
|
|
61
59
|
},
|
|
62
60
|
});
|
|
63
61
|
```
|
|
@@ -71,9 +69,7 @@ const [source, places] = await eslint({
|
|
|
71
69
|
fix: true,
|
|
72
70
|
putout: true,
|
|
73
71
|
config: {
|
|
74
|
-
extends: [
|
|
75
|
-
'plugin:putout/recommended',
|
|
76
|
-
],
|
|
72
|
+
extends: ['plugin:putout/recommended'],
|
|
77
73
|
},
|
|
78
74
|
});
|
|
79
75
|
```
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const prepare = (plugin, context, options) => (node) => {
|
|
4
|
-
const {
|
|
5
|
-
filter,
|
|
6
|
-
report,
|
|
7
|
-
} = plugin;
|
|
4
|
+
const {filter, report} = plugin;
|
|
8
5
|
|
|
9
6
|
const source = context.sourceCode;
|
|
10
7
|
const {filename} = context;
|
|
@@ -23,18 +20,7 @@ const prepare = (plugin, context, options) => (node) => {
|
|
|
23
20
|
|
|
24
21
|
const text = getText(node);
|
|
25
22
|
|
|
26
|
-
const result = filter({
|
|
27
|
-
text,
|
|
28
|
-
node,
|
|
29
|
-
options,
|
|
30
|
-
getText,
|
|
31
|
-
getCommentsBefore,
|
|
32
|
-
getCommentsAfter,
|
|
33
|
-
getCommentsInside,
|
|
34
|
-
getSpacesBeforeNode,
|
|
35
|
-
getSpacesAfterNode,
|
|
36
|
-
filename,
|
|
37
|
-
}, options);
|
|
23
|
+
const result = filter({text, node, options, getText, getCommentsBefore, getCommentsAfter, getCommentsInside, getSpacesBeforeNode, getSpacesAfterNode, filename}, options);
|
|
38
24
|
|
|
39
25
|
if (!result)
|
|
40
26
|
return;
|
package/lib/eslint.js
CHANGED
package/lib/get-eslint.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import FlatESLintExports from 'eslint/use-at-your-own-risk';
|
|
1
|
+
import eslint from 'eslint/use-at-your-own-risk';
|
|
3
2
|
import {findUpSync} from 'find-up';
|
|
4
3
|
|
|
5
|
-
const {FlatESLint} =
|
|
4
|
+
const {FlatESLint, LegacyESLint} = eslint;
|
|
6
5
|
|
|
7
6
|
export const getESLint = ({name, fix, config, overrideConfigFile, ESLintOverride, find = findUpSync}) => {
|
|
8
7
|
const eslint = chooseESLint({
|
|
@@ -41,13 +40,11 @@ function chooseESLint({name, config, fix, overrideConfigFile, ESLintOverride, fi
|
|
|
41
40
|
});
|
|
42
41
|
}
|
|
43
42
|
|
|
44
|
-
function getOldESLint({fix, config, overrideConfigFile, ESLintOverride =
|
|
43
|
+
function getOldESLint({fix, config, overrideConfigFile, ESLintOverride = LegacyESLint}) {
|
|
45
44
|
const eslint = new ESLintOverride({
|
|
46
45
|
fix,
|
|
47
46
|
overrideConfig: {
|
|
48
|
-
ignorePatterns: [
|
|
49
|
-
'!.*',
|
|
50
|
-
],
|
|
47
|
+
ignorePatterns: ['!.*'],
|
|
51
48
|
...config,
|
|
52
49
|
},
|
|
53
50
|
...overrideConfigFile && {
|
|
@@ -63,9 +60,7 @@ function getFlatESLint({fix, config, overrideConfigFile, ESLintOverride = FlatES
|
|
|
63
60
|
const eslint = new ESLintOverride({
|
|
64
61
|
fix,
|
|
65
62
|
overrideConfig: {
|
|
66
|
-
ignores: [
|
|
67
|
-
'!.*',
|
|
68
|
-
],
|
|
63
|
+
ignores: ['!.*'],
|
|
69
64
|
...config,
|
|
70
65
|
},
|
|
71
66
|
...overrideConfigFile && {
|
package/lib/lint/index.js
CHANGED
|
@@ -42,10 +42,7 @@ module.exports.lint = (source, {fix = true, plugins, filename, options = []}) =>
|
|
|
42
42
|
return [source, places];
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
const {
|
|
46
|
-
output,
|
|
47
|
-
messages,
|
|
48
|
-
} = linter.verifyAndFix(source, allOptions, mainOptions);
|
|
45
|
+
const {output, messages} = linter.verifyAndFix(source, allOptions, mainOptions);
|
|
49
46
|
|
|
50
47
|
return [output, messages.map(convertToPlace)];
|
|
51
48
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/eslint",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.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",
|
|
@@ -38,16 +38,16 @@
|
|
|
38
38
|
],
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@putout/plugin-eslint-plugin": "*",
|
|
41
|
-
"c8": "^
|
|
42
|
-
"eslint": "^8.0
|
|
41
|
+
"c8": "^8.0.0",
|
|
42
|
+
"eslint": "^8.45.0",
|
|
43
43
|
"eslint-plugin-n": "^16.0.0",
|
|
44
|
-
"eslint-plugin-putout": "^
|
|
44
|
+
"eslint-plugin-putout": "^19.0.0",
|
|
45
45
|
"just-camel-case": "^4.0.2",
|
|
46
46
|
"lerna": "^6.0.1",
|
|
47
47
|
"madrun": "^9.0.0",
|
|
48
48
|
"mock-require": "^3.0.3",
|
|
49
49
|
"montag": "^1.0.0",
|
|
50
|
-
"nodemon": "^
|
|
50
|
+
"nodemon": "^3.0.1",
|
|
51
51
|
"putout": "*",
|
|
52
52
|
"supertape": "^8.0.0",
|
|
53
53
|
"try-catch": "^3.0.0"
|