redlint 3.0.1 → 3.1.1
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/README.md +10 -4
- package/bin/redlint.js +6 -3
- package/lib/{start.js → choose.js} +5 -3
- package/lib/help.js +6 -7
- package/lib/master.js +1 -2
- package/package.json +1 -1
package/ChangeLog
CHANGED
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
>
|
|
14
14
|
> **(c) The Book of Kon, PoKon and ZaKon**
|
|
15
15
|
|
|
16
|
-

|
|
17
17
|
|
|
18
18
|
What if **Filesystem** was a simple **JSON** file [`.filesystem.json`](https://github.com/putoutjs/redlint/blob/master/.filesystem.json). What if you can transform **JSON** file with 🐊[**Putout**](https://github.com/coderaiser/putout) code transformer and this changes modify **Filesystem**?
|
|
19
19
|
|
|
@@ -27,17 +27,23 @@ First time ever! Linter for you **Filesystem** 😏💾.
|
|
|
27
27
|
npm i redlint -g
|
|
28
28
|
```
|
|
29
29
|
|
|
30
|
+
## Choose
|
|
31
|
+
|
|
32
|
+
You can choose interactively when run `redlint`:
|
|
33
|
+
|
|
34
|
+

|
|
35
|
+
|
|
30
36
|
## Scan
|
|
31
37
|
|
|
32
38
|
To scan your files use `redlint scan`:
|
|
33
39
|
|
|
34
|
-

|
|
35
41
|
|
|
36
|
-
##
|
|
42
|
+
## Fix
|
|
37
43
|
|
|
38
44
|
To fix your files use `redlint fix`:
|
|
39
45
|
|
|
40
|
-

|
|
41
47
|
|
|
42
48
|
## Generate
|
|
43
49
|
|
package/bin/redlint.js
CHANGED
|
@@ -8,7 +8,7 @@ import formatterCodeFrame from '@putout/formatter-codeframe';
|
|
|
8
8
|
import formatterDump from '@putout/formatter-dump';
|
|
9
9
|
import ora from 'ora';
|
|
10
10
|
import {help} from '../lib/help.js';
|
|
11
|
-
import {
|
|
11
|
+
import {choose} from '../lib/choose.js';
|
|
12
12
|
import {buildTree} from '../lib/redlint.js';
|
|
13
13
|
import {convertToSimple} from '../lib/simple.js';
|
|
14
14
|
import {masterLint} from '../lib/master.js';
|
|
@@ -21,7 +21,7 @@ let [arg] = process.argv.slice(2);
|
|
|
21
21
|
let header = true;
|
|
22
22
|
|
|
23
23
|
if (!arg) {
|
|
24
|
-
const cmd = await
|
|
24
|
+
const cmd = await choose();
|
|
25
25
|
|
|
26
26
|
if (!cmd)
|
|
27
27
|
process.exit(1);
|
|
@@ -30,6 +30,9 @@ if (!arg) {
|
|
|
30
30
|
header = false;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
if (arg === 'exit')
|
|
34
|
+
process.exit();
|
|
35
|
+
|
|
33
36
|
if (arg === 'help') {
|
|
34
37
|
help({
|
|
35
38
|
header,
|
|
@@ -43,7 +46,7 @@ const result = await buildTree(process.cwd());
|
|
|
43
46
|
|
|
44
47
|
spinner.succeed();
|
|
45
48
|
|
|
46
|
-
if (arg === 'simple') {
|
|
49
|
+
if (arg === 'generate:simple') {
|
|
47
50
|
await writeFile('.filesystem.json', lintJSON(stringify(convertToSimple(result))));
|
|
48
51
|
process.exit(0);
|
|
49
52
|
}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import {logo} from './logo.js';
|
|
2
2
|
import process from 'node:process';
|
|
3
|
-
import {choose} from '@putout/cli-choose';
|
|
3
|
+
import {choose as chooseDialog} from '@putout/cli-choose';
|
|
4
4
|
|
|
5
|
-
export const
|
|
5
|
+
export const choose = async () => {
|
|
6
6
|
console.log('Lint your files according to 🐊Putout rules.\n');
|
|
7
7
|
process.stdout.write(logo);
|
|
8
8
|
console.log('');
|
|
9
9
|
|
|
10
|
-
const command = await
|
|
10
|
+
const command = await chooseDialog('Command:', [
|
|
11
11
|
'scan',
|
|
12
12
|
'scan:frame',
|
|
13
13
|
'fix',
|
|
14
14
|
'help',
|
|
15
15
|
'generate',
|
|
16
|
+
'generate:simple',
|
|
17
|
+
'exit',
|
|
16
18
|
]);
|
|
17
19
|
|
|
18
20
|
console.log('');
|
package/lib/help.js
CHANGED
|
@@ -11,12 +11,11 @@ export const help = ({header = true}) => {
|
|
|
11
11
|
console.log(`Usage: redlint [command]`);
|
|
12
12
|
|
|
13
13
|
console.log(`Commands:
|
|
14
|
-
scan
|
|
15
|
-
scan:frame
|
|
16
|
-
fix
|
|
17
|
-
help
|
|
18
|
-
generate
|
|
14
|
+
scan - scan files according to 🐊Putout rules
|
|
15
|
+
scan:frame - scan files, show results in code frame
|
|
16
|
+
fix - fix files according to 🐊Putout rules
|
|
17
|
+
help - show help screen and exit
|
|
18
|
+
generate - generate .filesystem.json file and exit
|
|
19
|
+
generate:simple - generate simple .filesystem.json file and exit
|
|
19
20
|
`);
|
|
20
|
-
|
|
21
|
-
console.log('');
|
|
22
21
|
};
|
package/lib/master.js
CHANGED
|
@@ -130,8 +130,7 @@ function run(filesystem, {fix, start, end, push, fail, success}) {
|
|
|
130
130
|
});
|
|
131
131
|
worker.on('error', reject);
|
|
132
132
|
worker.on('exit', (code) => {
|
|
133
|
-
|
|
134
|
-
reject(Error(`Worker stopped with exit code ${code}`));
|
|
133
|
+
reject(Error(`Worker stopped with exit code ${code}`));
|
|
135
134
|
});
|
|
136
135
|
});
|
|
137
136
|
}
|