@cherepanov.pavel/shareable-config 1.0.24 → 1.0.25
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/env.json5.set.js +2 -1
- package/package.json +1 -1
- package/tools/eslint-config/configs/vue.js +1 -1
- package/tools/eslint-config/rules/javascript/suggestions.js +0 -10
- package/tools/eslint-config/rules/typescript/common.js +20 -10
- package/tools/eslint-config/rules/vue/index.js +17 -1
- package/tools/eslint-config/rules/vue/options-api.js +23 -0
- package/tools/eslint-config/rules/vue/{possibleProblems.js → possible-problems.js} +0 -19
- package/utils/communication.js +28 -4
package/env.json5.set.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
-
askFramework, askTypescript,
|
|
4
|
+
askFramework, askOptionsApi, askTypescript,
|
|
5
5
|
} from "./utils/communication.js";
|
|
6
6
|
import {
|
|
7
7
|
getEnvs, setEnvs,
|
|
@@ -14,5 +14,6 @@ try {
|
|
|
14
14
|
|
|
15
15
|
envs.isRepositoryUseTypescript = await askTypescript();
|
|
16
16
|
envs.repositoryFramework = await askFramework();
|
|
17
|
+
envs.isRepositoryUseOptionsApi = await askOptionsApi();
|
|
17
18
|
|
|
18
19
|
await setEnvs(envs);
|
package/package.json
CHANGED
|
@@ -15,9 +15,6 @@ export const suggestionRules = {
|
|
|
15
15
|
],
|
|
16
16
|
"camelcase": [
|
|
17
17
|
ERROR,
|
|
18
|
-
{
|
|
19
|
-
properties: "never",
|
|
20
|
-
},
|
|
21
18
|
],
|
|
22
19
|
"capitalized-comments": [
|
|
23
20
|
OFF,
|
|
@@ -446,13 +443,6 @@ export const suggestionRules = {
|
|
|
446
443
|
],
|
|
447
444
|
"no-underscore-dangle": [
|
|
448
445
|
ERROR,
|
|
449
|
-
{
|
|
450
|
-
allow: [],
|
|
451
|
-
allowAfterSuper: false,
|
|
452
|
-
allowAfterThis: true,
|
|
453
|
-
allowFunctionParams: false,
|
|
454
|
-
allowInObjectDestructuring: false,
|
|
455
|
-
},
|
|
456
446
|
],
|
|
457
447
|
"no-unneeded-ternary": [
|
|
458
448
|
ERROR,
|
|
@@ -22,39 +22,49 @@ export const commonRules = {
|
|
|
22
22
|
// '@typescript-eslint/member-delimiter-style': ERROR,
|
|
23
23
|
"@typescript-eslint/member-ordering": ERROR,
|
|
24
24
|
"@typescript-eslint/method-signature-style": ERROR,
|
|
25
|
+
"no-underscore-dangle": [
|
|
26
|
+
OFF,
|
|
27
|
+
],
|
|
28
|
+
"camelcase": [
|
|
29
|
+
OFF,
|
|
30
|
+
],
|
|
31
|
+
"vue/camelcase": [
|
|
32
|
+
OFF,
|
|
33
|
+
],
|
|
25
34
|
"@typescript-eslint/naming-convention": [
|
|
26
35
|
ERROR,
|
|
27
36
|
{
|
|
28
37
|
selector: "default",
|
|
29
|
-
// UPPER_CASE for, like example, consts from env files
|
|
30
38
|
format: [
|
|
31
|
-
"
|
|
32
|
-
"UPPER_CASE",
|
|
39
|
+
"strictCamelCase",
|
|
33
40
|
],
|
|
34
41
|
leadingUnderscore: "forbid",
|
|
35
42
|
trailingUnderscore: "forbid",
|
|
36
43
|
},
|
|
37
44
|
{
|
|
38
45
|
selector: "import",
|
|
39
|
-
// PascalCase for components import
|
|
40
46
|
format: [
|
|
41
|
-
"
|
|
47
|
+
"strictCamelCase",
|
|
42
48
|
"PascalCase",
|
|
43
49
|
],
|
|
50
|
+
leadingUnderscore: "forbid",
|
|
51
|
+
trailingUnderscore: "forbid",
|
|
44
52
|
},
|
|
45
53
|
{
|
|
46
|
-
selector: "
|
|
47
|
-
// UPPER_CASE for, like example, consts from env files
|
|
54
|
+
selector: "typeLike",
|
|
48
55
|
format: [
|
|
49
|
-
"
|
|
50
|
-
"UPPER_CASE",
|
|
56
|
+
"PascalCase",
|
|
51
57
|
],
|
|
58
|
+
leadingUnderscore: "forbid",
|
|
59
|
+
trailingUnderscore: "forbid",
|
|
52
60
|
},
|
|
53
61
|
{
|
|
54
|
-
selector: "
|
|
62
|
+
selector: "enumMember",
|
|
55
63
|
format: [
|
|
56
64
|
"PascalCase",
|
|
57
65
|
],
|
|
66
|
+
leadingUnderscore: "forbid",
|
|
67
|
+
trailingUnderscore: "forbid",
|
|
58
68
|
},
|
|
59
69
|
{
|
|
60
70
|
selector: "objectLiteralProperty",
|
|
@@ -6,13 +6,23 @@ import {
|
|
|
6
6
|
} from "./extension.js";
|
|
7
7
|
import {
|
|
8
8
|
possibleProblemRules,
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./possible-problems.js";
|
|
10
10
|
import {
|
|
11
11
|
suggestionRules,
|
|
12
12
|
} from "./suggestions.js";
|
|
13
13
|
import {
|
|
14
14
|
formattingRules,
|
|
15
15
|
} from "./formatting.js";
|
|
16
|
+
import {
|
|
17
|
+
getEnvs,
|
|
18
|
+
} from "../../../../utils/env.js";
|
|
19
|
+
import {
|
|
20
|
+
optionsApiRules,
|
|
21
|
+
} from "./options-api.js";
|
|
22
|
+
|
|
23
|
+
const {
|
|
24
|
+
isRepositoryUseOptionsApi,
|
|
25
|
+
} = await getEnvs();
|
|
16
26
|
|
|
17
27
|
export const vueRules = {
|
|
18
28
|
...baseRules,
|
|
@@ -20,4 +30,10 @@ export const vueRules = {
|
|
|
20
30
|
...possibleProblemRules,
|
|
21
31
|
...suggestionRules,
|
|
22
32
|
...formattingRules,
|
|
33
|
+
...(() => {
|
|
34
|
+
if (isRepositoryUseOptionsApi) {
|
|
35
|
+
return optionsApiRules;
|
|
36
|
+
}
|
|
37
|
+
return {};
|
|
38
|
+
})(),
|
|
23
39
|
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ERROR,
|
|
3
|
+
OFF,
|
|
4
|
+
} from "../severity.js";
|
|
5
|
+
|
|
6
|
+
export const optionsApiRules = {
|
|
7
|
+
"vue/component-api-style": [
|
|
8
|
+
OFF,
|
|
9
|
+
],
|
|
10
|
+
"vue/component-options-name-casing": [
|
|
11
|
+
ERROR,
|
|
12
|
+
"PascalCase",
|
|
13
|
+
],
|
|
14
|
+
"vue/match-component-file-name": [
|
|
15
|
+
ERROR,
|
|
16
|
+
{
|
|
17
|
+
extensions: [
|
|
18
|
+
"vue",
|
|
19
|
+
],
|
|
20
|
+
shouldMatchCase: true,
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
};
|
|
@@ -38,21 +38,11 @@ export const possibleProblemRules = {
|
|
|
38
38
|
"PascalCase",
|
|
39
39
|
{
|
|
40
40
|
registeredComponentsOnly: false,
|
|
41
|
-
ignores: [],
|
|
42
41
|
},
|
|
43
42
|
],
|
|
44
|
-
"vue/component-options-name-casing": [
|
|
45
|
-
ERROR,
|
|
46
|
-
"PascalCase",
|
|
47
|
-
],
|
|
48
43
|
"vue/custom-event-name-casing": [
|
|
49
44
|
ERROR,
|
|
50
45
|
"camelCase",
|
|
51
|
-
{
|
|
52
|
-
ignores: [
|
|
53
|
-
"/^[a-z]+(?:-[a-z]+)*:[a-z]+((\\d)|([A-Z0-9][a-z0-9]+))*([A-Z])?$/u",
|
|
54
|
-
],
|
|
55
|
-
},
|
|
56
46
|
],
|
|
57
47
|
"vue/define-emits-declaration": [
|
|
58
48
|
ERROR,
|
|
@@ -68,15 +58,6 @@ export const possibleProblemRules = {
|
|
|
68
58
|
"vue/html-end-tags": [
|
|
69
59
|
ERROR,
|
|
70
60
|
],
|
|
71
|
-
"vue/match-component-file-name": [
|
|
72
|
-
ERROR,
|
|
73
|
-
{
|
|
74
|
-
extensions: [
|
|
75
|
-
"vue",
|
|
76
|
-
],
|
|
77
|
-
shouldMatchCase: true,
|
|
78
|
-
},
|
|
79
|
-
],
|
|
80
61
|
"vue/multi-word-component-names": [
|
|
81
62
|
ERROR,
|
|
82
63
|
],
|
package/utils/communication.js
CHANGED
|
@@ -7,10 +7,12 @@ export async function askTypescript() {
|
|
|
7
7
|
output: process.stdout,
|
|
8
8
|
});
|
|
9
9
|
rl.question(
|
|
10
|
-
"
|
|
10
|
+
"Do you use TypeScript? (Enter — no, any characters + Enter — yes):",
|
|
11
11
|
(answer) => {
|
|
12
12
|
rl.close();
|
|
13
|
-
resolve(Boolean(
|
|
13
|
+
resolve(Boolean(
|
|
14
|
+
answer,
|
|
15
|
+
));
|
|
14
16
|
},
|
|
15
17
|
);
|
|
16
18
|
});
|
|
@@ -23,10 +25,32 @@ export async function askFramework() {
|
|
|
23
25
|
output: process.stdout,
|
|
24
26
|
});
|
|
25
27
|
rl.question(
|
|
26
|
-
"
|
|
28
|
+
"Which framework do you use? (vue/nuxt/quasar, press Enter to copy only the framework-less): ",
|
|
27
29
|
(answer) => {
|
|
28
30
|
rl.close();
|
|
29
|
-
resolve(
|
|
31
|
+
resolve(
|
|
32
|
+
answer
|
|
33
|
+
.trim()
|
|
34
|
+
.toLowerCase(),
|
|
35
|
+
);
|
|
36
|
+
},
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export async function askOptionsApi() {
|
|
42
|
+
return new Promise((resolve) => {
|
|
43
|
+
const rl = readline.createInterface({
|
|
44
|
+
input: process.stdin,
|
|
45
|
+
output: process.stdout,
|
|
46
|
+
});
|
|
47
|
+
rl.question(
|
|
48
|
+
"Do you use the Vue options API? (Enter — no, any characters + Enter — yes):",
|
|
49
|
+
(answer) => {
|
|
50
|
+
rl.close();
|
|
51
|
+
resolve(Boolean(
|
|
52
|
+
answer,
|
|
53
|
+
));
|
|
30
54
|
},
|
|
31
55
|
);
|
|
32
56
|
});
|