@cherepanov.pavel/shareable-config 2.0.0 → 2.0.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.
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
change with execFile carefully later. Cover with tests
|
|
3
|
+
*/
|
|
1
4
|
import {
|
|
2
|
-
|
|
5
|
+
exec,
|
|
3
6
|
} from "node:child_process";
|
|
4
7
|
import {
|
|
5
8
|
promisify,
|
|
6
9
|
} from "node:util";
|
|
7
10
|
|
|
8
|
-
const
|
|
11
|
+
const execAsync = promisify(exec);
|
|
12
|
+
|
|
9
13
|
// filePaths: string | string[]
|
|
10
14
|
export async function eslintFiles(filePaths) {
|
|
11
15
|
const paths = Array.isArray(filePaths)
|
|
@@ -15,10 +19,7 @@ export async function eslintFiles(filePaths) {
|
|
|
15
19
|
];
|
|
16
20
|
|
|
17
21
|
const promises = paths.map(async (path) => {
|
|
18
|
-
return
|
|
19
|
-
path,
|
|
20
|
-
"--fix",
|
|
21
|
-
]);
|
|
22
|
+
return execAsync(`eslint ${path} --fix`);
|
|
22
23
|
});
|
|
23
24
|
|
|
24
25
|
return Promise.all(promises);
|