redlint 1.0.4 → 1.0.6

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,13 @@
1
+ 2023.11.07, v1.0.6
2
+
3
+ fix:
4
+ - b399dc4 redlint: dir
5
+
6
+ 2023.11.05, v1.0.5
7
+
8
+ feature:
9
+ - d261d93 redlint: test
10
+
1
11
  2023.11.05, v1.0.4
2
12
 
3
13
  fix:
package/bin/redlint.js CHANGED
File without changes
package/lib/redlint.js CHANGED
@@ -1,21 +1,26 @@
1
1
  import ignore from 'ignore';
2
- import parseOptions from 'putout/parse-options';
3
- import {opendir} from 'node:fs/promises';
2
+ import parseOptionsOriginal from 'putout/parse-options';
3
+ import {opendir as opendirOriginal} from 'node:fs/promises';
4
4
 
5
5
  const resolveName = (name, cwd) => name.replace(`${cwd}/`, '');
6
6
 
7
- export const buildTree = async (cwd) => {
7
+ export const buildTree = async (cwd, {parseOptions = parseOptionsOriginal, opendir = opendirOriginal} = {}) => {
8
8
  const options = parseOptions();
9
9
  const ig = ignore().add(options.ignore.filter(isExcluded));
10
10
 
11
11
  return {
12
12
  type: 'directory',
13
13
  filename: cwd,
14
- files: await walk(cwd, cwd, ig),
14
+ files: await walk({
15
+ cwd,
16
+ dir: cwd,
17
+ ignore: ig,
18
+ opendir,
19
+ }),
15
20
  };
16
21
  };
17
22
 
18
- async function walk(cwd, dir, ignore, files = []) {
23
+ async function walk({cwd, dir, ignore, files = [], opendir}) {
19
24
  for await (const dirent of await opendir(dir)) {
20
25
  const {path, name} = dirent;
21
26
  const filename = `${path}/${name}`;
@@ -28,7 +33,12 @@ async function walk(cwd, dir, ignore, files = []) {
28
33
  files.push({
29
34
  type: 'directory',
30
35
  filename,
31
- files: await walk(cwd, filename, ignore),
36
+ files: await walk({
37
+ cwd,
38
+ dir: filename,
39
+ ignore,
40
+ opendir,
41
+ }),
32
42
  });
33
43
  continue;
34
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "redlint",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Lint Filesystem with 🐊Putout",