Skip to content

Commit a80945b

Browse files
committed
Expanded ESLint Style Rule Set to enforce additional consistency on code formatting.
1 parent cb7f9ae commit a80945b

File tree

10 files changed

+60
-18
lines changed

10 files changed

+60
-18
lines changed

.eslintrc.json

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,51 @@
99
"@typescript-eslint"
1010
],
1111
"rules": {
12+
"brace-style": [
13+
"error",
14+
"1tbs",
15+
{
16+
"allowSingleLine": true
17+
}
18+
],
19+
"comma-dangle": "error",
20+
"comma-spacing": "error",
21+
"comma-style": "error",
22+
"dot-location": [
23+
"error",
24+
"property"
25+
],
26+
"eol-last": "error",
1227
"eqeqeq": "error",
28+
"func-call-spacing": "error",
1329
"indent": [
1430
"error",
1531
"tab",
1632
{
1733
"SwitchCase": 1
1834
}
1935
],
36+
"key-spacing": "error",
2037
"linebreak-style": [
2138
"error",
2239
"windows"
2340
],
41+
"new-cap": "error",
42+
"new-parens": "error",
2443
"no-console": "warn",
44+
"no-eval": "error",
45+
"no-labels": "error",
46+
"no-multi-spaces": "error",
2547
"no-redeclare": "error",
2648
"no-shadow-restricted-names": "error",
2749
"no-throw-literal": "error",
2850
"no-unused-expressions": "error",
51+
"no-whitespace-before-property": "error",
2952
"quotes": [
3053
"error",
3154
"single"
3255
],
56+
"rest-spread-spacing": "error",
3357
"semi": "error",
3458
"sort-imports": [
3559
"error",
@@ -38,6 +62,23 @@
3862
"ignoreDeclarationSort": true
3963
}
4064
],
65+
"space-before-function-paren": [
66+
"error",
67+
{
68+
"anonymous": "always",
69+
"named": "never",
70+
"asyncArrow": "always"
71+
}
72+
],
73+
"space-before-blocks": "error",
74+
"space-infix-ops": "error",
75+
"spaced-comment": "error",
76+
"template-curly-spacing": "error",
77+
"wrap-iife": [
78+
"error",
79+
"inside"
80+
],
81+
"yoda": "error",
4182
"@typescript-eslint/explicit-member-accessibility": [
4283
"error",
4384
{
@@ -65,9 +106,10 @@
65106
},
66107
"overrides": [
67108
{
68-
"files": "./src/askpass/askpassMain.ts",
109+
"files": "./src/askpass/*.ts",
69110
"rules": {
70-
"no-console": "off"
111+
"no-console": "off",
112+
"spaced-comment": "off"
71113
}
72114
}
73115
]

src/askpass/askpassManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,4 @@ function getIPCHandlePath(nonce: string): string {
9797
} else {
9898
return path.join(os.tmpdir(), 'git-graph-askpass-' + nonce + '.sock');
9999
}
100-
}
100+
}

src/avatarManager.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export class AvatarManager extends Disposable {
5656
}),
5757

5858
// Dispose the avatar event emitter
59-
this.avatarEventEmitter,
59+
this.avatarEventEmitter
6060
);
6161
}
6262

@@ -298,7 +298,7 @@ export class AvatarManager extends Disposable {
298298
https.get({
299299
hostname: 'gitlab.com', path: '/api/v4/users?search=' + avatarRequest.email,
300300
headers: { 'User-Agent': 'vscode-git-graph', 'Private-Token': 'w87U_3gAxWWaPtFgCcus' }, // Token only has read access
301-
agent: false, timeout: 15000,
301+
agent: false, timeout: 15000
302302
}, (res) => {
303303
let respBody = '';
304304
res.on('data', (chunk: Buffer) => { respBody += chunk; });
@@ -589,4 +589,4 @@ interface GravatarRemoteSource {
589589
readonly type: 'gravatar';
590590
}
591591

592-
type RemoteSource = GitHubRemoteSource | GitLabRemoteSource | GravatarRemoteSource;
592+
type RemoteSource = GitHubRemoteSource | GitLabRemoteSource | GravatarRemoteSource;

src/dataSource.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,13 @@ export class DataSource extends Disposable {
108108
].join(GIT_LOG_SEPARATOR);
109109

110110
this.gitFormatLog = [
111-
'%H', '%P',// Hash & Parent Information
111+
'%H', '%P', // Hash & Parent Information
112112
useMailmap ? '%aN' : '%an', useMailmap ? '%aE' : '%ae', dateType, // Author / Commit Information
113113
'%s' // Subject
114114
].join(GIT_LOG_SEPARATOR);
115115

116116
this.gitFormatStash = [
117-
'%H', '%P', '%gD',// Hash, Parent & Selector Information
117+
'%H', '%P', '%gD', // Hash, Parent & Selector Information
118118
useMailmap ? '%aN' : '%an', useMailmap ? '%aE' : '%ae', dateType, // Author / Commit Information
119119
'%s' // Subject
120120
].join(GIT_LOG_SEPARATOR);

src/gitGraphView.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ export class GitGraphView extends Disposable {
251251
this.sendMessage({
252252
command: 'compareCommits',
253253
commitHash: msg.commitHash, compareWithHash: msg.compareWithHash,
254-
... await this.dataSource.getCommitComparison(msg.repo, msg.fromHash, msg.toHash),
254+
...await this.dataSource.getCommitComparison(msg.repo, msg.fromHash, msg.toHash),
255255
codeReview: msg.toHash !== UNCOMMITTED ? this.extensionState.getCodeReview(msg.repo, msg.fromHash + '-' + msg.toHash) : null,
256256
refresh: msg.refresh
257257
});
@@ -404,7 +404,7 @@ export class GitGraphView extends Disposable {
404404
command: 'loadCommits',
405405
refreshId: msg.refreshId,
406406
onlyFollowFirstParent: msg.onlyFollowFirstParent,
407-
... await this.dataSource.getCommits(msg.repo, msg.branches, msg.maxCommits, msg.showTags, msg.showRemoteBranches, msg.includeCommitsMentionedByReflogs, msg.onlyFollowFirstParent, msg.commitOrdering, msg.remotes, msg.hideRemotes, msg.stashes)
407+
...await this.dataSource.getCommits(msg.repo, msg.branches, msg.maxCommits, msg.showTags, msg.showRemoteBranches, msg.includeCommitsMentionedByReflogs, msg.onlyFollowFirstParent, msg.commitOrdering, msg.remotes, msg.hideRemotes, msg.stashes)
408408
});
409409
break;
410410
case 'loadConfig':
@@ -565,15 +565,15 @@ export class GitGraphView extends Disposable {
565565
command: 'startCodeReview',
566566
commitHash: msg.commitHash,
567567
compareWithHash: msg.compareWithHash,
568-
... await this.extensionState.startCodeReview(msg.repo, msg.id, msg.files, msg.lastViewedFile)
568+
...await this.extensionState.startCodeReview(msg.repo, msg.id, msg.files, msg.lastViewedFile)
569569
});
570570
break;
571571
case 'tagDetails':
572572
this.sendMessage({
573573
command: 'tagDetails',
574574
tagName: msg.tagName,
575575
commitHash: msg.commitHash,
576-
... await this.dataSource.getTagDetails(msg.repo, msg.tagName)
576+
...await this.dataSource.getTagDetails(msg.repo, msg.tagName)
577577
});
578578
break;
579579
case 'viewDiff':

src/statusBarItem.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,4 @@ export class StatusBarItem extends Disposable {
6969
this.isVisible = shouldBeVisible;
7070
}
7171
}
72-
}
72+
}

src/utils/@types/node/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ declare module 'fs' {
1010
namespace realpath {
1111
function native(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void;
1212
}
13-
}
13+
}

tests/avatarManager.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1752,4 +1752,4 @@ function waitForEvents(avatarManager: AvatarManager, n: number, runPendingTimers
17521752
}
17531753
});
17541754
});
1755-
}
1755+
}

tests/mocks/spawn.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ export function mockSpyOnSpawn(spyOnSpawn: jest.SpyInstance, callback: (onCallba
99
return {
1010
on: (event: string, callback: (...args: any[]) => void) => onCallbacks[event] = callback,
1111
stderr: {
12-
on: (event: string, callback: (...args: any[]) => void) => stderrOnCallbacks[event] = callback,
12+
on: (event: string, callback: (...args: any[]) => void) => stderrOnCallbacks[event] = callback
1313
},
1414
stdout: {
15-
on: (event: string, callback: (...args: any[]) => void) => stdoutOnCallbacks[event] = callback,
15+
on: (event: string, callback: (...args: any[]) => void) => stdoutOnCallbacks[event] = callback
1616
}
1717
};
1818
});

web/settingsWidget.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ class SettingsWidget {
775775
{ type: DialogInputType.Text, name: 'Source Owner', default: config.sourceOwner, placeholder: null, info: 'The owner of the repository that is the source of the Pull Request.' },
776776
{ type: DialogInputType.Text, name: 'Source Repo', default: config.sourceRepo, placeholder: null, info: 'The name of the repository that is the source of the Pull Request.' },
777777
{ type: DialogInputType.Text, name: 'Destination Owner', default: config.destOwner, placeholder: null, info: 'The owner of the repository that is the destination / target of the Pull Request.' },
778-
{ type: DialogInputType.Text, name: 'Destination Repo', default: config.destRepo, placeholder: null, info: 'The name of the repository that is the destination / target of the Pull Request.' },
778+
{ type: DialogInputType.Text, name: 'Destination Repo', default: config.destRepo, placeholder: null, info: 'The name of the repository that is the destination / target of the Pull Request.' }
779779
];
780780
if (config.provider === GG.PullRequestProvider.GitLab) {
781781
inputs.push({ type: DialogInputType.Text, name: 'Destination Project ID', default: config.destProjectId, placeholder: null, info: 'The GitLab Project ID of the destination / target of the Pull Request. Leave this field blank to use the default destination / target configured in GitLab.' });

0 commit comments

Comments
 (0)