redlint 1.0.6 → 2.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 CHANGED
@@ -1,3 +1,18 @@
1
+ 2023.12.10, v2.0.0
2
+
3
+ feature:
4
+ - 7a10a8f redlint: eslint-plugin-putout v22.0.0
5
+ - fc2057e redlint: madrun v10.0.0
6
+ - 6c6c7d2 redlint: supertape v9.0.0
7
+ - 273d314 redlint: putout v34.0.0
8
+ - 89d7abb drop support of node < 18
9
+ - 91a0203 redlint: simple
10
+
11
+ 2023.11.19, v1.0.7
12
+
13
+ feature:
14
+ - 44eb083 redlint: simplify
15
+
1
16
  2023.11.07, v1.0.6
2
17
 
3
18
  fix:
package/README.md CHANGED
@@ -25,10 +25,18 @@ npm i redlint -g
25
25
 
26
26
  ## Usage Example
27
27
 
28
+ To produce `.filesystem.json` file use:
29
+
28
30
  ```sh
29
31
  redlint
30
32
  ```
31
33
 
34
+ When you want `simple filesystem` format use:
35
+
36
+ ```sh
37
+ redlint simple
38
+ ```
39
+
32
40
  ## License
33
41
 
34
42
  MIT
package/bin/redlint.js CHANGED
@@ -4,9 +4,16 @@ import {lintJSON} from 'putout/lint/json';
4
4
  import process from 'node:process';
5
5
  import {writeFile} from 'node:fs/promises';
6
6
  import {buildTree} from '../lib/redlint.js';
7
+ import {convertToSimple} from '../lib/simple.js';
7
8
 
8
9
  const {stringify} = JSON;
9
10
  const result = await buildTree(process.cwd());
10
11
  const filesystem = lintJSON(stringify(result));
12
+ const [arg] = process.argv.slice(2);
13
+
14
+ if (arg === 'simple') {
15
+ await writeFile('.filesystem.json', convertToSimple(filesystem));
16
+ process.exit(0);
17
+ }
11
18
 
12
19
  await writeFile('.filesystem.json', filesystem);
package/lib/redlint.js CHANGED
@@ -22,8 +22,9 @@ export const buildTree = async (cwd, {parseOptions = parseOptionsOriginal, opend
22
22
 
23
23
  async function walk({cwd, dir, ignore, files = [], opendir}) {
24
24
  for await (const dirent of await opendir(dir)) {
25
- const {path, name} = dirent;
26
- const filename = `${path}/${name}`;
25
+ const {name} = dirent;
26
+
27
+ const filename = `${dir}/${name}`;
27
28
  const resolved = resolveName(filename, cwd);
28
29
 
29
30
  if (resolved && ignore.ignores(resolved))
package/lib/simple.js ADDED
@@ -0,0 +1,23 @@
1
+ const addSlash = (a) => a === '/' ? a : `${a}/`;
2
+
3
+ export const convertToSimple = (tree, simpleTree = []) => {
4
+ const {type, filename} = tree;
5
+
6
+ if (type === 'directory') {
7
+ simpleTree.push(addSlash(filename));
8
+
9
+ for (const file of tree.files)
10
+ convertToSimple(file, simpleTree);
11
+
12
+ return simpleTree;
13
+ }
14
+
15
+ if (tree.content) {
16
+ simpleTree.push([filename, tree.content]);
17
+ return simpleTree;
18
+ }
19
+
20
+ simpleTree.push(filename);
21
+
22
+ return simpleTree;
23
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "redlint",
3
- "version": "1.0.6",
3
+ "version": "2.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,7 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "ignore": "^5.2.4",
34
- "putout": "^32.15.1"
34
+ "putout": "^34.0.0"
35
35
  },
36
36
  "keywords": [
37
37
  "putout",
@@ -46,19 +46,19 @@
46
46
  "c8": "^8.0.0",
47
47
  "eslint": "^8.0.1",
48
48
  "eslint-plugin-n": "^16.0.0",
49
- "eslint-plugin-putout": "^21.0.1",
49
+ "eslint-plugin-putout": "^22.0.0",
50
50
  "estree-to-babel": "^8.0.0",
51
51
  "just-kebab-case": "^4.2.0",
52
- "madrun": "^9.0.0",
52
+ "madrun": "^10.0.0",
53
53
  "mock-require": "^3.0.3",
54
54
  "montag": "^1.0.0",
55
55
  "nodemon": "^3.0.1",
56
- "supertape": "^8.0.0",
56
+ "supertape": "^9.0.0",
57
57
  "try-catch": "^3.0.0"
58
58
  },
59
59
  "license": "MIT",
60
60
  "engines": {
61
- "node": ">=16"
61
+ "node": ">=18"
62
62
  },
63
63
  "publishConfig": {
64
64
  "access": "public"