@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.
- package/.editorconfig-get.js +12 -6
- package/.get-all.js +18 -12
- package/.gitattributes-get.js +12 -6
- package/.gitignore-get.js +28 -14
- package/.vscode/.code-snippets-get.js +28 -14
- package/.vscode/all-files.code-snippets +3 -1
- package/.vscode/extensions.json-get.js +26 -12
- package/.vscode/settings.json-get.js +26 -12
- package/.vscode/vue.code-snippets +1 -1
- package/env.json5.set.js +6 -2
- package/jsconfig.json +3 -1
- package/package.json +3 -3
- package/tools/eslint-config/configs/global.js +15 -9
- package/tools/eslint-config/configs/javascript.js +13 -7
- package/tools/eslint-config/configs/json.js +115 -57
- package/tools/eslint-config/configs/typescript.js +17 -9
- package/tools/eslint-config/configs/vue.js +41 -17
- package/tools/eslint-config/index.js +15 -5
- package/tools/eslint-config/rules/constants.js +1 -1
- package/tools/eslint-config/rules/javascript/index.js +6 -2
- package/tools/eslint-config/rules/javascript/possible-problems.js +193 -75
- package/tools/eslint-config/rules/javascript/suggestions.js +450 -225
- package/tools/eslint-config/rules/severity.js +3 -3
- package/tools/eslint-config/rules/stylistic/index.js +6 -2
- package/tools/eslint-config/rules/stylistic/jsFormatting.js +230 -148
- package/tools/eslint-config/rules/stylistic/tsFormatting.js +15 -5
- package/tools/eslint-config/rules/typescript/common.js +107 -103
- package/tools/eslint-config/rules/typescript/compatibility.js +23 -21
- package/tools/eslint-config/rules/typescript/extension.js +52 -46
- package/tools/eslint-config/rules/typescript/index.js +9 -3
- package/tools/eslint-config/rules/vue/base.js +9 -3
- package/tools/eslint-config/rules/vue/extension.js +60 -45
- package/tools/eslint-config/rules/vue/formatting.js +63 -35
- package/tools/eslint-config/rules/vue/index.js +15 -5
- package/tools/eslint-config/rules/vue/possibleProblems.js +272 -124
- package/tools/eslint-config/rules/vue/suggestions.js +228 -78
- package/tools/stylelint-config/config.js +17 -11
- package/tools/stylelint-config/rules/base.js +21 -19
- package/tools/stylelint-config/rules/conflicts.js +2 -2
- package/tools/stylelint-config/rules/order.js +25 -19
- package/tools/stylelint-config/rules/property-groups.js +339 -337
- package/tools/stylelint-config/rules/scss.js +6 -4
- package/tools/stylelint-config/rules/stylistic.js +84 -82
- package/utils/communication.js +3 -3
- package/utils/copy-with-override.js +31 -12
- package/utils/env.js +10 -6
- package/utils/file-header.js +10 -8
- package/utils/file.js +22 -14
- package/utils/lint.js +11 -3
- package/utils/merge.js +14 -12
package/.editorconfig-get.js
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import path from
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
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 =
|
|
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,
|
|
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 {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
spawnSync,
|
|
5
|
+
} from "child_process";
|
|
6
|
+
import {
|
|
7
|
+
readFile,
|
|
8
|
+
} from "fs/promises";
|
|
5
9
|
|
|
6
10
|
const commands = [
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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(
|
|
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(
|
|
21
|
-
|
|
24
|
+
const result = spawnSync("npx", [
|
|
25
|
+
"-p",
|
|
22
26
|
pkg.name,
|
|
23
27
|
cmd,
|
|
24
|
-
], {
|
|
28
|
+
], {
|
|
29
|
+
stdio: "inherit",
|
|
30
|
+
});
|
|
25
31
|
if (result.status !== 0) {
|
|
26
32
|
console.error(`\nОшибка при выполнении команды: ${cmd}`);
|
|
27
33
|
hasError = true;
|
package/.gitattributes-get.js
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import path from
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
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 =
|
|
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,
|
|
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
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import {
|
|
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 =
|
|
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,
|
|
15
|
-
const srcFileData = await readFile(src,
|
|
22
|
+
const src = path.join(dirname, ".npmignore");
|
|
23
|
+
const srcFileData = await readFile(src, "utf8");
|
|
16
24
|
|
|
17
|
-
const [
|
|
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 [
|
|
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(
|
|
34
|
-
return `${commonData.trim()}\n\n# ${header}\n${body.join(
|
|
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 {
|
|
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(
|
|
63
|
+
console.error("Ошибка:", err.message);
|
|
50
64
|
}
|
|
@@ -1,17 +1,31 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import path from
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import {
|
|
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
|
-
|
|
14
|
-
|
|
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 ===
|
|
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,
|
|
34
|
-
isDestFileHaveOverride = destFileData.includes(
|
|
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(
|
|
67
|
+
console.error("Ошибка:", err.message);
|
|
54
68
|
}
|
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import path from
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import {
|
|
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 =
|
|
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,
|
|
26
|
-
overrideContent = fileData.includes(
|
|
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(
|
|
58
|
+
console.error("Ошибка:", err.message);
|
|
45
59
|
}
|
|
@@ -1,15 +1,29 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import path from
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import {
|
|
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 =
|
|
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,
|
|
26
|
-
overrideContent = fileData.includes(
|
|
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(
|
|
58
|
+
console.error("Ошибка:", err.message);
|
|
45
59
|
}
|
package/env.json5.set.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
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
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.
|
|
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.
|
|
59
|
-
"eslint-plugin-jsonc": "^3.4.
|
|
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 {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
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(),
|
|
10
|
+
const gitignorePath = path.join(process.cwd(), ".gitignore");
|
|
7
11
|
|
|
8
12
|
export default defineConfig([
|
|
9
13
|
includeIgnoreFile(gitignorePath),
|
|
10
14
|
{
|
|
11
|
-
name:
|
|
12
|
-
ignores: [
|
|
15
|
+
name: "Additional .gitignore patterns",
|
|
16
|
+
ignores: [
|
|
17
|
+
"public/js/*",
|
|
18
|
+
],
|
|
13
19
|
},
|
|
14
20
|
{
|
|
15
21
|
files: [
|
|
16
|
-
|
|
17
|
-
|
|
22
|
+
"**/*.*js",
|
|
23
|
+
"**/*.*vue",
|
|
18
24
|
],
|
|
19
25
|
languageOptions: {
|
|
20
26
|
globals: {
|
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
import stylisticPlugin from
|
|
1
|
+
import stylisticPlugin from "@stylistic/eslint-plugin";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
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: [
|
|
11
|
+
files: [
|
|
12
|
+
"**/*.*js",
|
|
13
|
+
],
|
|
8
14
|
plugins: {
|
|
9
|
-
|
|
15
|
+
"@stylistic": stylisticPlugin,
|
|
10
16
|
},
|
|
11
17
|
languageOptions: {
|
|
12
|
-
sourceType:
|
|
18
|
+
sourceType: "module",
|
|
13
19
|
parserOptions: {
|
|
14
|
-
sourceType:
|
|
20
|
+
sourceType: "module",
|
|
15
21
|
},
|
|
16
22
|
},
|
|
17
23
|
rules: {
|