@putout/eslint 3.8.0 → 4.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/eslint.js +3 -2
- package/lib/get-eslint.mjs +9 -5
- package/package.json +4 -3
package/lib/eslint.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const {join} = require('node:path');
|
|
4
4
|
const process = require('node:process');
|
|
5
5
|
const tryToCatch = require('try-to-catch');
|
|
6
|
+
const once = require('once');
|
|
6
7
|
|
|
7
8
|
const {simpleImport} = require('./simple-import.js');
|
|
8
9
|
const {isIgnored} = require('./ignore');
|
|
@@ -10,7 +11,7 @@ const {isIgnored} = require('./ignore');
|
|
|
10
11
|
const {keys} = Object;
|
|
11
12
|
const eslintId = ' (eslint)';
|
|
12
13
|
|
|
13
|
-
const
|
|
14
|
+
const isNoESLint = once(() => process.env.NO_ESLINT);
|
|
14
15
|
const noESLintWarnings = process.env.NO_ESLINT_WARNINGS;
|
|
15
16
|
const {ESLINT_CONFIG_FILE} = process.env;
|
|
16
17
|
|
|
@@ -49,7 +50,7 @@ module.exports = async ({name, code, fix, config, putout = false}) => {
|
|
|
49
50
|
[],
|
|
50
51
|
];
|
|
51
52
|
|
|
52
|
-
if (
|
|
53
|
+
if (isNoESLint())
|
|
53
54
|
return noChanges;
|
|
54
55
|
|
|
55
56
|
const [, ESLint] = await tryToCatch(simpleImport, './get-eslint.mjs');
|
package/lib/get-eslint.mjs
CHANGED
|
@@ -3,6 +3,8 @@ import process from 'node:process';
|
|
|
3
3
|
import {loadESLint} from 'eslint';
|
|
4
4
|
import {findUp} from 'find-up';
|
|
5
5
|
|
|
6
|
+
const {isArray} = Array;
|
|
7
|
+
const maybeArray = (a) => isArray(a) ? a : [a];
|
|
6
8
|
const CWD = process.cwd();
|
|
7
9
|
|
|
8
10
|
export const getESLint = async ({name, fix, config, overrideConfigFile, loadESLintOverride, find = findUp, findFlat = find, findRC = find}) => {
|
|
@@ -61,7 +63,7 @@ async function getOldESLint({cwd, fix, config, overrideConfigFile, loadESLintOve
|
|
|
61
63
|
return eslint;
|
|
62
64
|
}
|
|
63
65
|
|
|
64
|
-
async function getFlatESLint({cwd, fix, config, overrideConfigFile, loadESLintOverride = loadESLint}) {
|
|
66
|
+
async function getFlatESLint({cwd, fix, config = [], overrideConfigFile, loadESLintOverride = loadESLint}) {
|
|
65
67
|
const FlatESLint = await loadESLintOverride({
|
|
66
68
|
useFlatConfig: true,
|
|
67
69
|
});
|
|
@@ -69,10 +71,12 @@ async function getFlatESLint({cwd, fix, config, overrideConfigFile, loadESLintOv
|
|
|
69
71
|
const eslint = new FlatESLint({
|
|
70
72
|
cwd,
|
|
71
73
|
fix,
|
|
72
|
-
overrideConfig:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
overrideConfig: [
|
|
75
|
+
...maybeArray(config), {
|
|
76
|
+
ignores: ['!.*'],
|
|
77
|
+
}
|
|
78
|
+
,
|
|
79
|
+
],
|
|
76
80
|
...overrideConfigFile && {
|
|
77
81
|
overrideConfigFile,
|
|
78
82
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/eslint",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.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",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"find-up": "^7.0.0",
|
|
33
|
+
"once": "^1.4.0",
|
|
33
34
|
"try-to-catch": "^3.0.1"
|
|
34
35
|
},
|
|
35
36
|
"keywords": [
|
|
@@ -37,12 +38,12 @@
|
|
|
37
38
|
"eslint"
|
|
38
39
|
],
|
|
39
40
|
"devDependencies": {
|
|
41
|
+
"@putout/eslint-flat": "^2.0.0",
|
|
40
42
|
"@putout/plugin-eslint-plugin": "*",
|
|
41
43
|
"c8": "^10.0.0",
|
|
42
44
|
"eslint": "^9.0.0",
|
|
43
45
|
"eslint-plugin-n": "^17.0.0",
|
|
44
|
-
"eslint-plugin-putout": "^
|
|
45
|
-
"lerna": "^6.0.1",
|
|
46
|
+
"eslint-plugin-putout": "^24.1.0",
|
|
46
47
|
"madrun": "^10.0.0",
|
|
47
48
|
"mock-require": "^3.0.3",
|
|
48
49
|
"montag": "^1.0.0",
|