@cherepanov.pavel/shareable-config 1.0.14 → 1.0.16

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 (46) hide show
  1. package/.editorconfig-get.js +9 -3
  2. package/.get-all.js +9 -3
  3. package/.gitattributes-get.js +9 -3
  4. package/.gitignore-get.js +21 -7
  5. package/.vscode/.code-snippets-get.js +21 -7
  6. package/.vscode/all-files.code-snippets +3 -1
  7. package/.vscode/extensions.json-get.js +21 -7
  8. package/.vscode/settings.json-get.js +21 -7
  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 +5 -4
  13. package/tools/eslint-config/configs/global.js +9 -3
  14. package/tools/eslint-config/configs/javascript.js +9 -3
  15. package/tools/eslint-config/configs/json.js +66 -8
  16. package/tools/eslint-config/configs/typescript.js +12 -4
  17. package/tools/eslint-config/configs/vue.js +33 -9
  18. package/tools/eslint-config/index.js +15 -5
  19. package/tools/eslint-config/rules/javascript/index.js +6 -2
  20. package/tools/eslint-config/rules/javascript/possible-problems.js +176 -58
  21. package/tools/eslint-config/rules/javascript/suggestions.js +341 -115
  22. package/tools/eslint-config/rules/stylistic/index.js +6 -2
  23. package/tools/eslint-config/rules/stylistic/jsFormatting.js +133 -50
  24. package/tools/eslint-config/rules/stylistic/tsFormatting.js +15 -5
  25. package/tools/eslint-config/rules/typescript/common.js +6 -2
  26. package/tools/eslint-config/rules/typescript/compatibility.js +3 -1
  27. package/tools/eslint-config/rules/typescript/extension.js +9 -3
  28. package/tools/eslint-config/rules/typescript/index.js +9 -3
  29. package/tools/eslint-config/rules/vue/base.js +9 -3
  30. package/tools/eslint-config/rules/vue/extension.js +21 -7
  31. package/tools/eslint-config/rules/vue/formatting.js +48 -16
  32. package/tools/eslint-config/rules/vue/index.js +15 -5
  33. package/tools/eslint-config/rules/vue/possibleProblems.js +221 -73
  34. package/tools/eslint-config/rules/vue/suggestions.js +224 -74
  35. package/tools/stylelint-config/config.js +9 -3
  36. package/tools/stylelint-config/rules/base.js +3 -1
  37. package/tools/stylelint-config/rules/order.js +9 -3
  38. package/tools/stylelint-config/rules/property-groups.js +3 -1
  39. package/tools/stylelint-config/rules/scss.js +3 -1
  40. package/tools/stylelint-config/rules/stylistic.js +3 -1
  41. package/utils/copy-with-override.js +26 -7
  42. package/utils/env.js +6 -2
  43. package/utils/file-header.js +3 -1
  44. package/utils/file.js +12 -4
  45. package/utils/lint.js +11 -3
  46. package/utils/merge.js +3 -1
@@ -1,9 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
 
3
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";
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
14
  const fileName = ".editorconfig";
9
15
  const destFile = path.join(process.cwd(), fileName);
package/.get-all.js CHANGED
@@ -1,7 +1,11 @@
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
11
  "get-editorconfig",
@@ -21,7 +25,9 @@ commands.forEach((cmd) => {
21
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,9 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
 
3
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";
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
14
  const fileName = ".gitattributes";
9
15
  const destFile = path.join(process.cwd(), fileName);
package/.gitignore-get.js CHANGED
@@ -1,10 +1,18 @@
1
1
  #!/usr/bin/env node
2
2
 
3
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";
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
17
  const fileName = ".gitignore";
10
18
  const destFile = path.join(process.cwd(), fileName);
@@ -14,7 +22,9 @@ async function getGitignoreFileData(framework) {
14
22
  const src = path.join(dirname, ".npmignore");
15
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
 
@@ -38,7 +50,9 @@ async function getGitignoreFileData(framework) {
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,
@@ -1,13 +1,27 @@
1
1
  #!/usr/bin/env node
2
2
 
3
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";
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
27
  "vue.code-snippets",
@@ -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,13 +1,27 @@
1
1
  #!/usr/bin/env node
2
2
 
3
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";
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
26
  const fileName = "extensions.json";
13
27
  const destFile = path.join(process.cwd(), `.vscode/${fileName}`);
@@ -1,13 +1,27 @@
1
1
  #!/usr/bin/env node
2
2
 
3
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";
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
26
  const fileName = "settings.json";
13
27
  const destFile = path.join(process.cwd(), `.vscode/${fileName}`);
@@ -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.14",
4
+ "version": "1.0.16",
5
5
  "type": "module",
6
6
  "devEngines": {
7
7
  "packageManager": {
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "scripts": {
45
45
  "lint": "run-p -lc lint:js lint:css",
46
- "lint:fix": "run-p -lc lint:js:fix lint:css:fix lint:types",
46
+ "lint:fix": "run-p -lc lint:js:fix lint:css:fix",
47
47
  "lint:js": "eslint",
48
48
  "lint:js:fix": "npm run lint:js -- --fix",
49
49
  "lint:css": "stylelint \"./**/*.{css,vue}\" --ignore-path .gitignore --formatter verbose",
@@ -55,13 +55,14 @@
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",
63
63
  "jiti": "^2.7.0",
64
64
  "json5": "^2.2.3",
65
+ "npm-run-all2": "^9.0.3",
65
66
  "postcss-html": "^2.0.0",
66
67
  "stylelint": "^17.14.1",
67
68
  "stylelint-config-standard": "^40.0.0",
@@ -1,5 +1,9 @@
1
- import { defineConfig } from "eslint/config";
2
- import { includeIgnoreFile } from "@eslint/config-helpers";
1
+ import {
2
+ defineConfig,
3
+ } from "eslint/config";
4
+ import {
5
+ includeIgnoreFile,
6
+ } from "@eslint/config-helpers";
3
7
  import path from "path";
4
8
  import globals from "globals";
5
9
 
@@ -9,7 +13,9 @@ export default defineConfig([
9
13
  includeIgnoreFile(gitignorePath),
10
14
  {
11
15
  name: "Additional .gitignore patterns",
12
- ignores: ["public/js/*"],
16
+ ignores: [
17
+ "public/js/*",
18
+ ],
13
19
  },
14
20
  {
15
21
  files: [
@@ -1,10 +1,16 @@
1
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
15
  "@stylistic": stylisticPlugin,
10
16
  },
@@ -1,9 +1,19 @@
1
- import { defineConfig } from "eslint/config";
1
+ import {
2
+ defineConfig,
3
+ } from "eslint/config";
2
4
  import jsonc from "eslint-plugin-jsonc";
3
- import { ERROR } from "../rules/severity.js";
4
- import { jsFormatting } from "../rules/stylistic/index.js";
5
- import { possibleProblemRules } from "../rules/javascript/possible-problems.js";
6
- import { suggestionRules } from "../rules/javascript/suggestions.js";
5
+ import {
6
+ ERROR,
7
+ } from "../rules/severity.js";
8
+ import {
9
+ jsFormatting,
10
+ } from "../rules/stylistic/index.js";
11
+ import {
12
+ possibleProblemRules,
13
+ } from "../rules/javascript/possible-problems.js";
14
+ import {
15
+ suggestionRules,
16
+ } from "../rules/javascript/suggestions.js";
7
17
  import stylisticPlugin from "@stylistic/eslint-plugin";
8
18
 
9
19
  const JSON_BUT_JSONC_FILES = [
@@ -45,6 +55,48 @@ const COMMON_RULES = {
45
55
  "jsonc/no-octal": suggestionRules["no-octal"],
46
56
  "jsonc/no-sparse-arrays": ERROR,
47
57
  "jsonc/no-useless-escape": suggestionRules["no-useless-escape"],
58
+ "jsonc/object-curly-newline": [
59
+ jsFormatting["@stylistic/object-curly-newline"][0],
60
+ {
61
+ "ObjectExpression": {
62
+ multiline: false,
63
+ minProperties: 1,
64
+ },
65
+ "ObjectPattern": {
66
+ multiline: false,
67
+ minProperties: 1,
68
+ },
69
+ "ImportDeclaration": {
70
+ multiline: false,
71
+ minProperties: 1,
72
+ },
73
+ "ExportDeclaration": {
74
+ multiline: false,
75
+ minProperties: 1,
76
+ },
77
+ },
78
+ // Object.fromEntries(
79
+ // [
80
+ // "ObjectExpression",
81
+ // "ObjectPattern",
82
+ // "ImportDeclaration",
83
+ // "ExportDeclaration"
84
+ // ].map(key => [key, ["@stylistic/object-curly-newline"][1][key]])
85
+ // )
86
+ ],
87
+ "jsonc/object-curly-spacing": [
88
+ jsFormatting["@stylistic/object-curly-spacing"][0],
89
+ jsFormatting["@stylistic/object-curly-spacing"][1],
90
+ {
91
+ "arraysInObjects": true,
92
+ "objectsInObjects": true,
93
+ "emptyObjects": jsFormatting["@stylistic/object-curly-spacing"][1],
94
+ },
95
+ ],
96
+ "jsonc/object-property-newline": jsFormatting["@stylistic/object-property-newline"],
97
+ "jsonc/quote-props": ERROR,
98
+ "jsonc/quotes": jsFormatting["@stylistic/quotes"],
99
+ "jsonc/space-unary-ops": ERROR,
48
100
  };
49
101
  const JSON_RULES = {
50
102
  "jsonc/no-comments": ERROR,
@@ -68,7 +120,9 @@ export default defineConfig([
68
120
  },
69
121
 
70
122
  {
71
- files: ["**/*.json"],
123
+ files: [
124
+ "**/*.json",
125
+ ],
72
126
  ignores: [
73
127
  ...JSON_BUT_JSONC_FILES,
74
128
  "package-lock.json",
@@ -94,14 +148,18 @@ export default defineConfig([
94
148
  },
95
149
 
96
150
  {
97
- files: ["**/*.json5"],
151
+ files: [
152
+ "**/*.json5",
153
+ ],
98
154
  language: "jsonc/json5",
99
155
  rules: {
100
156
  ...COMMON_RULES,
101
157
  },
102
158
  },
103
159
  {
104
- files: ["**/*.vue"],
160
+ files: [
161
+ "**/*.vue",
162
+ ],
105
163
  rules: {
106
164
  "jsonc/vue-custom-block/no-parsing-error": ERROR,
107
165
  },
@@ -1,14 +1,22 @@
1
1
  import tsPlugin from "@typescript-eslint/eslint-plugin";
2
2
  import stylisticPlugin from "@stylistic/eslint-plugin";
3
3
 
4
- import { tsRules } from "../rules/typescript/index.js";
5
- import { jsFormatting, tsFormatting } from "../rules/stylistic/index.js";
4
+ import {
5
+ tsRules,
6
+ } from "../rules/typescript/index.js";
7
+ import {
8
+ jsFormatting, tsFormatting,
9
+ } from "../rules/stylistic/index.js";
6
10
 
7
11
  import tsParser from "@typescript-eslint/parser";
8
- import { jsRules } from "../rules/javascript/index.js";
12
+ import {
13
+ jsRules,
14
+ } from "../rules/javascript/index.js";
9
15
 
10
16
  export default {
11
- files: ["**/*.{ts,mts,cts}"],
17
+ files: [
18
+ "**/*.{ts,mts,cts}",
19
+ ],
12
20
  plugins: {
13
21
  "@typescript-eslint": tsPlugin,
14
22
  "@stylistic": stylisticPlugin,
@@ -1,8 +1,16 @@
1
- import { vueRules } from "../rules/vue/index.js";
2
- import { jsRules } from "../rules/javascript/index.js";
3
- import { tsRules } from "../rules/typescript/index.js";
1
+ import {
2
+ vueRules,
3
+ } from "../rules/vue/index.js";
4
+ import {
5
+ jsRules,
6
+ } from "../rules/javascript/index.js";
7
+ import {
8
+ tsRules,
9
+ } from "../rules/typescript/index.js";
4
10
 
5
- import { jsFormatting, tsFormatting } from "../rules/stylistic/index.js";
11
+ import {
12
+ jsFormatting, tsFormatting,
13
+ } from "../rules/stylistic/index.js";
6
14
 
7
15
  import vuePlugin from "eslint-plugin-vue";
8
16
  import tsPlugin from "@typescript-eslint/eslint-plugin";
@@ -10,7 +18,9 @@ import stylisticPlugin from "@stylistic/eslint-plugin";
10
18
 
11
19
  import vueParser from "vue-eslint-parser";
12
20
  import tsParser from "@typescript-eslint/parser";
13
- import { getEnvs } from "../../../utils/env.js";
21
+ import {
22
+ getEnvs,
23
+ } from "../../../utils/env.js";
14
24
 
15
25
  // https://github.com/sveltejs/eslint-plugin-svelte/issues/152#issuecomment-1150803175
16
26
  const {
@@ -18,19 +28,33 @@ const {
18
28
  } = await getEnvs();
19
29
 
20
30
  export default {
21
- files: ["**/*.vue"],
31
+ files: [
32
+ "**/*.vue",
33
+ ],
22
34
  plugins: {
23
35
  "vue": vuePlugin,
24
36
  "@stylistic": stylisticPlugin,
25
37
 
26
- ...(isTs ? { "@typescript-eslint": tsPlugin } : {}),
38
+ ...(
39
+ isTs
40
+ ? {
41
+ "@typescript-eslint": tsPlugin,
42
+ }
43
+ : {}),
27
44
  },
28
45
  languageOptions: {
29
46
  parser: vueParser,
30
47
  parserOptions: {
31
48
  parser: isTs ? tsParser : "espree",
32
- ...(isTs ? { projectService: true } : {}),
33
- extraFileExtensions: [".vue"],
49
+ ...(
50
+ isTs
51
+ ? {
52
+ projectService: true,
53
+ }
54
+ : {}),
55
+ extraFileExtensions: [
56
+ ".vue",
57
+ ],
34
58
  },
35
59
  },
36
60
  rules: {
@@ -1,5 +1,15 @@
1
- export { default as globalConfig } from "./configs/global.js";
2
- export { default as jsonConfig } from "./configs/json.js";
3
- export { default as vueConfig } from "./configs/vue.js";
4
- export { default as jsConfig } from "./configs/javascript.js";
5
- export { default as tsConfig } from "./configs/typescript.js";
1
+ export {
2
+ default as globalConfig,
3
+ } from "./configs/global.js";
4
+ export {
5
+ default as jsonConfig,
6
+ } from "./configs/json.js";
7
+ export {
8
+ default as vueConfig,
9
+ } from "./configs/vue.js";
10
+ export {
11
+ default as jsConfig,
12
+ } from "./configs/javascript.js";
13
+ export {
14
+ default as tsConfig,
15
+ } from "./configs/typescript.js";
@@ -1,5 +1,9 @@
1
- import { possibleProblemRules } from "./possible-problems.js";
2
- import { suggestionRules } from "./suggestions.js";
1
+ import {
2
+ possibleProblemRules,
3
+ } from "./possible-problems.js";
4
+ import {
5
+ suggestionRules,
6
+ } from "./suggestions.js";
3
7
 
4
8
  export const jsRules = {
5
9
  ...possibleProblemRules,