Skip to content

Commit 8db2912

Browse files
committed
Improved Linting
1 parent 4376018 commit 8db2912

File tree

8 files changed

+213
-118
lines changed

8 files changed

+213
-118
lines changed

.eslintrc

Lines changed: 152 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,115 +1,155 @@
11
{
2-
"root": true,
3-
"parser": "@typescript-eslint/parser",
4-
"env": {
5-
"node": true
6-
},
7-
"plugins": [
8-
"@typescript-eslint",
9-
"@stylistic/eslint-plugin"
10-
],
11-
"extends": [
12-
"eslint:recommended",
13-
"plugin:@typescript-eslint/eslint-recommended",
14-
"plugin:@typescript-eslint/recommended"
15-
],
16-
"parserOptions": {
17-
"sourceType": "module"
18-
},
19-
"rules": {
20-
"@stylistic/indent": [
21-
"error",
22-
"tab"
23-
],
24-
"@stylistic/indent-binary-ops": [
25-
"error",
26-
"tab"
27-
],
28-
"@stylistic/quotes": [
29-
"error",
30-
"single"
31-
],
32-
"@stylistic/semi": [
33-
"error",
34-
"always"
35-
],
36-
"@stylistic/brace-style": [
37-
"error",
38-
"stroustrup",
39-
{
40-
"allowSingleLine": true
41-
}
42-
],
43-
"@stylistic/comma-dangle": [
44-
"error",
45-
"always-multiline"
46-
],
47-
"@stylistic/dot-location": [
48-
"error",
49-
"property"
50-
],
51-
"@stylistic/function-call-argument-newline": [
52-
"error",
53-
"consistent"
54-
],
55-
"@stylistic/function-call-spacing": "error",
56-
"@stylistic/implicit-arrow-linebreak": "error",
57-
"@stylistic/key-spacing": "error",
58-
"@stylistic/lines-around-comment": "error",
59-
"@stylistic/new-parens": "error",
60-
"@stylistic/no-confusing-arrow": "error",
61-
"@stylistic/no-extra-semi": "error",
62-
"@stylistic/no-floating-decimal": "error",
63-
"@stylistic/no-mixed-operators": "error",
64-
"@stylistic/no-mixed-spaces-and-tabs": "error",
65-
"@stylistic/no-multi-spaces": "error",
66-
"@stylistic/no-multiple-empty-lines": [
67-
"error",
68-
{
69-
"max": 1,
70-
"maxEOF": 0,
71-
"maxBOF": 0
72-
}
73-
],
74-
"@stylistic/no-trailing-spaces": [
75-
"error",
76-
{
77-
"skipBlankLines": true
78-
}
79-
],
80-
"@stylistic/nonblock-statement-body-position": "error",
81-
"@stylistic/operator-linebreak": [
82-
"error",
83-
"after"
84-
],
85-
"@stylistic/padded-blocks": [
86-
"error",
87-
"never"
88-
],
89-
"@stylistic/padding-line-between-statements": "error",
90-
"@stylistic/rest-spread-spacing": "error",
91-
"@stylistic/semi-spacing": "error",
92-
"@stylistic/semi-style": "error",
93-
"@stylistic/space-before-blocks": "error",
94-
"@stylistic/space-before-function-paren": [
95-
"error",
96-
{
97-
"anonymous": "always",
98-
"named": "never",
99-
"asyncArrow": "always"
100-
}
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"env": {
5+
"node": true
6+
},
7+
"plugins": [
8+
"@typescript-eslint",
9+
"@stylistic/eslint-plugin"
10110
],
102-
"@stylistic/arrow-spacing": "error",
103-
"@stylistic/space-in-parens": "error",
104-
"@stylistic/space-infix-ops": "error",
105-
"@stylistic/space-unary-ops": "error",
106-
"@stylistic/spaced-comment": [
107-
"error",
108-
"always"
109-
],
110-
"@stylistic/switch-colon-spacing": "error",
111-
"@stylistic/template-curly-spacing": "error",
112-
"@stylistic/type-generic-spacing": "error",
113-
"@stylistic/type-named-tuple-spacing": "error"
114-
}
11+
"extends": [
12+
"eslint:recommended",
13+
"plugin:@typescript-eslint/eslint-recommended",
14+
"plugin:@typescript-eslint/recommended"
15+
],
16+
"parserOptions": {
17+
"sourceType": "module"
18+
},
19+
"rules": {
20+
"@stylistic/indent": [
21+
"error",
22+
"tab"
23+
],
24+
"@stylistic/indent-binary-ops": [
25+
"error",
26+
"tab"
27+
],
28+
"@stylistic/quotes": [
29+
"error",
30+
"single"
31+
],
32+
"@stylistic/semi": [
33+
"error",
34+
"always"
35+
],
36+
"@stylistic/brace-style": [
37+
"error",
38+
"stroustrup",
39+
{
40+
"allowSingleLine": true
41+
}
42+
],
43+
"@stylistic/comma-dangle": [
44+
"error",
45+
"always-multiline"
46+
],
47+
"comma-spacing": [
48+
"error",
49+
{
50+
"before": false,
51+
"after": true
52+
}
53+
],
54+
"@stylistic/dot-location": [
55+
"error",
56+
"property"
57+
],
58+
"@stylistic/function-call-argument-newline": [
59+
"error",
60+
"consistent"
61+
],
62+
"@stylistic/function-call-spacing": "error",
63+
"@stylistic/implicit-arrow-linebreak": "error",
64+
"@stylistic/key-spacing": "error",
65+
"@stylistic/lines-around-comment": [
66+
"error",
67+
{
68+
"beforeBlockComment": true,
69+
"afterBlockComment": false,
70+
"beforeLineComment": true,
71+
"afterLineComment": false,
72+
"allowBlockStart": true,
73+
"allowBlockEnd": false,
74+
"allowClassStart": true,
75+
"allowClassEnd": false,
76+
"allowObjectStart": true,
77+
"allowObjectEnd": false,
78+
"allowArrayStart": true,
79+
"allowArrayEnd": false,
80+
"ignorePattern": "TODO|HACK|BUG|TEST",
81+
"applyDefaultIgnorePatterns": false
82+
}
83+
],
84+
"@stylistic/new-parens": "error",
85+
"@stylistic/no-confusing-arrow": "error",
86+
"@stylistic/no-extra-semi": "error",
87+
"@stylistic/no-floating-decimal": "error",
88+
"@stylistic/no-mixed-operators": "error",
89+
"@stylistic/no-mixed-spaces-and-tabs": "error",
90+
"@stylistic/no-multi-spaces": "error",
91+
"@stylistic/no-multiple-empty-lines": [
92+
"error",
93+
{
94+
"max": 1,
95+
"maxEOF": 0,
96+
"maxBOF": 0
97+
}
98+
],
99+
"@stylistic/no-trailing-spaces": [
100+
"error",
101+
{
102+
"skipBlankLines": false,
103+
"ignoreComments": false
104+
}
105+
],
106+
"@stylistic/nonblock-statement-body-position": "error",
107+
"@stylistic/operator-linebreak": [
108+
"error",
109+
"after"
110+
],
111+
"@stylistic/padded-blocks": [
112+
"error",
113+
"never"
114+
],
115+
"@stylistic/padding-line-between-statements": "error",
116+
"@stylistic/rest-spread-spacing": "error",
117+
"@stylistic/semi-spacing": "error",
118+
"@stylistic/semi-style": "error",
119+
"@stylistic/space-before-blocks": "error",
120+
"@stylistic/space-before-function-paren": [
121+
"error",
122+
{
123+
"anonymous": "always",
124+
"named": "never",
125+
"asyncArrow": "always"
126+
}
127+
],
128+
"@stylistic/arrow-spacing": "error",
129+
"@stylistic/space-in-parens": "error",
130+
"@stylistic/space-infix-ops": "error",
131+
"@stylistic/space-unary-ops": "error",
132+
"@stylistic/spaced-comment": [
133+
"error",
134+
"always"
135+
],
136+
"@stylistic/switch-colon-spacing": "error",
137+
"@stylistic/template-curly-spacing": "error",
138+
"@stylistic/type-generic-spacing": "error",
139+
"@stylistic/type-named-tuple-spacing": "error",
140+
"no-fallthrough": [
141+
"error",
142+
{
143+
"allowEmptyCase": true
144+
}
145+
],
146+
"line-comment-position": [
147+
"error",
148+
{
149+
"position": "above",
150+
"ignorePattern": "TODO|HACK|BUG|TEST",
151+
"applyDefaultIgnorePatterns": false
152+
}
153+
]
154+
}
115155
}

.eslintrc.dev

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": [
3+
"./.eslintrc"
4+
],
5+
"rules": {
6+
"no-console": "off",
7+
}
8+
}

.eslintrc.release

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"extends": [
3+
"./.eslintrc"
4+
],
5+
"rules": {
6+
"no-console": [
7+
"error",
8+
{
9+
"allow": [
10+
"warn",
11+
"error",
12+
"debug"
13+
]
14+
}
15+
],
16+
"multiline-comment-style": [
17+
"error",
18+
"starred-block"
19+
]
20+
}
21+
}

src/modals/PluginDataModal.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,32 +51,37 @@ export class PluginDataModal extends Modal {
5151
new Notice('Github username cannot be empty!');
5252
return;
5353
}
54+
5455
// Check repository exist and is not empty
5556
if (!repository || repository === '') {
5657
new Notice('Github repository cannot be empty!');
5758
return;
5859
}
60+
5961
// Check the repo matches the pattern
6062
const repo = `${username}/${repository}`;
6163
if (!repositoryRegEx.test(repo)) {
6264
new Notice('Github <username>/<repository> do not match the pattern!');
6365
return;
6466
}
67+
6568
// check there are releases for the repo
6669
const releases = await fetchReleases(repo);
6770
if (!releases || releases.length <= 0) {
6871
new Notice('No releases found for this plugin. May it do not have any.');
6972
return;
7073
}
74+
7175
// Check a manifest could be fetched
7276
const manifest =
73-
await fetchManifest(undefined,undefined,releases[0]) ||
77+
await fetchManifest(undefined, undefined, releases[0]) ||
7478
await fetchManifest(repo, releases[0].tag_name) ||
7579
await fetchManifest(repo);
7680
if (!manifest) {
7781
new Notice('Plugin manifest could not be found in releases, tag ref, or default branch!');
7882
return;
7983
}
84+
8085
// Combine data
8186
const pluginInfo = Object.assign({}, manifest, { repo, releases }) as PluginInfo;
8287
pluginInfo.targetVersion = pluginInfo.version;

src/modals/PluginTroubleshootingModal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export class PluginTroubleshootingModal extends Modal {
8080
.onClick(() => {
8181
this.update();
8282
}));
83-
83+
8484
let releases: Partial<Release>[] | undefined = undefined;
8585
if (repositoryRegEx.test(this.pluginInfo.repo)) {
8686
releases = await fetchReleases(this.pluginInfo.repo);

0 commit comments

Comments
 (0)