Skip to content

Commit

Permalink
error, warning, and linting fixes for bithound (#1885)
Browse files Browse the repository at this point in the history
* add PropType declarations

* lint fixes

* lint fixes

* Fix lint issues in catalog

* Fix browser stack lint issues

* lint fixes

* Fix lint issues

* Fix lint issues

* add PropType

* Fix lint issues

* Fix lint issues

* Fix lint issues

* Fix lint issues - removed unused code

* added PropTypes

* Fix lint issues, added propType definition

* Fix lint issues

* Fix lint issues

* lint fixes

* Fix lint issues

* lint fixes

* lint fixes

* lint fixes

* let -> const

* Fix lint issues, remove unused code

* Fix lint issues

* jsdoc -> regular comment

* Disable eslint for gridfs.server file

* add prevent default

* Fix lint issues

* fixed propTypes

* propTypes update

* Fix lint issues

* disable eslint on files that aren't ours

* lint fixes

* fix lint issues

* remove unused params

* Fix lint issues, removed unused function

* Fix lint issues, removed commented code

* Fix lint issues

* Fix lint issues

* Fix lint issues

* Fix lint issues

* lint fixes

* Fix lint issues, add propType definition

* remove unused import

* Fix lint issues, reorder propTypes

* Fix lint issues

* Fix lint issues, removed duplicate function

* Fix lint issues

* remove unused import

* remove unused import

* Fix lint issue

* Fix lint issues

* jsdoc error

* Fix lint issues

* remove unused import

* Fix lint issues

* jsdoc -> comment

* Fix lint issues

* Fix lint issues

* Fix lint issues

* lint issues

* typo

* typo

* rename var

* lint fixes

* bit hound fix

* function export

* function imports

* lint updates

* messing up files for bithound
  • Loading branch information
kieckhafer authored and mikemurray committed Feb 23, 2017
1 parent e772193 commit b326c23
Show file tree
Hide file tree
Showing 85 changed files with 186 additions and 376 deletions.
4 changes: 2 additions & 2 deletions client/modules/accounts/templates/members/member.js
Expand Up @@ -90,7 +90,7 @@ Template.memberSettings.helpers({
});
}
}
// todo review this, hardcoded WIP
// TODO review this, hardcoded WIP
const label = pkg.name.replace("reaction", "").replace(/(-.)/g, function (x) {
return " " + x[1].toUpperCase();
});
Expand Down Expand Up @@ -141,7 +141,7 @@ Template.memberSettings.events({
},
"click [data-event-action=resetMemberPermission]": function (event, template) {
const $icon = Template.instance().$(event.currentTarget);
if (confirm($icon.data("confirm"))) {
if (confirm($icon.data("confirm"))) { // eslint-disable-line no-alert
const results = [];
for (const role of template.data.roles) {
results.push(Meteor.call("accounts/setUserPermissions", this.userId, ["guest", "account/profile"], role));
Expand Down
6 changes: 4 additions & 2 deletions client/modules/i18n/currency.js
Expand Up @@ -44,9 +44,11 @@ function findCurrency(defaultCurrency, useDefaultShopCurrency) {
* @return {String} returns locale formatted and exchange rate converted values
*/
export function formatPriceString(formatPrice, useDefaultShopCurrency) {
let defaultShopCurrency = useDefaultShopCurrency;

// in case useDefaultShopCurrency is a Spacebars.kw we have this check
if (typeof useDefaultShopCurrency === "object" || !useDefaultShopCurrency) {
useDefaultShopCurrency = false;
defaultShopCurrency = false;
}

currencyDep.depend();
Expand All @@ -62,7 +64,7 @@ export function formatPriceString(formatPrice, useDefaultShopCurrency) {
}

// uses the localStorage currency instead of locale
const userCurrency = findCurrency(locale.currency, useDefaultShopCurrency);
const userCurrency = findCurrency(locale.currency, defaultShopCurrency);

// for the cases then we have only one price. It is a number.
const currentPrice = formatPrice.toString();
Expand Down
1 change: 0 additions & 1 deletion client/modules/i18n/helpers.js
@@ -1,4 +1,3 @@
import { Meteor } from "meteor/meteor";
import { Template } from "meteor/templating";
import { Reaction, Logger, i18next } from "/client/api";
import { Shops } from "/lib/collections";
Expand Down
15 changes: 6 additions & 9 deletions client/modules/i18n/templates/currency/currency.js
Expand Up @@ -12,7 +12,7 @@ Template.currencySelect.helpers({
currency: 1
}
});
const locale = Reaction.Locale.get();
Reaction.Locale.get();
if (Match.test(shop, Object) && shop.currencies) {
for (const currencyName in shop.currencies) {
if (shop.currencies[currencyName].enabled === true) {
Expand Down Expand Up @@ -48,19 +48,16 @@ Template.currencySelect.helpers({
currency: 1
}
});
const profile = Meteor.user().profile;
if (Match.test(shop, Object) && shop.currency) {
const localStorageCurrency = localStorage.getItem("currency");
if (localStorageCurrency) {
return localStorageCurrency + " " + shop.currencies[localStorageCurrency].symbol;
} else {
const locale = Reaction.Locale.get();
if (locale && locale.currency && locale.currency.enabled) {
return locale.locale.currency + " " + locale.currency.symbol;
} else {
return shop.currency + " " + shop.currencies[shop.currency].symbol;
}
}
const locale = Reaction.Locale.get();
if (locale && locale.currency && locale.currency.enabled) {
return locale.locale.currency + " " + locale.currency.symbol;
}
return shop.currency + " " + shop.currencies[shop.currency].symbol;
}
}
return "USD $";
Expand Down
Expand Up @@ -3,7 +3,7 @@ import classnames from "classnames";
import Blaze from "meteor/gadicc:blaze-react-component";
import { Admin } from "/imports/plugins/core/ui/client/providers";
import Radium from "radium";
import Velocity from "velocity-animate";
import "velocity-animate";
import "velocity-animate/velocity.ui";
import { VelocityTransitionGroup } from "velocity-react";
import debounce from "lodash/debounce";
Expand Down Expand Up @@ -114,6 +114,7 @@ class ActionView extends Component {
actionView: PropTypes.object,
actionViewIsOpen: PropTypes.bool,
buttons: PropTypes.array,
detailView: PropTypes.object,
detailViewIsOpen: PropTypes.bool,
handleActionViewBack: PropTypes.func,
handleActionViewClose: PropTypes.func,
Expand Down
@@ -1,26 +1,6 @@
import { Reaction } from "/client/api";
/* eslint no-loop-func: 0 */

/**
* Navigate to package
* @param {Object} reactionPackage Reaction package definition
* @return {Boolean} false if navigation was blocked
*/
function showPackageDashboard(reactionPackage) {
const routeName = reactionPackage.name || reactionPackage.route;

if (routeName && reactionPackage.route) {
const route = Reaction.Router.path(routeName);

if (route && ReactionCore.hasPermission(routeName, Meteor.userId())) {
Reaction.Router.go(route);
return true;
}
}

return false;
}

/**
* gridPackage helpers
*/
Expand Down
27 changes: 7 additions & 20 deletions imports/plugins/core/layout/client/templates/layout/admin/admin.js
Expand Up @@ -4,7 +4,6 @@ import { Blaze } from "meteor/blaze";
import { Template } from "meteor/templating";
import { Reaction, i18next } from "/client/api";
import { Packages } from "/lib/collections";
import PublishContainer from "/imports/plugins/core/revisions/client/containers/publishContainer";
import ToolbarContainer from "/imports/plugins/core/dashboard/client/containers/toolbarContainer";
import Toolbar from "/imports/plugins/core/dashboard/client/components/toolbar";
import { ActionViewContainer } from "/imports/plugins/core/dashboard/client/containers";
Expand Down Expand Up @@ -61,7 +60,13 @@ Template.coreAdminLayout.helpers({
tooltipPosition: "left middle",
onClick(event) {
if (!instance.dropInstance) {
instance.dropInstance = new Drop({ target: event.currentTarget, content: "", constrainToWindow: true, classes: "drop-theme-arrows", position: "right center" });
instance.dropInstance = new Drop({
target: event.currentTarget,
content: "",
constrainToWindow: true,
classes: "drop-theme-arrows",
position: "right center"
});

Blaze.renderWithData(Template.createContentMenu, {}, instance.dropInstance.content);
}
Expand Down Expand Up @@ -148,21 +153,3 @@ Template.coreAdminLayout.helpers({
return reactionApp;
}
});

// Template.coreAdminLayout.events({ /**
// * Submit sign up form
// * @param {Event} event - jQuery Event
// * @param {Template} template - Blaze Template
// * @return {void} */ "click .admin-controls-quicklinks a, click .admin-controls-quicklinks button"(event) {
// if (this.name === "createProduct") { event.preventDefault(); event.stopPropagation();
//
// if (!this.dropInstance) { this.dropInstance = new Drop({ target: event.target,
// content: "", constrainToWindow: true, classes: "drop-theme-arrows", position: "right
// center" });
//
// Blaze.renderWithData(Template.createContentMenu, {}, this.dropInstance.content); }
//
// this.dropInstance.open(); } else if (this.route) { event.preventDefault();
// event.stopPropagation();
//
// Reaction.Router.go(this.name); } } });
Expand Up @@ -74,7 +74,6 @@ Alerts = {
*/
add: function (alertMessage, mode, alertOptions) {
let a;
let count;
let message = alertMessage;
let options = alertOptions;
// check options to see if we have translation
Expand All @@ -99,7 +98,8 @@ Alerts = {
return;
}
}
count = Alerts.collection_.find({}).count();

const count = Alerts.collection_.find({}).count();
if (count >= options.alertsLimit) {
Alerts.collection_.find({}, {
sort: {
Expand Down
1 change: 0 additions & 1 deletion imports/plugins/core/layout/server/methods/templates.js
@@ -1,4 +1,3 @@
import { Meteor } from "meteor/meteor";
import { check } from "meteor/check";
import { Templates } from "/lib/collections";
import { Reaction } from "/server/api";
Expand Down
2 changes: 1 addition & 1 deletion imports/plugins/core/payments/client/settings/settings.js
@@ -1,6 +1,6 @@
import { Template } from "meteor/templating";
import { Reaction, i18next } from "/client/api";
import { Shops, Packages } from "/lib/collections";
import { Shops } from "/lib/collections";

Template.paymentSettings.helpers({
checked(enabled) {
Expand Down
@@ -1,7 +1,7 @@
import React, { Component, PropTypes } from "react";
import { composeWithTracker } from "/lib/api/compose";
import PublishControls from "../components/publishControls";
import { Tags, Revisions } from "/lib/collections";
import { Revisions } from "/lib/collections";
import { Meteor } from "meteor/meteor";
import TranslationProvider from "/imports/plugins/core/ui/client/providers/translationProvider";
import { isRevisionControlEnabled } from "../../lib/api";
Expand Down
3 changes: 1 addition & 2 deletions imports/plugins/core/revisions/server/publications.js
@@ -1,5 +1,4 @@
import { Products, Revisions } from "/lib/collections";
import { Reaction } from "/server/api";
import { Revisions } from "/lib/collections";

/**
* products publication
Expand Down
14 changes: 0 additions & 14 deletions imports/plugins/core/taxes/client/settings/settings.js
@@ -1,8 +1,6 @@
import { Template } from "meteor/templating";
import { Packages } from "/lib/collections";
import { TaxCodes } from "../../lib/collections";
import { i18next } from "/client/api";
import { TaxPackageConfig } from "../../lib/collections/schemas";

/*
* Template taxes Helpers
Expand All @@ -26,18 +24,6 @@ Template.taxSettings.helpers({
}
return "";
},
// packageConfigSchema() {
// return TaxPackageConfig;
// },
//
// get current packages settings data
//
// packageData() {
// return Packages.findOne({
// name: "reaction-taxes"
// });
// },
//
// prepare and return taxCodes
// for default shop value
//
Expand Down
6 changes: 6 additions & 0 deletions imports/plugins/core/ui/client/components/alerts/alerts.js
Expand Up @@ -26,4 +26,10 @@ class Alerts extends Component {
}
}

Alerts.propTypes = {
alerts: PropTypes.arrayOf(PropTypes.object),
onAlertRemove: PropTypes.func,
onAlertSeen: PropTypes.func
};

export default Alerts;
9 changes: 7 additions & 2 deletions imports/plugins/core/ui/client/components/button/button.js
Expand Up @@ -39,8 +39,13 @@ Template.button.helpers({
const data = Template.currentData();
const {
// Remove unneeded attributes
title, label, status, i18nKeyTitle, i18nKeyLabel, i18nKeyTooltip,
tooltip, className, type, href, icon, toggle, onIcon, toggleOn, onClick,
className, status, type, href,

// Pull out invalid HTML attributes / unuesed attributes
/* eslint-disable */
title, label, i18nKeyTitle, i18nKeyLabel, i18nKeyTooltip,
tooltip, icon, toggle, onIcon, toggleOn, onClick,
/* eslint-enable */

// Get the rest of the properties and put them in attrs
// these will most likely be HTML attributes
Expand Down
@@ -1,8 +1,6 @@
/* eslint no-unused-vars: 1 */
//
// TODO review PropTypes import in flatButton.js
//
import React, { Component, PropTypes } from "react";

import React, { Component } from "react";
import classnames from "classnames";
import Button from "./button.jsx";

Expand Down
7 changes: 4 additions & 3 deletions imports/plugins/core/ui/client/components/icon/icon.jsx
Expand Up @@ -11,15 +11,15 @@ class Icon extends Component {
classes = icon;
} else {
classes = classnames({
"fa": true,
fa: true,
[`fa-${icon}`]: true
});
}
}

classes = classnames({
"rui": true,
"font-icon": true,
"font-icon": true
}, classes, this.props.className);

return (
Expand All @@ -30,7 +30,8 @@ class Icon extends Component {

Icon.propTypes = {
className: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
icon: PropTypes.string.isRequired
icon: PropTypes.string.isRequired,
style: PropTypes.object
};

export default Icon;
13 changes: 0 additions & 13 deletions imports/plugins/core/ui/client/components/media/media.js
Expand Up @@ -75,19 +75,6 @@ class MediaItem extends Component {
}

renderImage() {
const mediaHeight = this.props.mediaHeight;
const mediaWidth = this.props.mediaWidth;

let maxHeight = "auto";
let maxWidth = "100%";

if (this.props.isFeatured) {
if (mediaHeight > mediaWidth) {
maxHeight = mediaWidth + "px";
maxWidth = (mediaWidth / mediaHeight) * mediaWidth;
}
}

const image = (
<img
alt=""
Expand Down
Expand Up @@ -63,6 +63,7 @@ class DropDownMenu extends Component {
}

DropDownMenu.propTypes = {
buttonElement: PropTypes.node,
children: PropTypes.node,
isEnabled: PropTypes.bool,
onChange: PropTypes.func,
Expand Down
5 changes: 1 addition & 4 deletions imports/plugins/core/ui/client/components/menu/menu.js
@@ -1,10 +1,6 @@
import React, { Children, Component, PropTypes } from "react";
import TetherComponent from "react-tether";
import classnames from "classnames";


class Menu extends Component {

handleChange = (event, value, menuItem) => {
if (this.props.onChange) {
this.props.onChange(event, value, menuItem);
Expand Down Expand Up @@ -38,6 +34,7 @@ class Menu extends Component {
Menu.propTypes = {
attachment: PropTypes.string,
children: PropTypes.node,
onChange: PropTypes.func,
value: PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.number])
};

Expand Down
@@ -1,5 +1,4 @@
import React, { Component, PropTypes } from "react";
import classnames from "classnames";
import onclickOutside from "react-onclickoutside";

class PopoverContent extends Component {
Expand All @@ -19,6 +18,7 @@ class PopoverContent extends Component {
}

PopoverContent.propTypes = {
children: PropTypes.node,
onClickOutside: PropTypes.func
};

Expand Down
14 changes: 7 additions & 7 deletions imports/plugins/core/ui/client/components/slider/slider.js
Expand Up @@ -25,16 +25,16 @@ class Slider extends Component {
}

Slider.propTypes = {
range: PropTypes.object,
start: PropTypes.arrayOf(PropTypes.number),
connect: PropTypes.oneOfType([PropTypes.array, PropTypes.bool]),
step: PropTypes.number,
orientation: PropTypes.string,
tooltips: PropTypes.oneOfType([PropTypes.array, PropTypes.bool]),
margin: PropTypes.number,
padding: PropTypes.number,
onChange: PropTypes.func,
onSlide: PropTypes.func
onSlide: PropTypes.func,
orientation: PropTypes.string,
padding: PropTypes.number,
range: PropTypes.object,
start: PropTypes.arrayOf(PropTypes.number),
step: PropTypes.number,
tooltips: PropTypes.oneOfType([PropTypes.array, PropTypes.bool])
};

Slider.defaultProps = {
Expand Down

0 comments on commit b326c23

Please sign in to comment.