@cherepanov.pavel/shareable-config 1.0.11 → 1.0.13

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.
@@ -7,6 +7,7 @@ import { mergeWithOverride } from '../utils/merge.js';
7
7
  import { getHeader } from '../utils/file-header.js';
8
8
  import { getSrcJSONFileData } from '../utils/file.js';
9
9
  import { getEnvs } from '../utils/env.js';
10
+ import { eslintFiles } from '../utils/lint.js';
10
11
 
11
12
  const fileNames = [
12
13
  'vue.code-snippets',
@@ -41,6 +42,7 @@ try {
41
42
  }
42
43
 
43
44
  await outputFile(destFile, `${getHeader()}${result}`);
45
+ await eslintFiles(destFile);
44
46
  if (isDestFileHaveOverride) {
45
47
  console.info(`${fileName} обновлён с учётом override`);
46
48
  } else {
@@ -7,6 +7,7 @@ import { mergeWithOverride } from '../utils/merge.js';
7
7
  import { getHeader } from '../utils/file-header.js';
8
8
  import { getEnvs } from '../utils/env.js';
9
9
  import { outputFile } from 'fs-extra';
10
+ import { eslintFiles } from '../utils/lint.js';
10
11
 
11
12
  const fileName = 'extensions.json';
12
13
  const destFile = path.join(process.cwd(), `.vscode/${fileName}`);
@@ -33,6 +34,7 @@ try {
33
34
  }
34
35
 
35
36
  await outputFile(destFile, `${getHeader()}${result}`);
37
+ await eslintFiles(destFile);
36
38
  if (overrideContent) {
37
39
  console.info(`${fileName} обновлён с учётом override`);
38
40
  } else {
@@ -7,6 +7,7 @@ import { mergeWithOverride } from '../utils/merge.js';
7
7
  import { getHeader } from '../utils/file-header.js';
8
8
  import { getEnvs } from '../utils/env.js';
9
9
  import { outputFile } from 'fs-extra';
10
+ import { eslintFiles } from '../utils/lint.js';
10
11
 
11
12
  const fileName = 'settings.json';
12
13
  const destFile = path.join(process.cwd(), `.vscode/${fileName}`);
@@ -33,6 +34,7 @@ try {
33
34
  }
34
35
 
35
36
  await outputFile(destFile, `${getHeader()}${result}`);
37
+ await eslintFiles(destFile);
36
38
  if (overrideContent) {
37
39
  console.info(`${fileName} обновлён с учётом override`);
38
40
  } else {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cherepanov.pavel/shareable-config",
3
3
  "description": "setup for new repositories",
4
- "version": "1.0.11",
4
+ "version": "1.0.13",
5
5
  "type": "module",
6
6
  "devEngines": {
7
7
  "packageManager": {
package/utils/lint.js ADDED
@@ -0,0 +1,14 @@
1
+ import { exec } from 'node:child_process';
2
+ import { promisify } from 'node:util';
3
+
4
+ const execAsync = promisify(exec);
5
+ // filePaths: string | string[]
6
+ export async function eslintFiles(filePaths) {
7
+ const paths = Array.isArray(filePaths) ? filePaths : [filePaths];
8
+
9
+ const promises = paths.map(async (path) => {
10
+ return execAsync(`eslint ${path} --fix`);
11
+ });
12
+
13
+ return Promise.all(promises);
14
+ }