Merge "Remove opt_ prefix"
diff --git a/polygerrit-ui/app/api/gerrit.ts b/polygerrit-ui/app/api/gerrit.ts
index a5f7731..404907a 100644
--- a/polygerrit-ui/app/api/gerrit.ts
+++ b/polygerrit-ui/app/api/gerrit.ts
@@ -17,7 +17,7 @@
export declare interface Gerrit {
install(
callback: (plugin: PluginApi) => void,
- opt_version?: string,
+ version?: string,
src?: string
): void;
styles: Styles;
diff --git a/polygerrit-ui/app/services/gr-auth/gr-auth.ts b/polygerrit-ui/app/services/gr-auth/gr-auth.ts
index f41c83d..945d6f9 100644
--- a/polygerrit-ui/app/services/gr-auth/gr-auth.ts
+++ b/polygerrit-ui/app/services/gr-auth/gr-auth.ts
@@ -50,5 +50,5 @@
/**
* Perform network fetch with authentication.
*/
- fetch(url: string, opt_options?: AuthRequestInit): Promise<Response>;
+ fetch(url: string, options?: AuthRequestInit): Promise<Response>;
}
diff --git a/polygerrit-ui/app/services/gr-auth/gr-auth_impl.ts b/polygerrit-ui/app/services/gr-auth/gr-auth_impl.ts
index 51b8bfd..2312fc9 100644
--- a/polygerrit-ui/app/services/gr-auth/gr-auth_impl.ts
+++ b/polygerrit-ui/app/services/gr-auth/gr-auth_impl.ts
@@ -162,18 +162,18 @@
/**
* Perform network fetch with authentication.
*/
- fetch(url: string, opt_options?: AuthRequestInit): Promise<Response> {
- const options: AuthRequestInitWithHeaders = {
+ fetch(url: string, options?: AuthRequestInit): Promise<Response> {
+ const optionsWithHeaders: AuthRequestInitWithHeaders = {
headers: new Headers(),
...this.defaultOptions,
- ...opt_options,
+ ...options,
};
if (this.type === AuthType.ACCESS_TOKEN) {
return this._getAccessToken().then(accessToken =>
- this._fetchWithAccessToken(url, options, accessToken)
+ this._fetchWithAccessToken(url, optionsWithHeaders, accessToken)
);
} else {
- return this._fetchWithXsrfToken(url, options);
+ return this._fetchWithXsrfToken(url, optionsWithHeaders);
}
}
diff --git a/polygerrit-ui/app/services/gr-auth/gr-auth_mock.ts b/polygerrit-ui/app/services/gr-auth/gr-auth_mock.ts
index 3e14aa7..9cdd37e 100644
--- a/polygerrit-ui/app/services/gr-auth/gr-auth_mock.ts
+++ b/polygerrit-ui/app/services/gr-auth/gr-auth_mock.ts
@@ -57,7 +57,7 @@
setup(_getToken: GetTokenCallback, _defaultOptions: DefaultAuthOptions) {}
- fetch(_url: string, _opt_options?: AuthRequestInit): Promise<Response> {
+ fetch(_url: string, _options?: AuthRequestInit): Promise<Response> {
return Promise.resolve(new Response());
}
}
diff --git a/polygerrit-ui/app/services/gr-auth/gr-auth_test.ts b/polygerrit-ui/app/services/gr-auth/gr-auth_test.ts
index e64cec1..b9cef86 100644
--- a/polygerrit-ui/app/services/gr-auth/gr-auth_test.ts
+++ b/polygerrit-ui/app/services/gr-auth/gr-auth_test.ts
@@ -208,9 +208,9 @@
let getToken: sinon.SinonStub;
- const makeToken = (opt_accessToken?: string) => {
+ const makeToken = (accessToken?: string) => {
return {
- access_token: opt_accessToken || 'zbaz',
+ access_token: accessToken || 'zbaz',
expires_at: new Date(Date.now() + 10e8).getTime(),
};
};
diff --git a/polygerrit-ui/app/services/gr-reporting/gr-reporting.ts b/polygerrit-ui/app/services/gr-reporting/gr-reporting.ts
index f552762..49259b4 100644
--- a/polygerrit-ui/app/services/gr-reporting/gr-reporting.ts
+++ b/polygerrit-ui/app/services/gr-reporting/gr-reporting.ts
@@ -29,7 +29,7 @@
eventName: string,
eventValue?: EventValue,
eventDetails?: EventDetails,
- opt_noLog?: boolean
+ noLog?: boolean
): void;
appStarted(): void;
diff --git a/polygerrit-ui/app/services/gr-reporting/gr-reporting_impl.ts b/polygerrit-ui/app/services/gr-reporting/gr-reporting_impl.ts
index 5b6e852..55bb64c 100644
--- a/polygerrit-ui/app/services/gr-reporting/gr-reporting_impl.ts
+++ b/polygerrit-ui/app/services/gr-reporting/gr-reporting_impl.ts
@@ -131,8 +131,8 @@
};
// TODO(dmfilippov): TS-fix-any unclear what is context
// eslint-disable-next-line @typescript-eslint/no-explicit-any
- const catchErrors = function (opt_context?: any) {
- const context = opt_context || window;
+ const catchErrors = function (context?: any) {
+ context = context || window;
const oldOnError = context.onerror;
context.onerror = (
event: Event | string,
@@ -387,18 +387,18 @@
// We cache until metrics plugin is loaded
this.pending.push([eventInfo, noLog]);
if (this._isMetricsPluginLoaded()) {
- this.pending.forEach(([eventInfo, opt_noLog]) => {
- this._reportEvent(eventInfo, opt_noLog);
+ this.pending.forEach(([eventInfo, noLog]) => {
+ this._reportEvent(eventInfo, noLog);
});
this.pending = [];
}
}
}
- private _reportEvent(eventInfo: EventInfo, opt_noLog?: boolean) {
+ private _reportEvent(eventInfo: EventInfo, noLog?: boolean) {
const {type, value, name, eventDetails} = eventInfo;
document.dispatchEvent(new CustomEvent(type, {detail: eventInfo}));
- if (opt_noLog) {
+ if (noLog) {
return;
}
if (type !== ERROR.TYPE) {
diff --git a/polygerrit-ui/app/services/gr-rest-api/gr-rest-api-impl_test.ts b/polygerrit-ui/app/services/gr-rest-api/gr-rest-api-impl_test.ts
index 83f1017..d570163 100644
--- a/polygerrit-ui/app/services/gr-rest-api/gr-rest-api-impl_test.ts
+++ b/polygerrit-ui/app/services/gr-rest-api/gr-rest-api-impl_test.ts
@@ -1191,7 +1191,7 @@
],
[{_number: 3, project: 'test/test'}],
] as unknown as ParsedJSON);
- // When opt_query instanceof Array, fetchJSON returns
+ // When query instanceof Array, fetchJSON returns
// Array<Array<Object>>.
await element.getChangesForMultipleQueries(undefined, []);
assert.equal(Object.keys(element._projectLookup).length, 3);
@@ -1210,7 +1210,7 @@
{_number: 3, project: 'test/test'},
] as unknown as ParsedJSON);
- // When opt_query !instanceof Array, fetchJSON returns Array<Object>.
+ // When query !instanceof Array, fetchJSON returns Array<Object>.
await element.getChanges();
assert.equal(Object.keys(element._projectLookup).length, 3);
const project1 = await element.getFromProjectLookup(1 as NumericChangeId);
diff --git a/polygerrit-ui/app/services/gr-rest-api/gr-rest-api.ts b/polygerrit-ui/app/services/gr-rest-api/gr-rest-api.ts
index 86276d1..b1f1884 100644
--- a/polygerrit-ui/app/services/gr-rest-api/gr-rest-api.ts
+++ b/polygerrit-ui/app/services/gr-rest-api/gr-rest-api.ts
@@ -199,8 +199,8 @@
getChangeDetail(
changeNum?: number | string,
- opt_errFn?: ErrorCallback,
- opt_cancelCondition?: Function
+ errFn?: ErrorCallback,
+ cancelCondition?: Function
): Promise<ParsedChangeInfo | undefined>;
/**
diff --git a/polygerrit-ui/app/services/storage/gr-storage_test.ts b/polygerrit-ui/app/services/storage/gr-storage_test.ts
index b79a8d7..72878f8 100644
--- a/polygerrit-ui/app/services/storage/gr-storage_test.ts
+++ b/polygerrit-ui/app/services/storage/gr-storage_test.ts
@@ -11,7 +11,7 @@
suite('gr-storage tests', () => {
let grStorage: GrStorageService;
- function mockStorage(opt_quotaExceeded: boolean): Storage {
+ function mockStorage(quotaExceeded: boolean): Storage {
return {
getItem(key: string) {
return (this as any)[key];
@@ -20,7 +20,7 @@
delete (this as any)[key];
},
setItem(key: string, value: string) {
- if (opt_quotaExceeded) {
+ if (quotaExceeded) {
throw new DOMException('error', 'QuotaExceededError');
}
(this as any)[key] = value;
diff --git a/polygerrit-ui/app/utils/change-util.ts b/polygerrit-ui/app/utils/change-util.ts
index 1b0a71d..5dda8d6 100644
--- a/polygerrit-ui/app/utils/change-util.ts
+++ b/polygerrit-ui/app/utils/change-util.ts
@@ -154,7 +154,7 @@
export function changeStatuses(
change: ChangeInfo,
- opt_options?: ChangeStatusesOptions
+ options?: ChangeStatusesOptions
): ChangeStates[] {
const states = [];
if (change.status === ChangeStatus.MERGED) {
@@ -163,10 +163,7 @@
if (change.status === ChangeStatus.ABANDONED) {
return [ChangeStates.ABANDONED];
}
- if (
- change.mergeable === false ||
- (opt_options && opt_options.mergeable === false)
- ) {
+ if (change.mergeable === false || (options && options.mergeable === false)) {
// 'mergeable' prop may not always exist (@see Issue 6819)
states.push(ChangeStates.MERGE_CONFLICT);
} else if (change.contains_git_conflicts) {
@@ -181,12 +178,12 @@
// If there are any pre-defined statuses, only return those. Otherwise,
// will determine the derived status.
- if (states.length || !opt_options) {
+ if (states.length || !options) {
return states;
}
// If no missing requirements, either active or ready to submit.
- if (change.submittable && opt_options.submitEnabled) {
+ if (change.submittable && options.submitEnabled) {
states.push(ChangeStates.READY_TO_SUBMIT);
} else {
// Otherwise it is active.
diff --git a/polygerrit-ui/app/utils/path-list-util_test.ts b/polygerrit-ui/app/utils/path-list-util_test.ts
index 3c9e0d3..cdd8182 100644
--- a/polygerrit-ui/app/utils/path-list-util_test.ts
+++ b/polygerrit-ui/app/utils/path-list-util_test.ts
@@ -144,7 +144,7 @@
assert.equal(shortenedPath, expectedPath);
});
- test('truncatePath with opt_threshold', () => {
+ test('truncatePath with threshold', () => {
let path = 'level1/level2/level3/level4/file.js';
let shortenedPath = truncatePath(path, 2);
// The expected path is truncated with an ellipsis.