redlint 2.1.2 β 3.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/ChangeLog +5 -0
- package/README.md +13 -23
- package/bin/redlint.js +24 -8
- package/lib/help.js +18 -0
- package/lib/logo.js +2 -3
- package/package.json +2 -1
package/ChangeLog
CHANGED
package/README.md
CHANGED
|
@@ -13,11 +13,13 @@
|
|
|
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
|
|
|
20
|
-
Checkout in π[**Putout Editor**](https://putout.cloudcmd.io/#/gist/0614c2da35a1864b59ac284f18656328/695a9960c401d4e8f6744f58eac591d8f9185235).
|
|
20
|
+
What if I tell you it is possible? π± Checkout in π[**Putout Editor**](https://putout.cloudcmd.io/#/gist/0614c2da35a1864b59ac284f18656328/695a9960c401d4e8f6744f58eac591d8f9185235).
|
|
21
|
+
|
|
22
|
+
First time ever! Linter for you **Filesystem** ππΎ.
|
|
21
23
|
|
|
22
24
|
## Install
|
|
23
25
|
|
|
@@ -25,33 +27,21 @@ Checkout in π[**Putout Editor**](https://putout.cloudcmd.io/#/gist/0614c2da35
|
|
|
25
27
|
npm i redlint -g
|
|
26
28
|
```
|
|
27
29
|
|
|
28
|
-
##
|
|
30
|
+
## Scan
|
|
29
31
|
|
|
30
|
-
To
|
|
32
|
+
To scan your files use `redlint scan`:
|
|
31
33
|
|
|
32
|
-
|
|
33
|
-
redlint
|
|
34
|
-
```
|
|
34
|
+

|
|
35
35
|
|
|
36
|
-
Scan
|
|
36
|
+
## Scan
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
redlint scan
|
|
40
|
-
```
|
|
38
|
+
To fix your files use `redlint fix`:
|
|
41
39
|
|
|
42
|
-
|
|
40
|
+

|
|
43
41
|
|
|
44
|
-
|
|
45
|
-
redlint fix
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
When you want `simple filesystem` format use:
|
|
49
|
-
|
|
50
|
-
```sh
|
|
51
|
-
redlint simple
|
|
52
|
-
```
|
|
42
|
+
## Generate
|
|
53
43
|
|
|
54
|
-
|
|
44
|
+
You can also generate `.filesystem.json` file with `putout generate`.
|
|
55
45
|
|
|
56
46
|
## License
|
|
57
47
|
|
package/bin/redlint.js
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
import {lintJSON} from 'putout/lint/json';
|
|
4
4
|
import process from 'node:process';
|
|
5
5
|
import {writeFile} from 'node:fs/promises';
|
|
6
|
+
import formatterCodeFrame from '@putout/formatter-codeframe';
|
|
6
7
|
import ora from 'ora';
|
|
7
|
-
import
|
|
8
|
+
import {help} from '../lib/help.js';
|
|
8
9
|
import {buildTree} from '../lib/redlint.js';
|
|
9
10
|
import {convertToSimple} from '../lib/simple.js';
|
|
10
11
|
import {masterLint} from '../lib/master.js';
|
|
@@ -14,8 +15,8 @@ const {stringify} = JSON;
|
|
|
14
15
|
|
|
15
16
|
const [arg] = process.argv.slice(2);
|
|
16
17
|
|
|
17
|
-
if (arg === 'help') {
|
|
18
|
-
|
|
18
|
+
if (!arg || arg === 'help') {
|
|
19
|
+
help();
|
|
19
20
|
process.exit();
|
|
20
21
|
}
|
|
21
22
|
|
|
@@ -36,8 +37,11 @@ if (arg === 'scan') {
|
|
|
36
37
|
fix: false,
|
|
37
38
|
});
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
if (!result.length)
|
|
41
|
+
process.exit();
|
|
42
|
+
|
|
43
|
+
console.error(result);
|
|
44
|
+
process.exit(1);
|
|
41
45
|
}
|
|
42
46
|
|
|
43
47
|
if (arg === 'lint') {
|
|
@@ -45,16 +49,28 @@ if (arg === 'lint') {
|
|
|
45
49
|
fix: true,
|
|
46
50
|
});
|
|
47
51
|
|
|
48
|
-
|
|
52
|
+
process.stderr.write(result);
|
|
49
53
|
process.exit();
|
|
50
54
|
}
|
|
51
55
|
|
|
52
56
|
if (arg === 'fix') {
|
|
53
|
-
await masterLint(filesystem, {
|
|
57
|
+
const places = await masterLint(filesystem, {
|
|
54
58
|
fix: true,
|
|
55
59
|
});
|
|
56
60
|
|
|
61
|
+
const result = await formatterCodeFrame({
|
|
62
|
+
name: '.filesystem.json',
|
|
63
|
+
source: filesystem,
|
|
64
|
+
places,
|
|
65
|
+
index: 0,
|
|
66
|
+
count: places.length,
|
|
67
|
+
filesCount: 1,
|
|
68
|
+
errorsCount: places.length,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
process.stdout.write(result);
|
|
57
72
|
process.exit();
|
|
58
73
|
}
|
|
59
74
|
|
|
60
|
-
|
|
75
|
+
if (arg === 'generate')
|
|
76
|
+
await writeFile('.filesystem.json', filesystem);
|
package/lib/help.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {logo} from './logo.js';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import process from 'node:process';
|
|
4
|
+
|
|
5
|
+
export const help = () => {
|
|
6
|
+
console.log('Lint your files according to πPutout rules.\n');
|
|
7
|
+
process.stdout.write(logo);
|
|
8
|
+
console.log('');
|
|
9
|
+
console.log(`Usage: redlint ${chalk.bgBlue('command')}`);
|
|
10
|
+
console.log(`Commands:
|
|
11
|
+
${chalk.bgBlue('scan')} - scan files according to πPutout rules
|
|
12
|
+
${chalk.bgBlue('fix')} - fix files according to πPutout rules
|
|
13
|
+
${chalk.bgBlue('help')} - show help screen and exit
|
|
14
|
+
${chalk.bgBlue('generate')} - generate .filesystem.json file and exit
|
|
15
|
+
`);
|
|
16
|
+
|
|
17
|
+
console.log('(c) https://github.com/putoutjs/redlint');
|
|
18
|
+
};
|
package/lib/logo.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
-
import process from 'node:process';
|
|
3
2
|
|
|
4
3
|
/*
|
|
5
4
|
console.log(`
|
|
@@ -10,10 +9,10 @@ ${chalk.red('ββ ββ ββ ββ ββ')} ${chalk.white('β
|
|
|
10
9
|
${chalk.red('ββ ββ βββββββ ββββββ ')} ${chalk.white('βββββββ ββ ββ ββββ ββ ')}
|
|
11
10
|
`);
|
|
12
11
|
*/
|
|
13
|
-
export
|
|
12
|
+
export const logo = `
|
|
14
13
|
${chalk.red('ββββββ βββββββ ββββββ ')} ββ ββ βββ ββ ββββββββ
|
|
15
14
|
${chalk.red('ββ ββ ββ ββ ββ')} ββ ββ ββββ ββ ββ
|
|
16
15
|
${chalk.red('ββββββ βββββ ββ ββ')} ββ ββ ββ ββ ββ ββ
|
|
17
16
|
${chalk.red('ββ ββ ββ ββ ββ')} ββ ββ ββ ββ ββ ββ
|
|
18
17
|
${chalk.red('ββ ββ βββββββ ββββββ ')} βββββββ ββ ββ ββββ ββ
|
|
19
|
-
`.slice(1)
|
|
18
|
+
`.slice(1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "redlint",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "Lint Filesystem with πPutout",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@putout/engine-runner": "^20.1.0",
|
|
34
|
+
"@putout/formatter-codeframe": "^6.0.0",
|
|
34
35
|
"@putout/processor-filesystem": "^3.0.0",
|
|
35
36
|
"chalk": "^5.3.0",
|
|
36
37
|
"fullstore": "^3.0.0",
|