@putout/eslint 3.4.0 → 3.6.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/eslint.js +14 -2
- package/lib/get-eslint.mjs +1 -1
- package/lib/ignore.js +17 -0
- package/package.json +6 -4
package/lib/eslint.js
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const process = require('node:process');
|
|
4
|
-
const {simpleImport} = require('./simple-import.js');
|
|
5
4
|
const tryToCatch = require('try-to-catch');
|
|
6
5
|
|
|
6
|
+
const {simpleImport} = require('./simple-import.js');
|
|
7
|
+
const {isIgnored} = require('./ignore');
|
|
8
|
+
|
|
7
9
|
const {keys} = Object;
|
|
8
10
|
const eslintId = ' (eslint)';
|
|
11
|
+
|
|
9
12
|
const overrideConfigFile = process.env.ESLINT_CONFIG_FILE;
|
|
10
13
|
const noESLint = process.env.NO_ESLINT;
|
|
11
14
|
const noESLintWarnings = process.env.NO_ESLINT_WARNINGS;
|
|
12
|
-
const NO_FLAT_CONFIG_FOUND = 'Could not find config file.';
|
|
13
15
|
|
|
16
|
+
const NO_FLAT_CONFIG_FOUND = 'Could not find config file.';
|
|
14
17
|
const WARNING = 1;
|
|
15
18
|
|
|
16
19
|
const noConfigFound = (config, configError) => {
|
|
@@ -23,6 +26,12 @@ const noConfigFound = (config, configError) => {
|
|
|
23
26
|
if (configError)
|
|
24
27
|
return false;
|
|
25
28
|
|
|
29
|
+
if (!config)
|
|
30
|
+
return true;
|
|
31
|
+
|
|
32
|
+
if (!config.rules)
|
|
33
|
+
return true;
|
|
34
|
+
|
|
26
35
|
return !keys(config.rules).length;
|
|
27
36
|
};
|
|
28
37
|
|
|
@@ -110,6 +119,9 @@ function convertToPlace({ruleId = 'parser', message, line = 0, column = 0, sever
|
|
|
110
119
|
if (severity === WARNING && noESLintWarnings)
|
|
111
120
|
return null;
|
|
112
121
|
|
|
122
|
+
if (isIgnored(message))
|
|
123
|
+
return null;
|
|
124
|
+
|
|
113
125
|
return {
|
|
114
126
|
rule,
|
|
115
127
|
message: replaceControlChars(message),
|
package/lib/get-eslint.mjs
CHANGED
package/lib/ignore.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const MESSAGES = [
|
|
4
|
+
`Parsing error: Cannot use keyword 'await' outside an async function`,
|
|
5
|
+
`Parsing error: The keyword 'yield' is reserved`,
|
|
6
|
+
`Parsing error: Unexpected reserved word 'await'`,
|
|
7
|
+
`Parsing error: Unexpected reserved word 'yield'`,
|
|
8
|
+
];
|
|
9
|
+
|
|
10
|
+
module.exports.isIgnored = (message) => {
|
|
11
|
+
for (const current of MESSAGES) {
|
|
12
|
+
if (message.includes(current))
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return false;
|
|
17
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/eslint",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.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,11 +38,10 @@
|
|
|
38
38
|
],
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@putout/plugin-eslint-plugin": "*",
|
|
41
|
-
"c8": "^
|
|
41
|
+
"c8": "^10.0.0",
|
|
42
42
|
"eslint": "^9.0.0",
|
|
43
43
|
"eslint-plugin-n": "^17.0.0",
|
|
44
|
-
"eslint-plugin-putout": "^
|
|
45
|
-
"just-camel-case": "^4.0.2",
|
|
44
|
+
"eslint-plugin-putout": "^23.0.0",
|
|
46
45
|
"lerna": "^6.0.1",
|
|
47
46
|
"madrun": "^10.0.0",
|
|
48
47
|
"mock-require": "^3.0.3",
|
|
@@ -52,6 +51,9 @@
|
|
|
52
51
|
"supertape": "^10.0.0",
|
|
53
52
|
"try-catch": "^3.0.0"
|
|
54
53
|
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"eslint": ">=8"
|
|
56
|
+
},
|
|
55
57
|
"license": "MIT",
|
|
56
58
|
"engines": {
|
|
57
59
|
"node": ">=18"
|