@putout/eslint 1.4.0 β 1.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/README.md +3 -2
- package/lib/eslint.js +4 -0
- package/lib/get-eslint.mjs +4 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ const [source, places] = await eslint({
|
|
|
35
35
|
|
|
36
36
|
Isn't it looks similar to π**Putout** way? It definitely is! But... It has a couple differences you should remember:
|
|
37
37
|
|
|
38
|
-
- βοΈ *[π**Putout** returns object with `code` and `places` properties](https://github.com/coderaiser/putout#plugins)
|
|
38
|
+
- βοΈ *[π**Putout** returns object with `code` and `places` properties](https://github.com/coderaiser/putout#plugins), and **ESLint* returns a tuple**
|
|
39
39
|
- βοΈ ***ESLint** has a `name` property that is used to calculate configuration file.*
|
|
40
40
|
|
|
41
41
|
And you can even override any of **ESLint** βοΈ options with help of `config` property:
|
|
@@ -53,7 +53,7 @@ const [source, places] = await eslint({
|
|
|
53
53
|
});
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
If you want to apply π**Putout** transformations using [`putout/putout`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#readme) **ESLint** rule, enable π**Putout** with the same called
|
|
56
|
+
If you want to apply π**Putout** transformations using [`putout/putout`](https://github.com/coderaiser/putout/tree/master/packages/eslint-plugin-putout#readme) **ESLint** rule, enable π**Putout** with the same called but lowercased flag:
|
|
57
57
|
|
|
58
58
|
```js
|
|
59
59
|
const [source, places] = await eslint({
|
|
@@ -153,6 +153,7 @@ When you need to run **ESLint** with one plugin (*rule*), just use `lint` it wil
|
|
|
153
153
|
|
|
154
154
|
```js
|
|
155
155
|
const lint = require('@putout/eslint/lint');
|
|
156
|
+
const {createPlugin} = require('@putout/eslint/create-plugin');
|
|
156
157
|
const removeDebugger = require('./remove-debugger');
|
|
157
158
|
|
|
158
159
|
const [code, places] = lint('debugger', {
|
package/lib/eslint.js
CHANGED
|
@@ -6,6 +6,7 @@ const tryToCatch = require('try-to-catch');
|
|
|
6
6
|
const {keys} = Object;
|
|
7
7
|
const eslintId = ' (eslint)';
|
|
8
8
|
const overrideConfigFile = process.env.ESLINT_CONFIG_FILE;
|
|
9
|
+
const noESLint = process.env.NO_ESLINT;
|
|
9
10
|
|
|
10
11
|
const noConfigFound = (config, configError) => {
|
|
11
12
|
if (configError && configError.messageTemplate === 'no-config-found')
|
|
@@ -30,6 +31,9 @@ module.exports = async ({name, code, fix, config, putout = false}) => {
|
|
|
30
31
|
[],
|
|
31
32
|
];
|
|
32
33
|
|
|
34
|
+
if (noESLint)
|
|
35
|
+
return noChanges;
|
|
36
|
+
|
|
33
37
|
const [, ESLint] = await tryToCatch(simpleImport, './get-eslint.mjs');
|
|
34
38
|
|
|
35
39
|
if (!ESLint)
|
package/lib/get-eslint.mjs
CHANGED
|
@@ -21,12 +21,14 @@ export const getESLint = ({name, fix, config, overrideConfigFile, ESLintOverride
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
function chooseESLint({name, config, fix, overrideConfigFile, ESLintOverride, find}) {
|
|
24
|
-
|
|
24
|
+
const flatConfigPath = find('eslint.config.js');
|
|
25
|
+
|
|
26
|
+
if (flatConfigPath)
|
|
25
27
|
return getFlatESLint({
|
|
26
28
|
ESLintOverride,
|
|
27
29
|
name,
|
|
28
30
|
config,
|
|
29
|
-
overrideConfigFile,
|
|
31
|
+
overrideConfigFile: overrideConfigFile || flatConfigPath,
|
|
30
32
|
fix,
|
|
31
33
|
});
|
|
32
34
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@putout/eslint",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.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",
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"eslint-plugin-n": "^15.2.4",
|
|
44
44
|
"eslint-plugin-putout": "^16.0.0",
|
|
45
45
|
"just-camel-case": "^4.0.2",
|
|
46
|
-
"lerna": "^
|
|
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
50
|
"nodemon": "^2.0.1",
|
|
51
51
|
"putout": "*",
|
|
52
|
-
"supertape": "^
|
|
52
|
+
"supertape": "^8.0.0",
|
|
53
53
|
"try-catch": "^3.0.0"
|
|
54
54
|
},
|
|
55
55
|
"license": "MIT",
|