Skip to content

Commit

Permalink
ref: Stop disabling no-prototype-builtins rule (#4121)
Browse files Browse the repository at this point in the history
Updates browser, serverless and utils packages to no longer disable
the `no-prototype-builtins` eslint rule.
  • Loading branch information
AbhiPrasad committed Nov 4, 2021
1 parent dcd549b commit 866e594
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions packages/browser/src/transports/xhr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ export class XHRTransport extends BaseTransport {

request.open('POST', sentryRequest.url);
for (const header in this.options.headers) {
// eslint-disable-next-line no-prototype-builtins
if (this.options.headers.hasOwnProperty(header)) {
if (Object.prototype.hasOwnProperty.call(this.options.headers, header)) {
request.setRequestHeader(header, this.options.headers[header]);
}
}
Expand Down
3 changes: 1 addition & 2 deletions packages/serverless/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ export function proxyFunction<A extends any[], R, F extends (...args: A) => R>(

if (overrides) {
handler.get = (target, prop) => {
// eslint-disable-next-line no-prototype-builtins
if (overrides.hasOwnProperty(prop)) {
if (Object.prototype.hasOwnProperty.call(overrides, prop)) {
return overrides[prop as string];
}
return (target as Record<PropertyKey, unknown>)[prop as string];
Expand Down
3 changes: 1 addition & 2 deletions packages/utils/src/polyfill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ function setProtoOf<TTarget extends object, TProto>(obj: TTarget, proto: TProto)
// eslint-disable-next-line @typescript-eslint/ban-types
function mixinProperties<TTarget extends object, TProto>(obj: TTarget, proto: TProto): TTarget & TProto {
for (const prop in proto) {
// eslint-disable-next-line no-prototype-builtins
if (!obj.hasOwnProperty(prop)) {
if (!Object.prototype.hasOwnProperty.call(obj, prop)) {
// @ts-ignore typescript complains about indexing so we remove
obj[prop] = proto[prop];
}
Expand Down

0 comments on commit 866e594

Please sign in to comment.