@cherepanov.pavel/shareable-config 1.0.12 → 1.0.14
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 +6 -6
- package/.get-all.js +12 -12
- package/.gitattributes-get.js +6 -6
- package/.gitignore-get.js +12 -12
- package/.vscode/.code-snippets-get.js +14 -14
- package/.vscode/extensions.json-get.js +12 -12
- package/.vscode/settings.json-get.js +12 -12
- package/env.json5.set.js +2 -2
- package/package.json +1 -1
- package/tools/eslint-config/configs/global.js +9 -9
- package/tools/eslint-config/configs/javascript.js +7 -7
- package/tools/eslint-config/configs/json.js +57 -57
- package/tools/eslint-config/configs/typescript.js +9 -9
- package/tools/eslint-config/configs/vue.js +16 -16
- package/tools/eslint-config/index.js +5 -5
- package/tools/eslint-config/rules/constants.js +1 -1
- package/tools/eslint-config/rules/javascript/index.js +2 -2
- package/tools/eslint-config/rules/javascript/possible-problems.js +60 -60
- package/tools/eslint-config/rules/javascript/suggestions.js +206 -207
- package/tools/eslint-config/rules/severity.js +3 -3
- package/tools/eslint-config/rules/stylistic/index.js +2 -2
- package/tools/eslint-config/rules/stylistic/jsFormatting.js +113 -114
- package/tools/eslint-config/rules/stylistic/tsFormatting.js +5 -5
- package/tools/eslint-config/rules/typescript/common.js +103 -103
- package/tools/eslint-config/rules/typescript/compatibility.js +21 -21
- package/tools/eslint-config/rules/typescript/extension.js +46 -46
- package/tools/eslint-config/rules/typescript/index.js +3 -3
- package/tools/eslint-config/rules/vue/base.js +3 -3
- package/tools/eslint-config/rules/vue/extension.js +46 -45
- package/tools/eslint-config/rules/vue/formatting.js +33 -37
- package/tools/eslint-config/rules/vue/index.js +5 -5
- package/tools/eslint-config/rules/vue/possibleProblems.js +123 -123
- package/tools/eslint-config/rules/vue/suggestions.js +76 -76
- package/tools/stylelint-config/config.js +11 -11
- package/tools/stylelint-config/rules/base.js +19 -19
- package/tools/stylelint-config/rules/conflicts.js +2 -2
- package/tools/stylelint-config/rules/order.js +19 -19
- package/tools/stylelint-config/rules/property-groups.js +337 -337
- package/tools/stylelint-config/rules/scss.js +4 -4
- package/tools/stylelint-config/rules/stylistic.js +82 -82
- package/utils/communication.js +3 -3
- package/utils/copy-with-override.js +9 -9
- package/utils/env.js +6 -6
- package/utils/file-header.js +8 -8
- package/utils/file.js +13 -13
- package/utils/lint.js +2 -2
- package/utils/merge.js +11 -11
package/.editorconfig-get.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import path from
|
|
4
|
-
import { fileURLToPath } from
|
|
5
|
-
import { copyWithOverride } from
|
|
6
|
-
import { readFile } from
|
|
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";
|
|
7
7
|
|
|
8
|
-
const fileName =
|
|
8
|
+
const fileName = ".editorconfig";
|
|
9
9
|
const destFile = path.join(process.cwd(), fileName);
|
|
10
10
|
|
|
11
11
|
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
12
12
|
const src = path.join(dirname, fileName);
|
|
13
|
-
const srcFileData = await readFile(src,
|
|
13
|
+
const srcFileData = await readFile(src, "utf8");
|
|
14
14
|
|
|
15
15
|
copyWithOverride({
|
|
16
16
|
destFile,
|
package/.get-all.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { spawnSync } from
|
|
4
|
-
import { readFile } from
|
|
3
|
+
import { spawnSync } from "child_process";
|
|
4
|
+
import { readFile } from "fs/promises";
|
|
5
5
|
|
|
6
6
|
const commands = [
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
"get-editorconfig",
|
|
8
|
+
"get-gitattributes",
|
|
9
|
+
"get-gitignore",
|
|
10
|
+
"get-extensions",
|
|
11
|
+
"get-settings",
|
|
12
|
+
"get-code-snippets",
|
|
13
13
|
];
|
|
14
14
|
|
|
15
15
|
let hasError = false;
|
|
16
16
|
|
|
17
|
-
const pkg = JSON.parse(await readFile(new URL(
|
|
17
|
+
const pkg = JSON.parse(await readFile(new URL("./package.json", import.meta.url), "utf8"));
|
|
18
18
|
|
|
19
19
|
commands.forEach((cmd) => {
|
|
20
|
-
const result = spawnSync(
|
|
21
|
-
|
|
20
|
+
const result = spawnSync("npx", [
|
|
21
|
+
"-p",
|
|
22
22
|
pkg.name,
|
|
23
23
|
cmd,
|
|
24
|
-
], { stdio:
|
|
24
|
+
], { stdio: "inherit" });
|
|
25
25
|
if (result.status !== 0) {
|
|
26
26
|
console.error(`\nОшибка при выполнении команды: ${cmd}`);
|
|
27
27
|
hasError = true;
|
package/.gitattributes-get.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import path from
|
|
4
|
-
import { fileURLToPath } from
|
|
5
|
-
import { copyWithOverride } from
|
|
6
|
-
import { readFile } from
|
|
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";
|
|
7
7
|
|
|
8
|
-
const fileName =
|
|
8
|
+
const fileName = ".gitattributes";
|
|
9
9
|
const destFile = path.join(process.cwd(), fileName);
|
|
10
10
|
|
|
11
11
|
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
12
12
|
const src = path.join(dirname, fileName);
|
|
13
|
-
const srcFileData = await readFile(src,
|
|
13
|
+
const srcFileData = await readFile(src, "utf8");
|
|
14
14
|
|
|
15
15
|
copyWithOverride({
|
|
16
16
|
destFile,
|
package/.gitignore-get.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import path from
|
|
4
|
-
import { fileURLToPath } from
|
|
5
|
-
import { readFile } from
|
|
6
|
-
import { copyWithOverride } from
|
|
7
|
-
import { getEnvs } from
|
|
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";
|
|
8
8
|
|
|
9
|
-
const fileName =
|
|
9
|
+
const fileName = ".gitignore";
|
|
10
10
|
const destFile = path.join(process.cwd(), fileName);
|
|
11
11
|
|
|
12
12
|
async function getGitignoreFileData(framework) {
|
|
13
13
|
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
14
|
-
const src = path.join(dirname,
|
|
15
|
-
const srcFileData = await readFile(src,
|
|
14
|
+
const src = path.join(dirname, ".npmignore");
|
|
15
|
+
const srcFileData = await readFile(src, "utf8");
|
|
16
16
|
|
|
17
17
|
const [commonData] = srcFileData.split(/^#\s*\w+/mu);
|
|
18
18
|
|
|
@@ -22,7 +22,7 @@ async function getGitignoreFileData(framework) {
|
|
|
22
22
|
|
|
23
23
|
const sections = srcFileData.split(/^#\s*/mu).slice(1);
|
|
24
24
|
const matchedSection = sections.find((section) => {
|
|
25
|
-
const [header] = section.split(
|
|
25
|
+
const [header] = section.split("\n");
|
|
26
26
|
return header.trim().toLowerCase() === framework;
|
|
27
27
|
});
|
|
28
28
|
|
|
@@ -30,8 +30,8 @@ async function getGitignoreFileData(framework) {
|
|
|
30
30
|
const [
|
|
31
31
|
header,
|
|
32
32
|
...body
|
|
33
|
-
] = matchedSection.split(
|
|
34
|
-
return `${commonData.trim()}\n\n# ${header}\n${body.join(
|
|
33
|
+
] = matchedSection.split("\n");
|
|
34
|
+
return `${commonData.trim()}\n\n# ${header}\n${body.join("\n").trim()}`.trim();
|
|
35
35
|
}
|
|
36
36
|
// Если не найдено — только общий контент
|
|
37
37
|
return commonData.trim();
|
|
@@ -46,5 +46,5 @@ try {
|
|
|
46
46
|
fileLabel: fileName,
|
|
47
47
|
});
|
|
48
48
|
} catch (err) {
|
|
49
|
-
console.error(
|
|
49
|
+
console.error("Ошибка:", err.message);
|
|
50
50
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import path from
|
|
4
|
-
import { readFile } from
|
|
5
|
-
import { outputFile } from
|
|
6
|
-
import { mergeWithOverride } from
|
|
7
|
-
import { getHeader } from
|
|
8
|
-
import { getSrcJSONFileData } from
|
|
9
|
-
import { getEnvs } from
|
|
10
|
-
import { eslintFiles } from
|
|
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";
|
|
11
11
|
|
|
12
12
|
const fileNames = [
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
"vue.code-snippets",
|
|
14
|
+
"all-files.code-snippets",
|
|
15
15
|
];
|
|
16
16
|
|
|
17
17
|
try {
|
|
@@ -23,15 +23,15 @@ try {
|
|
|
23
23
|
const srcFileData = await getSrcJSONFileData({
|
|
24
24
|
fileName,
|
|
25
25
|
isTs,
|
|
26
|
-
removeDuplicateKeys: fileName ===
|
|
26
|
+
removeDuplicateKeys: fileName === "vue.code-snippets",
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
const destFile = path.join(process.cwd(), `.vscode/${fileName}`);
|
|
30
30
|
let destFileData;
|
|
31
31
|
let isDestFileHaveOverride;
|
|
32
32
|
try {
|
|
33
|
-
destFileData = await readFile(destFile,
|
|
34
|
-
isDestFileHaveOverride = destFileData.includes(
|
|
33
|
+
destFileData = await readFile(destFile, "utf8");
|
|
34
|
+
isDestFileHaveOverride = destFileData.includes("// override");
|
|
35
35
|
} catch (err) {}
|
|
36
36
|
|
|
37
37
|
let result;
|
|
@@ -50,5 +50,5 @@ try {
|
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
} catch (err) {
|
|
53
|
-
console.error(
|
|
53
|
+
console.error("Ошибка:", err.message);
|
|
54
54
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import path from
|
|
4
|
-
import { readFile } from
|
|
5
|
-
import { getSrcJSONFileData } from
|
|
6
|
-
import { mergeWithOverride } from
|
|
7
|
-
import { getHeader } from
|
|
8
|
-
import { getEnvs } from
|
|
9
|
-
import { outputFile } from
|
|
10
|
-
import { eslintFiles } from
|
|
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";
|
|
11
11
|
|
|
12
|
-
const fileName =
|
|
12
|
+
const fileName = "extensions.json";
|
|
13
13
|
const destFile = path.join(process.cwd(), `.vscode/${fileName}`);
|
|
14
14
|
|
|
15
15
|
try {
|
|
@@ -22,8 +22,8 @@ try {
|
|
|
22
22
|
});
|
|
23
23
|
let overrideContent;
|
|
24
24
|
try {
|
|
25
|
-
const fileData = await readFile(destFile,
|
|
26
|
-
overrideContent = fileData.includes(
|
|
25
|
+
const fileData = await readFile(destFile, "utf8");
|
|
26
|
+
overrideContent = fileData.includes("// override") ? fileData : undefined;
|
|
27
27
|
} catch (err) {}
|
|
28
28
|
|
|
29
29
|
let result;
|
|
@@ -41,5 +41,5 @@ try {
|
|
|
41
41
|
console.info(`${fileName} пересоздан`);
|
|
42
42
|
}
|
|
43
43
|
} catch (err) {
|
|
44
|
-
console.error(
|
|
44
|
+
console.error("Ошибка:", err.message);
|
|
45
45
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import path from
|
|
4
|
-
import { readFile } from
|
|
5
|
-
import { getSrcJSONFileData } from
|
|
6
|
-
import { mergeWithOverride } from
|
|
7
|
-
import { getHeader } from
|
|
8
|
-
import { getEnvs } from
|
|
9
|
-
import { outputFile } from
|
|
10
|
-
import { eslintFiles } from
|
|
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";
|
|
11
11
|
|
|
12
|
-
const fileName =
|
|
12
|
+
const fileName = "settings.json";
|
|
13
13
|
const destFile = path.join(process.cwd(), `.vscode/${fileName}`);
|
|
14
14
|
|
|
15
15
|
try {
|
|
@@ -22,8 +22,8 @@ try {
|
|
|
22
22
|
});
|
|
23
23
|
let overrideContent;
|
|
24
24
|
try {
|
|
25
|
-
const fileData = await readFile(destFile,
|
|
26
|
-
overrideContent = fileData.includes(
|
|
25
|
+
const fileData = await readFile(destFile, "utf8");
|
|
26
|
+
overrideContent = fileData.includes("// override") ? fileData : undefined;
|
|
27
27
|
} catch (err) {}
|
|
28
28
|
|
|
29
29
|
let result;
|
|
@@ -41,5 +41,5 @@ try {
|
|
|
41
41
|
console.info(`${fileName} пересоздан`);
|
|
42
42
|
}
|
|
43
43
|
} catch (err) {
|
|
44
|
-
console.error(
|
|
44
|
+
console.error("Ошибка:", err.message);
|
|
45
45
|
}
|
package/env.json5.set.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { askFramework, askTypescript } from
|
|
4
|
-
import { getEnvs, setEnvs } from
|
|
3
|
+
import { askFramework, askTypescript } from "./utils/communication.js";
|
|
4
|
+
import { getEnvs, setEnvs } from "./utils/env.js";
|
|
5
5
|
|
|
6
6
|
let envs = {};
|
|
7
7
|
try {
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { defineConfig } from
|
|
2
|
-
import { includeIgnoreFile } from
|
|
3
|
-
import path from
|
|
4
|
-
import globals from
|
|
1
|
+
import { defineConfig } from "eslint/config";
|
|
2
|
+
import { includeIgnoreFile } from "@eslint/config-helpers";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import globals from "globals";
|
|
5
5
|
|
|
6
|
-
const gitignorePath = path.join(process.cwd(),
|
|
6
|
+
const gitignorePath = path.join(process.cwd(), ".gitignore");
|
|
7
7
|
|
|
8
8
|
export default defineConfig([
|
|
9
9
|
includeIgnoreFile(gitignorePath),
|
|
10
10
|
{
|
|
11
|
-
name:
|
|
12
|
-
ignores: [
|
|
11
|
+
name: "Additional .gitignore patterns",
|
|
12
|
+
ignores: ["public/js/*"],
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
files: [
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
"**/*.*js",
|
|
17
|
+
"**/*.*vue",
|
|
18
18
|
],
|
|
19
19
|
languageOptions: {
|
|
20
20
|
globals: {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import stylisticPlugin from
|
|
1
|
+
import stylisticPlugin from "@stylistic/eslint-plugin";
|
|
2
2
|
|
|
3
|
-
import { jsRules } from
|
|
4
|
-
import { jsFormatting } from
|
|
3
|
+
import { jsRules } from "../rules/javascript/index.js";
|
|
4
|
+
import { jsFormatting } from "../rules/stylistic/index.js";
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
|
-
files: [
|
|
7
|
+
files: ["**/*.*js"],
|
|
8
8
|
plugins: {
|
|
9
|
-
|
|
9
|
+
"@stylistic": stylisticPlugin,
|
|
10
10
|
},
|
|
11
11
|
languageOptions: {
|
|
12
|
-
sourceType:
|
|
12
|
+
sourceType: "module",
|
|
13
13
|
parserOptions: {
|
|
14
|
-
sourceType:
|
|
14
|
+
sourceType: "module",
|
|
15
15
|
},
|
|
16
16
|
},
|
|
17
17
|
rules: {
|
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
import { defineConfig } from
|
|
2
|
-
import jsonc from
|
|
3
|
-
import { ERROR } from
|
|
4
|
-
import { jsFormatting } from
|
|
5
|
-
import { possibleProblemRules } from
|
|
6
|
-
import { suggestionRules } from
|
|
7
|
-
import stylisticPlugin from
|
|
1
|
+
import { defineConfig } from "eslint/config";
|
|
2
|
+
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";
|
|
7
|
+
import stylisticPlugin from "@stylistic/eslint-plugin";
|
|
8
8
|
|
|
9
9
|
const JSON_BUT_JSONC_FILES = [
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
"**/.vscode/*.json",
|
|
11
|
+
"**/.vscode/*.code-snippets",
|
|
12
|
+
"**/tsconfig*.json",
|
|
13
13
|
];
|
|
14
14
|
const COMMON_RULES = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
jsFormatting[
|
|
38
|
-
jsFormatting[
|
|
15
|
+
"@stylistic/eol-last": jsFormatting["@stylistic/eol-last"],
|
|
16
|
+
"jsonc/no-bigint-literals": ERROR,
|
|
17
|
+
"jsonc/no-binary-expression": ERROR,
|
|
18
|
+
"jsonc/no-binary-numeric-literals": ERROR,
|
|
19
|
+
"jsonc/no-escape-sequence-in-identifier": ERROR,
|
|
20
|
+
"jsonc/no-hexadecimal-numeric-literals": ERROR,
|
|
21
|
+
"jsonc/no-nan": ERROR,
|
|
22
|
+
"jsonc/no-number-props": ERROR,
|
|
23
|
+
"jsonc/no-numeric-separators": ERROR,
|
|
24
|
+
"jsonc/no-octal-numeric-literals": ERROR,
|
|
25
|
+
"jsonc/no-parenthesized": ERROR,
|
|
26
|
+
"jsonc/no-plus-sign": ERROR,
|
|
27
|
+
"jsonc/no-regexp-literals": ERROR,
|
|
28
|
+
"jsonc/no-template-literals": ERROR,
|
|
29
|
+
"jsonc/no-undefined-value": ERROR,
|
|
30
|
+
"jsonc/no-unicode-codepoint-escapes": ERROR,
|
|
31
|
+
"jsonc/array-bracket-newline": jsFormatting["@stylistic/array-bracket-newline"],
|
|
32
|
+
"jsonc/array-bracket-spacing": jsFormatting["@stylistic/array-bracket-spacing"],
|
|
33
|
+
"jsonc/array-element-newline": jsFormatting["@stylistic/array-element-newline"],
|
|
34
|
+
"jsonc/comma-dangle": jsFormatting["@stylistic/comma-dangle"],
|
|
35
|
+
"jsonc/comma-style": jsFormatting["@stylistic/comma-style"],
|
|
36
|
+
"jsonc/indent": [
|
|
37
|
+
jsFormatting["@stylistic/indent"][0],
|
|
38
|
+
jsFormatting["@stylistic/indent"][1],
|
|
39
39
|
],
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
40
|
+
"jsonc/key-spacing": jsFormatting["@stylistic/key-spacing"],
|
|
41
|
+
"jsonc/no-dupe-keys": possibleProblemRules["no-dupe-keys"],
|
|
42
|
+
"jsonc/no-floating-decimal": jsFormatting["@stylistic/no-floating-decimal"],
|
|
43
|
+
"jsonc/no-irregular-whitespace": possibleProblemRules["no-irregular-whitespace"],
|
|
44
|
+
"jsonc/no-octal-escape": suggestionRules["no-octal-escape"],
|
|
45
|
+
"jsonc/no-octal": suggestionRules["no-octal"],
|
|
46
|
+
"jsonc/no-sparse-arrays": ERROR,
|
|
47
|
+
"jsonc/no-useless-escape": suggestionRules["no-useless-escape"],
|
|
48
48
|
};
|
|
49
49
|
const JSON_RULES = {
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
"jsonc/no-comments": ERROR,
|
|
51
|
+
"jsonc/comma-dangle": [
|
|
52
52
|
ERROR,
|
|
53
|
-
|
|
53
|
+
"never",
|
|
54
54
|
],
|
|
55
55
|
};
|
|
56
56
|
const JSON_JSONC_RULES = {
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
"jsonc/no-infinity": ERROR,
|
|
58
|
+
"jsonc/no-multi-str": suggestionRules["no-multi-str"],
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
export default defineConfig([
|
|
63
63
|
{
|
|
64
64
|
plugins: {
|
|
65
|
-
|
|
65
|
+
"@stylistic": stylisticPlugin,
|
|
66
66
|
jsonc,
|
|
67
67
|
},
|
|
68
68
|
},
|
|
69
69
|
|
|
70
70
|
{
|
|
71
|
-
files: [
|
|
71
|
+
files: ["**/*.json"],
|
|
72
72
|
ignores: [
|
|
73
73
|
...JSON_BUT_JSONC_FILES,
|
|
74
|
-
|
|
74
|
+
"package-lock.json",
|
|
75
75
|
],
|
|
76
|
-
language:
|
|
76
|
+
language: "jsonc/json",
|
|
77
77
|
rules: {
|
|
78
78
|
...COMMON_RULES,
|
|
79
79
|
...JSON_JSONC_RULES,
|
|
@@ -83,10 +83,10 @@ export default defineConfig([
|
|
|
83
83
|
|
|
84
84
|
{
|
|
85
85
|
files: [
|
|
86
|
-
|
|
86
|
+
"**/*.jsonc",
|
|
87
87
|
...JSON_BUT_JSONC_FILES,
|
|
88
88
|
],
|
|
89
|
-
language:
|
|
89
|
+
language: "jsonc/jsonc",
|
|
90
90
|
rules: {
|
|
91
91
|
...COMMON_RULES,
|
|
92
92
|
...JSON_JSONC_RULES,
|
|
@@ -94,16 +94,16 @@ export default defineConfig([
|
|
|
94
94
|
},
|
|
95
95
|
|
|
96
96
|
{
|
|
97
|
-
files: [
|
|
98
|
-
language:
|
|
97
|
+
files: ["**/*.json5"],
|
|
98
|
+
language: "jsonc/json5",
|
|
99
99
|
rules: {
|
|
100
100
|
...COMMON_RULES,
|
|
101
101
|
},
|
|
102
102
|
},
|
|
103
103
|
{
|
|
104
|
-
files: [
|
|
104
|
+
files: ["**/*.vue"],
|
|
105
105
|
rules: {
|
|
106
|
-
|
|
106
|
+
"jsonc/vue-custom-block/no-parsing-error": ERROR,
|
|
107
107
|
},
|
|
108
108
|
},
|
|
109
109
|
]);
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import tsPlugin from
|
|
2
|
-
import stylisticPlugin from
|
|
1
|
+
import tsPlugin from "@typescript-eslint/eslint-plugin";
|
|
2
|
+
import stylisticPlugin from "@stylistic/eslint-plugin";
|
|
3
3
|
|
|
4
|
-
import { tsRules } from
|
|
5
|
-
import { jsFormatting, tsFormatting } from
|
|
4
|
+
import { tsRules } from "../rules/typescript/index.js";
|
|
5
|
+
import { jsFormatting, tsFormatting } from "../rules/stylistic/index.js";
|
|
6
6
|
|
|
7
|
-
import tsParser from
|
|
8
|
-
import { jsRules } from
|
|
7
|
+
import tsParser from "@typescript-eslint/parser";
|
|
8
|
+
import { jsRules } from "../rules/javascript/index.js";
|
|
9
9
|
|
|
10
10
|
export default {
|
|
11
|
-
files: [
|
|
11
|
+
files: ["**/*.{ts,mts,cts}"],
|
|
12
12
|
plugins: {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
"@typescript-eslint": tsPlugin,
|
|
14
|
+
"@stylistic": stylisticPlugin,
|
|
15
15
|
},
|
|
16
16
|
languageOptions: {
|
|
17
17
|
parser: tsParser,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { vueRules } from
|
|
2
|
-
import { jsRules } from
|
|
3
|
-
import { tsRules } from
|
|
1
|
+
import { vueRules } from "../rules/vue/index.js";
|
|
2
|
+
import { jsRules } from "../rules/javascript/index.js";
|
|
3
|
+
import { tsRules } from "../rules/typescript/index.js";
|
|
4
4
|
|
|
5
|
-
import { jsFormatting, tsFormatting } from
|
|
5
|
+
import { jsFormatting, tsFormatting } from "../rules/stylistic/index.js";
|
|
6
6
|
|
|
7
|
-
import vuePlugin from
|
|
8
|
-
import tsPlugin from
|
|
9
|
-
import stylisticPlugin from
|
|
7
|
+
import vuePlugin from "eslint-plugin-vue";
|
|
8
|
+
import tsPlugin from "@typescript-eslint/eslint-plugin";
|
|
9
|
+
import stylisticPlugin from "@stylistic/eslint-plugin";
|
|
10
10
|
|
|
11
|
-
import vueParser from
|
|
12
|
-
import tsParser from
|
|
13
|
-
import { getEnvs } from
|
|
11
|
+
import vueParser from "vue-eslint-parser";
|
|
12
|
+
import tsParser from "@typescript-eslint/parser";
|
|
13
|
+
import { getEnvs } from "../../../utils/env.js";
|
|
14
14
|
|
|
15
15
|
// https://github.com/sveltejs/eslint-plugin-svelte/issues/152#issuecomment-1150803175
|
|
16
16
|
const {
|
|
@@ -18,19 +18,19 @@ const {
|
|
|
18
18
|
} = await getEnvs();
|
|
19
19
|
|
|
20
20
|
export default {
|
|
21
|
-
files: [
|
|
21
|
+
files: ["**/*.vue"],
|
|
22
22
|
plugins: {
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
"vue": vuePlugin,
|
|
24
|
+
"@stylistic": stylisticPlugin,
|
|
25
25
|
|
|
26
|
-
...(isTs ? {
|
|
26
|
+
...(isTs ? { "@typescript-eslint": tsPlugin } : {}),
|
|
27
27
|
},
|
|
28
28
|
languageOptions: {
|
|
29
29
|
parser: vueParser,
|
|
30
30
|
parserOptions: {
|
|
31
|
-
parser: isTs ? tsParser :
|
|
31
|
+
parser: isTs ? tsParser : "espree",
|
|
32
32
|
...(isTs ? { projectService: true } : {}),
|
|
33
|
-
extraFileExtensions: [
|
|
33
|
+
extraFileExtensions: [".vue"],
|
|
34
34
|
},
|
|
35
35
|
},
|
|
36
36
|
rules: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { default as globalConfig } from
|
|
2
|
-
export { default as jsonConfig } from
|
|
3
|
-
export { default as vueConfig } from
|
|
4
|
-
export { default as jsConfig } from
|
|
5
|
-
export { default as tsConfig } from
|
|
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,5 +1,5 @@
|
|
|
1
|
-
import { possibleProblemRules } from
|
|
2
|
-
import { suggestionRules } from
|
|
1
|
+
import { possibleProblemRules } from "./possible-problems.js";
|
|
2
|
+
import { suggestionRules } from "./suggestions.js";
|
|
3
3
|
|
|
4
4
|
export const jsRules = {
|
|
5
5
|
...possibleProblemRules,
|