Skip to content

Commit 4cb18de

Browse files
committed
Add eslint rule: Require let or const instead of var
1 parent 78234a2 commit 4cb18de

27 files changed

+43
-40
lines changed

.eslintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,12 @@ module.exports = {
5454
},
5555
],
5656
'brace-style': 'off',
57+
'no-throw-literal': 'error',
58+
'no-var': 'error',
5759
curly: 'error',
5860
eqeqeq: ['error', 'always'],
5961
semi: 'off',
6062
'@stylistic/js/semi': ['error', 'always'],
61-
'no-throw-literal': 'error',
6263
},
6364
settings: {
6465
react: {

src/analytics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ async function tenantTrackEvent(
623623
}
624624

625625
function event(action: string, actionSubject: string, attributes: any): any {
626-
var event = {
626+
let event = {
627627
origin: 'desktop',
628628
platform: AnalyticsPlatform.for(process.platform),
629629
action: action,

src/jira/jira-client/providers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { Container } from '../../container';
1414
import { Resources } from '../../resources';
1515
import { ConnectionTimeout } from '../../util/time';
1616

17-
var tunnel = require('tunnel');
17+
let tunnel = require('tunnel');
1818

1919
export function getAxiosInstance(): AxiosInstance {
2020
const instance = axios.create({

src/jira/newIssueMonitor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class NewIssueMonitor {
9393
}
9494

9595
const issueNames = newIssues.map((issue) => `[${issue.key}] "${issue.summary}"`);
96-
var message = '';
96+
let message = '';
9797
if (newIssues.length === 1) {
9898
message = `${issueNames[0]} added to explorer`;
9999
} else if (newIssues.length <= 3) {

src/lib/.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module.exports = {
22
rules: {
3+
'no-var': 'error',
34
'no-restricted-imports': [
45
'error',
56
{

src/lib/webview/controller/config/configWebviewController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export class ConfigWebviewController implements WebviewController<SectionChangeM
119119
break;
120120
}
121121
case ConfigActionType.Login: {
122-
var isCloud = true;
122+
let isCloud = true;
123123
if (isBasicAuthInfo(msg.authInfo) || isPATAuthInfo(msg.authInfo)) {
124124
isCloud = false;
125125
try {

src/lib/webview/controller/onboarding/onboardingWebviewController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export class OnboardingWebviewController implements WebviewController<SectionCha
9494
break;
9595
}
9696
case OnboardingActionType.Login: {
97-
var isCloud = true;
97+
let isCloud = true;
9898
if (isBasicAuthInfo(msg.authInfo)) {
9999
isCloud = false;
100100
try {

src/pipelines/pipelines.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ export class PipelineApiImpl {
243243
}
244244

245245
cleanPipelineData(site: BitbucketSite, pipeline: any): Pipeline {
246-
var name = undefined;
247-
var avatar = undefined;
246+
let name = undefined;
247+
let avatar = undefined;
248248
if (pipeline.creator) {
249249
name = pipeline.creator.display_name;
250250
if (pipeline.creator.links && pipeline.creator.links.avatar) {

src/pipelines/yaml/pipelinesYamlHelper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ async function addPipelinesSchemaToConfigAtScope(
2929
newValue = Object.assign({}, valueAtScope);
3030
}
3131
Object.keys(newValue).forEach((configKey) => {
32-
var configValue = newValue[configKey];
32+
let configValue = newValue[configKey];
3333
if (value === configValue) {
3434
delete newValue[configKey];
3535
}

src/react/.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
module.exports = {
22
rules: {
3+
'no-var': 'error',
34
'no-restricted-imports': [
45
'error',
56
{

0 commit comments

Comments
 (0)