Skip to content

Commit

Permalink
Adopt eslint's no-prototype-builtins rule.
Browse files Browse the repository at this point in the history
  • Loading branch information
zenhack committed Mar 27, 2020
1 parent 98f4d74 commit b184a93
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions shell/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ reportUnusedDisableDirectives: true
rules:
no-extra-semi: ["error"]
no-self-assign: ["error"]
no-prototype-builtins: ["error"]
10 changes: 6 additions & 4 deletions shell/imports/server/accounts/ldap.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ LDAP.prototype.ldapCheck = function (db, options) {

options = options || {};

if ((options.hasOwnProperty("username") && options.hasOwnProperty("ldapPass")) ||
options.hasOwnProperty("searchUsername")) {
const hasOwnProperty = Object.prototype.hasOwnProperty.call

if ((hasOwnProperty(options, "username") && hasOwnProperty(options, "ldapPass")) ||
hasOwnProperty(options, "searchUsername")) {
_this.options.base = db.getLdapBase();
_this.options.url = db.getLdapUrl();
_this.options.searchBeforeBind = {};
Expand Down Expand Up @@ -94,7 +96,7 @@ LDAP.prototype.ldapCheck = function (db, options) {
let username = options.username;
let domain = _this.options.defaultDomain;

if (!options.hasOwnProperty("searchUsername")) {
if (!hasOwnProperty(options, "searchUsername")) {
// Slide @xyz.whatever from username if it was passed in
// and replace it with the domain specified in defaults
let emailSliceIndex = options.username.indexOf("@");
Expand Down Expand Up @@ -165,7 +167,7 @@ LDAP.prototype.ldapCheck = function (db, options) {

retObject.searchResults = _.omit(entry.object, "userPassword");

if (options.hasOwnProperty("searchUsername")) {
if (hasOwnProperty(options, "searchUsername")) {
// This was only a search, return immediately
resolved = true;
ldapAsyncFut.return(retObject);
Expand Down
2 changes: 1 addition & 1 deletion shell/imports/server/accounts/saml-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ SAML.prototype.validateResponse = function (samlResponse, callback) {
const conditions = _this.getElement(assertion[0], "Conditions")[0];
if (conditions) {
for (const key in conditions) {
if (conditions.hasOwnProperty(key)) {
if (Object.prototype.hasOwnProperty.call(conditions, key)) {
const value = conditions[key];
if (key === "$") {
const nowMs = Date.now();
Expand Down
2 changes: 1 addition & 1 deletion shell/imports/server/shell-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ Meteor.publish("referralInfoPseudo", function () {
// If the handle doesn't show up in the new list of referredAccountIds, then remove
// info from the client & stop it on the server & make it null.
const handleForProfileName = handleForProfileNameByAccountId[accountId];
if (referredAccountIdsAsObject.hasOwnProperty(accountId)) {
if (Object.prototype.hasOwnProperty.call(referredAccountIdsAsObject, accountId)) {
stopWatchingAccount(accountId);
}
});
Expand Down

0 comments on commit b184a93

Please sign in to comment.