@cherepanov.pavel/shareable-config 1.0.13 → 1.0.15

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.
Files changed (50) hide show
  1. package/.editorconfig-get.js +12 -6
  2. package/.get-all.js +18 -12
  3. package/.gitattributes-get.js +12 -6
  4. package/.gitignore-get.js +28 -14
  5. package/.vscode/.code-snippets-get.js +28 -14
  6. package/.vscode/all-files.code-snippets +3 -1
  7. package/.vscode/extensions.json-get.js +26 -12
  8. package/.vscode/settings.json-get.js +26 -12
  9. package/.vscode/vue.code-snippets +1 -1
  10. package/env.json5.set.js +6 -2
  11. package/jsconfig.json +3 -1
  12. package/package.json +3 -3
  13. package/tools/eslint-config/configs/global.js +15 -9
  14. package/tools/eslint-config/configs/javascript.js +13 -7
  15. package/tools/eslint-config/configs/json.js +115 -57
  16. package/tools/eslint-config/configs/typescript.js +17 -9
  17. package/tools/eslint-config/configs/vue.js +41 -17
  18. package/tools/eslint-config/index.js +15 -5
  19. package/tools/eslint-config/rules/constants.js +1 -1
  20. package/tools/eslint-config/rules/javascript/index.js +6 -2
  21. package/tools/eslint-config/rules/javascript/possible-problems.js +193 -75
  22. package/tools/eslint-config/rules/javascript/suggestions.js +450 -225
  23. package/tools/eslint-config/rules/severity.js +3 -3
  24. package/tools/eslint-config/rules/stylistic/index.js +6 -2
  25. package/tools/eslint-config/rules/stylistic/jsFormatting.js +230 -148
  26. package/tools/eslint-config/rules/stylistic/tsFormatting.js +15 -5
  27. package/tools/eslint-config/rules/typescript/common.js +107 -103
  28. package/tools/eslint-config/rules/typescript/compatibility.js +23 -21
  29. package/tools/eslint-config/rules/typescript/extension.js +52 -46
  30. package/tools/eslint-config/rules/typescript/index.js +9 -3
  31. package/tools/eslint-config/rules/vue/base.js +9 -3
  32. package/tools/eslint-config/rules/vue/extension.js +60 -45
  33. package/tools/eslint-config/rules/vue/formatting.js +63 -35
  34. package/tools/eslint-config/rules/vue/index.js +15 -5
  35. package/tools/eslint-config/rules/vue/possibleProblems.js +272 -124
  36. package/tools/eslint-config/rules/vue/suggestions.js +228 -78
  37. package/tools/stylelint-config/config.js +17 -11
  38. package/tools/stylelint-config/rules/base.js +21 -19
  39. package/tools/stylelint-config/rules/conflicts.js +2 -2
  40. package/tools/stylelint-config/rules/order.js +25 -19
  41. package/tools/stylelint-config/rules/property-groups.js +339 -337
  42. package/tools/stylelint-config/rules/scss.js +6 -4
  43. package/tools/stylelint-config/rules/stylistic.js +84 -82
  44. package/utils/communication.js +3 -3
  45. package/utils/copy-with-override.js +31 -12
  46. package/utils/env.js +10 -6
  47. package/utils/file-header.js +10 -8
  48. package/utils/file.js +22 -14
  49. package/utils/lint.js +11 -3
  50. package/utils/merge.js +14 -12
@@ -1,16 +1,22 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import path from 'path';
4
- import { fileURLToPath } from 'url';
5
- import { copyWithOverride } from './utils/copy-with-override.js';
6
- import { readFile } from 'fs/promises';
3
+ import path from "path";
4
+ import {
5
+ fileURLToPath,
6
+ } from "url";
7
+ import {
8
+ copyWithOverride,
9
+ } from "./utils/copy-with-override.js";
10
+ import {
11
+ readFile,
12
+ } from "fs/promises";
7
13
 
8
- const fileName = '.editorconfig';
14
+ const fileName = ".editorconfig";
9
15
  const destFile = path.join(process.cwd(), fileName);
10
16
 
11
17
  const dirname = path.dirname(fileURLToPath(import.meta.url));
12
18
  const src = path.join(dirname, fileName);
13
- const srcFileData = await readFile(src, 'utf8');
19
+ const srcFileData = await readFile(src, "utf8");
14
20
 
15
21
  copyWithOverride({
16
22
  destFile,
package/.get-all.js CHANGED
@@ -1,27 +1,33 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { spawnSync } from 'child_process';
4
- import { readFile } from 'fs/promises';
3
+ import {
4
+ spawnSync,
5
+ } from "child_process";
6
+ import {
7
+ readFile,
8
+ } from "fs/promises";
5
9
 
6
10
  const commands = [
7
- 'get-editorconfig',
8
- 'get-gitattributes',
9
- 'get-gitignore',
10
- 'get-extensions',
11
- 'get-settings',
12
- 'get-code-snippets',
11
+ "get-editorconfig",
12
+ "get-gitattributes",
13
+ "get-gitignore",
14
+ "get-extensions",
15
+ "get-settings",
16
+ "get-code-snippets",
13
17
  ];
14
18
 
15
19
  let hasError = false;
16
20
 
17
- const pkg = JSON.parse(await readFile(new URL('./package.json', import.meta.url), 'utf8'));
21
+ const pkg = JSON.parse(await readFile(new URL("./package.json", import.meta.url), "utf8"));
18
22
 
19
23
  commands.forEach((cmd) => {
20
- const result = spawnSync('npx', [
21
- '-p',
24
+ const result = spawnSync("npx", [
25
+ "-p",
22
26
  pkg.name,
23
27
  cmd,
24
- ], { stdio: 'inherit' });
28
+ ], {
29
+ stdio: "inherit",
30
+ });
25
31
  if (result.status !== 0) {
26
32
  console.error(`\nОшибка при выполнении команды: ${cmd}`);
27
33
  hasError = true;
@@ -1,16 +1,22 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import path from 'path';
4
- import { fileURLToPath } from 'url';
5
- import { copyWithOverride } from './utils/copy-with-override.js';
6
- import { readFile } from 'fs/promises';
3
+ import path from "path";
4
+ import {
5
+ fileURLToPath,
6
+ } from "url";
7
+ import {
8
+ copyWithOverride,
9
+ } from "./utils/copy-with-override.js";
10
+ import {
11
+ readFile,
12
+ } from "fs/promises";
7
13
 
8
- const fileName = '.gitattributes';
14
+ const fileName = ".gitattributes";
9
15
  const destFile = path.join(process.cwd(), fileName);
10
16
 
11
17
  const dirname = path.dirname(fileURLToPath(import.meta.url));
12
18
  const src = path.join(dirname, fileName);
13
- const srcFileData = await readFile(src, 'utf8');
19
+ const srcFileData = await readFile(src, "utf8");
14
20
 
15
21
  copyWithOverride({
16
22
  destFile,
package/.gitignore-get.js CHANGED
@@ -1,20 +1,30 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import path from 'path';
4
- import { fileURLToPath } from 'url';
5
- import { readFile } from 'fs/promises';
6
- import { copyWithOverride } from './utils/copy-with-override.js';
7
- import { getEnvs } from './utils/env.js';
3
+ import path from "path";
4
+ import {
5
+ fileURLToPath,
6
+ } from "url";
7
+ import {
8
+ readFile,
9
+ } from "fs/promises";
10
+ import {
11
+ copyWithOverride,
12
+ } from "./utils/copy-with-override.js";
13
+ import {
14
+ getEnvs,
15
+ } from "./utils/env.js";
8
16
 
9
- const fileName = '.gitignore';
17
+ const fileName = ".gitignore";
10
18
  const destFile = path.join(process.cwd(), fileName);
11
19
 
12
20
  async function getGitignoreFileData(framework) {
13
21
  const dirname = path.dirname(fileURLToPath(import.meta.url));
14
- const src = path.join(dirname, '.npmignore');
15
- const srcFileData = await readFile(src, 'utf8');
22
+ const src = path.join(dirname, ".npmignore");
23
+ const srcFileData = await readFile(src, "utf8");
16
24
 
17
- const [commonData] = srcFileData.split(/^#\s*\w+/mu);
25
+ const [
26
+ commonData,
27
+ ] = srcFileData.split(/^#\s*\w+/mu);
18
28
 
19
29
  if (!framework) {
20
30
  return commonData.trim();
@@ -22,7 +32,9 @@ async function getGitignoreFileData(framework) {
22
32
 
23
33
  const sections = srcFileData.split(/^#\s*/mu).slice(1);
24
34
  const matchedSection = sections.find((section) => {
25
- const [header] = section.split('\n');
35
+ const [
36
+ header,
37
+ ] = section.split("\n");
26
38
  return header.trim().toLowerCase() === framework;
27
39
  });
28
40
 
@@ -30,15 +42,17 @@ async function getGitignoreFileData(framework) {
30
42
  const [
31
43
  header,
32
44
  ...body
33
- ] = matchedSection.split('\n');
34
- return `${commonData.trim()}\n\n# ${header}\n${body.join('\n').trim()}`.trim();
45
+ ] = matchedSection.split("\n");
46
+ return `${commonData.trim()}\n\n# ${header}\n${body.join("\n").trim()}`.trim();
35
47
  }
36
48
  // Если не найдено — только общий контент
37
49
  return commonData.trim();
38
50
  }
39
51
 
40
52
  try {
41
- const { repositoryFramework } = await getEnvs();
53
+ const {
54
+ repositoryFramework,
55
+ } = await getEnvs();
42
56
  const srcFileData = await getGitignoreFileData(repositoryFramework);
43
57
  await copyWithOverride({
44
58
  destFile,
@@ -46,5 +60,5 @@ try {
46
60
  fileLabel: fileName,
47
61
  });
48
62
  } catch (err) {
49
- console.error('Ошибка:', err.message);
63
+ console.error("Ошибка:", err.message);
50
64
  }
@@ -1,17 +1,31 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import path from 'path';
4
- import { readFile } from 'fs/promises';
5
- import { outputFile } from 'fs-extra';
6
- import { mergeWithOverride } from '../utils/merge.js';
7
- import { getHeader } from '../utils/file-header.js';
8
- import { getSrcJSONFileData } from '../utils/file.js';
9
- import { getEnvs } from '../utils/env.js';
10
- import { eslintFiles } from '../utils/lint.js';
3
+ import path from "path";
4
+ import {
5
+ readFile,
6
+ } from "fs/promises";
7
+ import {
8
+ outputFile,
9
+ } from "fs-extra";
10
+ import {
11
+ mergeWithOverride,
12
+ } from "../utils/merge.js";
13
+ import {
14
+ getHeader,
15
+ } from "../utils/file-header.js";
16
+ import {
17
+ getSrcJSONFileData,
18
+ } from "../utils/file.js";
19
+ import {
20
+ getEnvs,
21
+ } from "../utils/env.js";
22
+ import {
23
+ eslintFiles,
24
+ } from "../utils/lint.js";
11
25
 
12
26
  const fileNames = [
13
- 'vue.code-snippets',
14
- 'all-files.code-snippets',
27
+ "vue.code-snippets",
28
+ "all-files.code-snippets",
15
29
  ];
16
30
 
17
31
  try {
@@ -23,15 +37,15 @@ try {
23
37
  const srcFileData = await getSrcJSONFileData({
24
38
  fileName,
25
39
  isTs,
26
- removeDuplicateKeys: fileName === 'vue.code-snippets',
40
+ removeDuplicateKeys: fileName === "vue.code-snippets",
27
41
  });
28
42
 
29
43
  const destFile = path.join(process.cwd(), `.vscode/${fileName}`);
30
44
  let destFileData;
31
45
  let isDestFileHaveOverride;
32
46
  try {
33
- destFileData = await readFile(destFile, 'utf8');
34
- isDestFileHaveOverride = destFileData.includes('// override');
47
+ destFileData = await readFile(destFile, "utf8");
48
+ isDestFileHaveOverride = destFileData.includes("// override");
35
49
  } catch (err) {}
36
50
 
37
51
  let result;
@@ -50,5 +64,5 @@ try {
50
64
  }
51
65
  });
52
66
  } catch (err) {
53
- console.error('Ошибка:', err.message);
67
+ console.error("Ошибка:", err.message);
54
68
  }
@@ -11,6 +11,8 @@
11
11
  },
12
12
  "template for todo comments for easy search in project": {
13
13
  "prefix": "t todo",
14
- "body": ["$LINE_COMMENT TODO: "],
14
+ "body": [
15
+ "$LINE_COMMENT TODO: ",
16
+ ],
15
17
  },
16
18
  }
@@ -1,15 +1,29 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import path from 'path';
4
- import { readFile } from 'fs/promises';
5
- import { getSrcJSONFileData } from '../utils/file.js';
6
- import { mergeWithOverride } from '../utils/merge.js';
7
- import { getHeader } from '../utils/file-header.js';
8
- import { getEnvs } from '../utils/env.js';
9
- import { outputFile } from 'fs-extra';
10
- import { eslintFiles } from '../utils/lint.js';
3
+ import path from "path";
4
+ import {
5
+ readFile,
6
+ } from "fs/promises";
7
+ import {
8
+ getSrcJSONFileData,
9
+ } from "../utils/file.js";
10
+ import {
11
+ mergeWithOverride,
12
+ } from "../utils/merge.js";
13
+ import {
14
+ getHeader,
15
+ } from "../utils/file-header.js";
16
+ import {
17
+ getEnvs,
18
+ } from "../utils/env.js";
19
+ import {
20
+ outputFile,
21
+ } from "fs-extra";
22
+ import {
23
+ eslintFiles,
24
+ } from "../utils/lint.js";
11
25
 
12
- const fileName = 'extensions.json';
26
+ const fileName = "extensions.json";
13
27
  const destFile = path.join(process.cwd(), `.vscode/${fileName}`);
14
28
 
15
29
  try {
@@ -22,8 +36,8 @@ try {
22
36
  });
23
37
  let overrideContent;
24
38
  try {
25
- const fileData = await readFile(destFile, 'utf8');
26
- overrideContent = fileData.includes('// override') ? fileData : undefined;
39
+ const fileData = await readFile(destFile, "utf8");
40
+ overrideContent = fileData.includes("// override") ? fileData : undefined;
27
41
  } catch (err) {}
28
42
 
29
43
  let result;
@@ -41,5 +55,5 @@ try {
41
55
  console.info(`${fileName} пересоздан`);
42
56
  }
43
57
  } catch (err) {
44
- console.error('Ошибка:', err.message);
58
+ console.error("Ошибка:", err.message);
45
59
  }
@@ -1,15 +1,29 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import path from 'path';
4
- import { readFile } from 'fs/promises';
5
- import { getSrcJSONFileData } from '../utils/file.js';
6
- import { mergeWithOverride } from '../utils/merge.js';
7
- import { getHeader } from '../utils/file-header.js';
8
- import { getEnvs } from '../utils/env.js';
9
- import { outputFile } from 'fs-extra';
10
- import { eslintFiles } from '../utils/lint.js';
3
+ import path from "path";
4
+ import {
5
+ readFile,
6
+ } from "fs/promises";
7
+ import {
8
+ getSrcJSONFileData,
9
+ } from "../utils/file.js";
10
+ import {
11
+ mergeWithOverride,
12
+ } from "../utils/merge.js";
13
+ import {
14
+ getHeader,
15
+ } from "../utils/file-header.js";
16
+ import {
17
+ getEnvs,
18
+ } from "../utils/env.js";
19
+ import {
20
+ outputFile,
21
+ } from "fs-extra";
22
+ import {
23
+ eslintFiles,
24
+ } from "../utils/lint.js";
11
25
 
12
- const fileName = 'settings.json';
26
+ const fileName = "settings.json";
13
27
  const destFile = path.join(process.cwd(), `.vscode/${fileName}`);
14
28
 
15
29
  try {
@@ -22,8 +36,8 @@ try {
22
36
  });
23
37
  let overrideContent;
24
38
  try {
25
- const fileData = await readFile(destFile, 'utf8');
26
- overrideContent = fileData.includes('// override') ? fileData : undefined;
39
+ const fileData = await readFile(destFile, "utf8");
40
+ overrideContent = fileData.includes("// override") ? fileData : undefined;
27
41
  } catch (err) {}
28
42
 
29
43
  let result;
@@ -41,5 +55,5 @@ try {
41
55
  console.info(`${fileName} пересоздан`);
42
56
  }
43
57
  } catch (err) {
44
- console.error('Ошибка:', err.message);
58
+ console.error("Ошибка:", err.message);
45
59
  }
@@ -17,7 +17,7 @@
17
17
  "<script setup lang=\"ts\">",
18
18
  "</script>",
19
19
  "",
20
- "<template>",
20
+ "<template>",
21
21
  "</template>",
22
22
  "",
23
23
  "<style scoped lang=\"scss\">",
package/env.json5.set.js CHANGED
@@ -1,7 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { askFramework, askTypescript } from './utils/communication.js';
4
- import { getEnvs, setEnvs } from './utils/env.js';
3
+ import {
4
+ askFramework, askTypescript,
5
+ } from "./utils/communication.js";
6
+ import {
7
+ getEnvs, setEnvs,
8
+ } from "./utils/env.js";
5
9
 
6
10
  let envs = {};
7
11
  try {
package/jsconfig.json CHANGED
@@ -1,3 +1,5 @@
1
1
  {
2
- "exclude": ["node_modules"]
2
+ "exclude": [
3
+ "node_modules"
4
+ ]
3
5
  }
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.13",
4
+ "version": "1.0.15",
5
5
  "type": "module",
6
6
  "devEngines": {
7
7
  "packageManager": {
@@ -55,8 +55,8 @@
55
55
  "@stylistic/stylelint-plugin": "5.2.1",
56
56
  "@typescript-eslint/eslint-plugin": "^8.66.0",
57
57
  "@typescript-eslint/parser": "^8.66.0",
58
- "eslint": "^10.8.1",
59
- "eslint-plugin-jsonc": "^3.4.1",
58
+ "eslint": "^10.9.1",
59
+ "eslint-plugin-jsonc": "^3.4.2",
60
60
  "eslint-plugin-vue": "^10.10.0",
61
61
  "fs-extra": "^11.4.0",
62
62
  "globals": "^17.9.0",
@@ -1,20 +1,26 @@
1
- import { defineConfig } from 'eslint/config';
2
- import { includeIgnoreFile } from '@eslint/config-helpers';
3
- import path from 'path';
4
- import globals from 'globals';
1
+ import {
2
+ defineConfig,
3
+ } from "eslint/config";
4
+ import {
5
+ includeIgnoreFile,
6
+ } from "@eslint/config-helpers";
7
+ import path from "path";
8
+ import globals from "globals";
5
9
 
6
- const gitignorePath = path.join(process.cwd(), '.gitignore');
10
+ const gitignorePath = path.join(process.cwd(), ".gitignore");
7
11
 
8
12
  export default defineConfig([
9
13
  includeIgnoreFile(gitignorePath),
10
14
  {
11
- name: 'Additional .gitignore patterns',
12
- ignores: ['public/js/*'],
15
+ name: "Additional .gitignore patterns",
16
+ ignores: [
17
+ "public/js/*",
18
+ ],
13
19
  },
14
20
  {
15
21
  files: [
16
- '**/*.*js',
17
- '**/*.*vue',
22
+ "**/*.*js",
23
+ "**/*.*vue",
18
24
  ],
19
25
  languageOptions: {
20
26
  globals: {
@@ -1,17 +1,23 @@
1
- import stylisticPlugin from '@stylistic/eslint-plugin';
1
+ import stylisticPlugin from "@stylistic/eslint-plugin";
2
2
 
3
- import { jsRules } from '../rules/javascript/index.js';
4
- import { jsFormatting } from '../rules/stylistic/index.js';
3
+ import {
4
+ jsRules,
5
+ } from "../rules/javascript/index.js";
6
+ import {
7
+ jsFormatting,
8
+ } from "../rules/stylistic/index.js";
5
9
 
6
10
  export default {
7
- files: ['**/*.*js'],
11
+ files: [
12
+ "**/*.*js",
13
+ ],
8
14
  plugins: {
9
- '@stylistic': stylisticPlugin,
15
+ "@stylistic": stylisticPlugin,
10
16
  },
11
17
  languageOptions: {
12
- sourceType: 'module',
18
+ sourceType: "module",
13
19
  parserOptions: {
14
- sourceType: 'module',
20
+ sourceType: "module",
15
21
  },
16
22
  },
17
23
  rules: {