Skip to content

Commit aae54fd

Browse files
committed
Adds lint rules to avoid process global usage
1 parent c02da2d commit aae54fd

File tree

8 files changed

+13
-4
lines changed

8 files changed

+13
-4
lines changed

.eslintrc.base.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"no-lonely-if": "error",
5252
"no-loop-func": "error",
5353
"no-multi-spaces": "error",
54+
"no-restricted-globals": ["error", "process"],
5455
"no-restricted-imports": [
5556
"error",
5657
{
@@ -75,6 +76,7 @@
7576
"net",
7677
"os",
7778
"path",
79+
"process",
7880
"punycode",
7981
"querystring",
8082
"readline",

src/env/node/fetch.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as process from 'process';
12
import * as url from 'url';
23
import { HttpsProxyAgent } from 'https-proxy-agent';
34
import fetch, { RequestInfo, RequestInit, Response } from 'node-fetch';

src/env/node/git/git.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as process from 'process';
12
import { Uri, window, workspace } from 'vscode';
23
import { hrtime } from '@env/hrtime';
34
import { GlyphChars } from '../../../constants';

src/env/node/git/localGitProvider.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { readdir, realpath } from 'fs';
22
import { homedir, hostname, userInfo } from 'os';
33
import { resolve as resolvePath } from 'path';
4+
import { env as process_env } from 'process';
45
import {
56
Disposable,
67
env,
@@ -1753,17 +1754,17 @@ export class LocalGitProvider implements GitProvider, Disposable {
17531754
} while (true);
17541755
} else {
17551756
user.name =
1756-
process.env.GIT_AUTHOR_NAME || process.env.GIT_COMMITTER_NAME || userInfo()?.username || undefined;
1757+
process_env.GIT_AUTHOR_NAME || process_env.GIT_COMMITTER_NAME || userInfo()?.username || undefined;
17571758
if (!user.name) {
17581759
// If we found no user data, mark it so we won't bother trying again
17591760
this._repoInfoCache.set(repoPath, { ...repo, user: null });
17601761
return undefined;
17611762
}
17621763

17631764
user.email =
1764-
process.env.GIT_AUTHOR_EMAIL ||
1765-
process.env.GIT_COMMITTER_EMAIL ||
1766-
process.env.EMAIL ||
1765+
process_env.GIT_AUTHOR_EMAIL ||
1766+
process_env.GIT_COMMITTER_EMAIL ||
1767+
process_env.EMAIL ||
17671768
`${user.name}@${hostname()}`;
17681769
}
17691770

src/env/node/git/locator.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { join as joinPaths } from 'path';
2+
import * as process from 'process';
23
import { GlyphChars } from '../../../constants';
34
import { LogLevel } from '../../../logger';
45
import { any } from '../../../system/promise';

src/env/node/git/shell.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { ExecException, execFile } from 'child_process';
22
import { exists, existsSync, Stats, statSync } from 'fs';
33
import { join as joinPaths } from 'path';
4+
import * as process from 'process';
45
import { decode } from 'iconv-lite';
56
import { Logger } from '../../../logger';
67

src/env/node/platform.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as process from 'process';
12
import { env, UIKind } from 'vscode';
23

34
export const isWeb = env.uiKind === UIKind.Web;

src/test/runTest.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as path from 'path';
2+
import * as process from 'process';
23
import { runTests } from '@vscode/test-electron';
34

45
async function main() {

0 commit comments

Comments
 (0)