redlint 3.14.0 β 3.15.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/ChangeLog +10 -0
- package/bin/redlint.js +1 -1
- package/lib/convert/convert.js +8 -40
- package/lib/convert/create-options.js +49 -0
- package/lib/convert/index.js +2 -0
- package/lib/convert/master.js +9 -8
- package/lib/convert/slave.js +1 -4
- package/lib/extract/extract.js +6 -5
- package/lib/extract/master.js +10 -8
- package/lib/extract/slave.js +1 -4
- package/lib/lint/lint.js +10 -13
- package/lib/lint/slave.js +1 -4
- package/lib/menu.js +3 -1
- package/lib/pack/master.js +9 -8
- package/lib/pack/pack.js +6 -5
- package/lib/pack/slave.js +1 -4
- package/lib/redlint.js +5 -1
- package/package.json +2 -1
package/ChangeLog
CHANGED
package/bin/redlint.js
CHANGED
package/lib/convert/convert.js
CHANGED
|
@@ -4,24 +4,20 @@ import {
|
|
|
4
4
|
print,
|
|
5
5
|
} from 'putout';
|
|
6
6
|
import {createProgress} from '@putout/engine-runner/progress';
|
|
7
|
-
import * as pluginFilesystem from '@putout/plugin-filesystem';
|
|
8
7
|
import {
|
|
9
8
|
branch as originalBranch,
|
|
10
9
|
merge as originalMerge,
|
|
11
10
|
} from '@putout/processor-filesystem';
|
|
12
|
-
import {
|
|
13
|
-
isConvertToJs,
|
|
14
|
-
isConvertToJson,
|
|
15
|
-
} from '../menu.js';
|
|
16
11
|
|
|
17
|
-
|
|
18
|
-
const [, pluginConvertJsToJson] = pluginFilesystem.rules['convert-js-to-json'];
|
|
12
|
+
import {createOptions} from './create-options.js';
|
|
19
13
|
|
|
20
|
-
export const convert = (filename, type, filesystem, {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
export const convert = (filename, type, filesystem, overrides = {}) => {
|
|
15
|
+
const {
|
|
16
|
+
progress = createProgress(),
|
|
17
|
+
branch = originalBranch,
|
|
18
|
+
merge = originalMerge,
|
|
19
|
+
} = overrides;
|
|
20
|
+
|
|
25
21
|
const [{source}] = branch(filesystem);
|
|
26
22
|
const ast = parse(source);
|
|
27
23
|
const options = createOptions(filename, type);
|
|
@@ -37,31 +33,3 @@ export const convert = (filename, type, filesystem, {
|
|
|
37
33
|
|
|
38
34
|
return merge(filesystem, [code]);
|
|
39
35
|
};
|
|
40
|
-
|
|
41
|
-
function createOptions(filename, type) {
|
|
42
|
-
if (isConvertToJs(type))
|
|
43
|
-
return {
|
|
44
|
-
rules: {
|
|
45
|
-
'filesystem/convert-json-to-js': ['on', {
|
|
46
|
-
filename,
|
|
47
|
-
}],
|
|
48
|
-
},
|
|
49
|
-
plugins: [
|
|
50
|
-
['filesystem/convert-json-to-js', pluginConvertJsonToJs],
|
|
51
|
-
],
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
if (isConvertToJson(type))
|
|
55
|
-
return {
|
|
56
|
-
rules: {
|
|
57
|
-
'filesystem/convert-js-to-json': ['on', {
|
|
58
|
-
filename,
|
|
59
|
-
}],
|
|
60
|
-
},
|
|
61
|
-
plugins: [
|
|
62
|
-
['filesystem/convert-js-to-json', pluginConvertJsToJson],
|
|
63
|
-
],
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
return {};
|
|
67
|
-
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as pluginFilesystem from '@putout/plugin-filesystem';
|
|
2
|
+
import * as pluginESLint from '@putout/plugin-eslint';
|
|
3
|
+
import {
|
|
4
|
+
isConvertToJs,
|
|
5
|
+
isConvertToJson,
|
|
6
|
+
isConvertRCToFlat,
|
|
7
|
+
} from '../menu.js';
|
|
8
|
+
|
|
9
|
+
const [, pluginConvertJsonToJs] = pluginFilesystem.rules['convert-json-to-js'];
|
|
10
|
+
const [, pluginConvertJsToJson] = pluginFilesystem.rules['convert-js-to-json'];
|
|
11
|
+
const [, convertRCToFlat] = pluginESLint.rules['convert-rc-to-flat'];
|
|
12
|
+
|
|
13
|
+
export const createOptions = (filename, type) => {
|
|
14
|
+
if (isConvertToJs(type))
|
|
15
|
+
return {
|
|
16
|
+
rules: {
|
|
17
|
+
'filesystem/convert-json-to-js': ['on', {
|
|
18
|
+
filename,
|
|
19
|
+
}],
|
|
20
|
+
},
|
|
21
|
+
plugins: [
|
|
22
|
+
['filesystem/convert-json-to-js', pluginConvertJsonToJs],
|
|
23
|
+
],
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
if (isConvertToJson(type))
|
|
27
|
+
return {
|
|
28
|
+
rules: {
|
|
29
|
+
'filesystem/convert-js-to-json': ['on', {
|
|
30
|
+
filename,
|
|
31
|
+
}],
|
|
32
|
+
},
|
|
33
|
+
plugins: [
|
|
34
|
+
['filesystem/convert-js-to-json', pluginConvertJsToJson],
|
|
35
|
+
],
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
if (isConvertRCToFlat(type))
|
|
39
|
+
return {
|
|
40
|
+
rules: {
|
|
41
|
+
'eslint/convert-rc-to-flat': 'on',
|
|
42
|
+
},
|
|
43
|
+
plugins: [
|
|
44
|
+
['eslint/convert-rc-to-flat', convertRCToFlat],
|
|
45
|
+
],
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
return {};
|
|
49
|
+
};
|
package/lib/convert/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
CONVERT_JSON_TO_JS,
|
|
5
5
|
BACK,
|
|
6
6
|
EXIT,
|
|
7
|
+
CONVERT_RC_TO_FLAT,
|
|
7
8
|
} from '../menu.js';
|
|
8
9
|
|
|
9
10
|
export * from './convert.js';
|
|
@@ -11,6 +12,7 @@ export const chooseConvert = async () => {
|
|
|
11
12
|
const command = await chooseDialog('Convert:', [
|
|
12
13
|
CONVERT_JS_TO_JSON,
|
|
13
14
|
CONVERT_JSON_TO_JS,
|
|
15
|
+
CONVERT_RC_TO_FLAT,
|
|
14
16
|
BACK,
|
|
15
17
|
EXIT,
|
|
16
18
|
]);
|
package/lib/convert/master.js
CHANGED
|
@@ -8,14 +8,15 @@ import {
|
|
|
8
8
|
setSuffixText,
|
|
9
9
|
} from '../spinner.js';
|
|
10
10
|
|
|
11
|
-
export function masterConvert(filename, type, filesystem, {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
export function masterConvert(filename, type, filesystem, overrides = {}) {
|
|
12
|
+
const {
|
|
13
|
+
start = setStart,
|
|
14
|
+
end = setEnd,
|
|
15
|
+
push = setPush,
|
|
16
|
+
fail = setFail,
|
|
17
|
+
success = setSuccess,
|
|
18
|
+
suffix = setSuffixText,
|
|
19
|
+
} = overrides;
|
|
19
20
|
const slave = new URL('./slave.js', import.meta.url);
|
|
20
21
|
const workerData = {
|
|
21
22
|
filename,
|
package/lib/convert/slave.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
parentPort,
|
|
3
|
-
workerData,
|
|
4
|
-
} from 'node:worker_threads';
|
|
1
|
+
import {parentPort, workerData} from 'node:worker_threads';
|
|
5
2
|
import {createProgress} from '@putout/engine-runner/progress';
|
|
6
3
|
import {convert} from './convert.js';
|
|
7
4
|
import {createSlave} from '../slave.js';
|
package/lib/extract/extract.js
CHANGED
|
@@ -11,11 +11,12 @@ import {
|
|
|
11
11
|
merge as originalMerge,
|
|
12
12
|
} from '@putout/processor-filesystem';
|
|
13
13
|
|
|
14
|
-
export const extract = (to, filesystem, {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
export const extract = (to, filesystem, overrides = {}) => {
|
|
15
|
+
const {
|
|
16
|
+
progress = createProgress(),
|
|
17
|
+
branch = originalBranch,
|
|
18
|
+
merge = originalMerge,
|
|
19
|
+
} = overrides;
|
|
19
20
|
const [{source}] = branch(filesystem);
|
|
20
21
|
const ast = parse(source);
|
|
21
22
|
|
package/lib/extract/master.js
CHANGED
|
@@ -8,16 +8,18 @@ import {
|
|
|
8
8
|
setSuffixText,
|
|
9
9
|
} from '../spinner.js';
|
|
10
10
|
|
|
11
|
-
export function masterExtract(cwd, filesystem, {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
export function masterExtract(cwd, filesystem, overrides = {}) {
|
|
12
|
+
const {
|
|
13
|
+
start = setStart,
|
|
14
|
+
end = setEnd,
|
|
15
|
+
push = setPush,
|
|
16
|
+
fail = setFail,
|
|
17
|
+
success = setSuccess,
|
|
18
|
+
suffix = setSuffixText,
|
|
19
|
+
} = overrides;
|
|
19
20
|
const slave = new URL('./slave.js', import.meta.url);
|
|
20
21
|
const fix = true;
|
|
22
|
+
|
|
21
23
|
const workerData = {
|
|
22
24
|
cwd,
|
|
23
25
|
filesystem,
|
package/lib/extract/slave.js
CHANGED
package/lib/lint/lint.js
CHANGED
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
transformAsync,
|
|
3
|
-
parse,
|
|
4
|
-
} from 'putout';
|
|
1
|
+
import {transformAsync, parse} from 'putout';
|
|
5
2
|
import parseOptions from 'putout/parse-options';
|
|
6
3
|
import {createProgress} from '@putout/engine-runner/progress';
|
|
7
4
|
import {init} from '@putout/operator-filesystem';
|
|
8
|
-
import {
|
|
9
|
-
toJS,
|
|
10
|
-
__filesystem,
|
|
11
|
-
} from '@putout/operator-json';
|
|
5
|
+
import {toJS, __filesystem} from '@putout/operator-json';
|
|
12
6
|
import filesystemCLI from '@putout/cli-filesystem';
|
|
13
7
|
|
|
14
|
-
export const lint = async (filesystem, {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
export const lint = async (filesystem, overrides = {}) => {
|
|
9
|
+
const {
|
|
10
|
+
fix,
|
|
11
|
+
test,
|
|
12
|
+
progress = createProgress(),
|
|
13
|
+
} = overrides;
|
|
14
|
+
|
|
19
15
|
if (!test)
|
|
20
16
|
init(filesystemCLI);
|
|
21
17
|
|
|
22
18
|
const source = toJS(filesystem, __filesystem);
|
|
19
|
+
|
|
23
20
|
const options = parseOptions({
|
|
24
21
|
name: '.filesystem.json',
|
|
25
22
|
});
|
package/lib/lint/slave.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
parentPort,
|
|
3
|
-
workerData,
|
|
4
|
-
} from 'node:worker_threads';
|
|
1
|
+
import {parentPort, workerData} from 'node:worker_threads';
|
|
5
2
|
import {lint} from './lint.js';
|
|
6
3
|
import {createSlave} from '../slave.js';
|
|
7
4
|
import {createProgress} from '@putout/engine-runner/progress';
|
package/lib/menu.js
CHANGED
|
@@ -17,9 +17,10 @@ export const CONVERT = 'π convert';
|
|
|
17
17
|
export const BACK = 'π back';
|
|
18
18
|
export const EXIT = 'πͺ exit';
|
|
19
19
|
|
|
20
|
+
export const CONVERT_RC_TO_FLAT = 'β£ convert ESLint RC to Flat Config';
|
|
20
21
|
export const CONVERT_JS_TO_JSON = 'π¦ convert js to json';
|
|
21
|
-
export const CONVERT_JSON_TO_JS = 'π¦ convert json to js';
|
|
22
22
|
export const CONVERT_JS_TO_JSON_DEBUG = 'π¦ convert js to json: debug';
|
|
23
|
+
export const CONVERT_JSON_TO_JS = 'π¦ convert json to js';
|
|
23
24
|
export const CONVERT_JSON_TO_JS_DEBUG = 'π¦ convert json to js: debug';
|
|
24
25
|
|
|
25
26
|
export const isScan = (a) => a === SCAN || a === 'scan';
|
|
@@ -44,3 +45,4 @@ export const isConvertChosenDebug = (a) => a === CONVERT_JS_TO_JSON_DEBUG || a =
|
|
|
44
45
|
|
|
45
46
|
export const isConvertToJson = (a) => a === CONVERT_JS_TO_JSON || a === CONVERT_JS_TO_JSON_DEBUG;
|
|
46
47
|
export const isConvertToJs = (a) => a === CONVERT_JSON_TO_JS || a === CONVERT_JSON_TO_JS_DEBUG;
|
|
48
|
+
export const isConvertRCToFlat = (a) => a === CONVERT_RC_TO_FLAT;
|
package/lib/pack/master.js
CHANGED
|
@@ -8,14 +8,15 @@ import {
|
|
|
8
8
|
setSuffixText,
|
|
9
9
|
} from '../spinner.js';
|
|
10
10
|
|
|
11
|
-
export function masterPack(cwd, filesystem, {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
export function masterPack(cwd, filesystem, overrides = {}) {
|
|
12
|
+
const {
|
|
13
|
+
start = setStart,
|
|
14
|
+
end = setEnd,
|
|
15
|
+
push = setPush,
|
|
16
|
+
fail = setFail,
|
|
17
|
+
success = setSuccess,
|
|
18
|
+
suffix = setSuffixText,
|
|
19
|
+
} = overrides;
|
|
19
20
|
const slave = new URL('./slave.js', import.meta.url);
|
|
20
21
|
const workerData = {
|
|
21
22
|
cwd,
|
package/lib/pack/pack.js
CHANGED
|
@@ -13,11 +13,12 @@ import {
|
|
|
13
13
|
const [, readAllFiles] = pluginFilesystem.rules['read-all-files'];
|
|
14
14
|
const [, replaceCwd] = pluginFilesystem.rules['replace-cwd'];
|
|
15
15
|
|
|
16
|
-
export const pack = (from, filesystem, {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
export const pack = (from, filesystem, overrides = {}) => {
|
|
17
|
+
const {
|
|
18
|
+
progress = createProgress(),
|
|
19
|
+
branch = originalBranch,
|
|
20
|
+
merge = originalMerge,
|
|
21
|
+
} = overrides;
|
|
21
22
|
const [{source}] = branch(filesystem);
|
|
22
23
|
const ast = parse(source);
|
|
23
24
|
|
package/lib/pack/slave.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
parentPort,
|
|
3
|
-
workerData,
|
|
4
|
-
} from 'node:worker_threads';
|
|
1
|
+
import {parentPort, workerData} from 'node:worker_threads';
|
|
5
2
|
import {createProgress} from '@putout/engine-runner/progress';
|
|
6
3
|
import {pack} from './pack.js';
|
|
7
4
|
import {createSlave} from '../slave.js';
|
package/lib/redlint.js
CHANGED
|
@@ -2,7 +2,11 @@ import parseOptionsOriginal from 'putout/parse-options';
|
|
|
2
2
|
import {opendir as opendirOriginal} from 'node:fs/promises';
|
|
3
3
|
import ignores from 'putout/ignores';
|
|
4
4
|
|
|
5
|
-
export const buildTree = async (cwd,
|
|
5
|
+
export const buildTree = async (cwd, overrides = {}) => {
|
|
6
|
+
const {
|
|
7
|
+
parseOptions = parseOptionsOriginal,
|
|
8
|
+
opendir = opendirOriginal,
|
|
9
|
+
} = overrides;
|
|
6
10
|
const options = parseOptions();
|
|
7
11
|
|
|
8
12
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "redlint",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.15.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "Lint Filesystem with πPutout",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"@putout/formatter-dump": "^5.0.0",
|
|
39
39
|
"@putout/operator-filesystem": "^4.0.1",
|
|
40
40
|
"@putout/operator-json": "^2.0.0",
|
|
41
|
+
"@putout/plugin-eslint": "^8.10.1",
|
|
41
42
|
"@putout/plugin-filesystem": "^5.0.0",
|
|
42
43
|
"@putout/plugin-nodejs": "^11.0.0",
|
|
43
44
|
"@putout/processor-filesystem": "^4.0.0",
|