Skip to content
This repository has been archived by the owner on Mar 19, 2019. It is now read-only.

Commit

Permalink
Update swag shop to be compatible with Reaction v1.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
prinzdezibel committed Mar 20, 2018
1 parent b93df34 commit 5a18517
Show file tree
Hide file tree
Showing 38 changed files with 2,626 additions and 1,141 deletions.
142 changes: 120 additions & 22 deletions .eslintrc
@@ -1,23 +1,27 @@
{
"parser": "babel-eslint", // now for the support of allowImportExportEverywhere
"parser": "babel-eslint",
"extends": [
"plugin:jsx-a11y/recommended"
],
"env": {
"browser": true,
"node": true,
"es6": true,
"mocha": true
"jest/globals": true,
"mocha": true,
"node": true
},
"globals": {
"browser": true,
"Assets": true, // Meteor global
"Package": true, // Meteor global
"FS": true, // gridFS,
"Alerts": true, // this needs to get cleaned up, but ignoring for now
"jest": true,
"expect": true,
"test": true
"gm": true, // cfs:graphicsmagick
"Alerts": true // this needs to get cleaned up, but ignoring for now
},
"settings": {
"import/resolver": "meteor"
},
"parserOptions": {
"ecmaVersion": 6,
"ecmaVersion": 2017,
"sourceType": "module",
"ecmaFeatures": {
"arrowFunctions": true,
Expand All @@ -39,8 +43,7 @@
},
"allowImportExportEverywhere": true
},
"plugins": ["react"],
// NOTE: We're now using eslint-4
"plugins": ["import", "jest", "jsx-a11y", "react"],
"rules": {
/**
* Strict mode
Expand All @@ -54,23 +57,25 @@
*/
"object-curly-spacing": ["error", "always", { "objectsInObjects": true }],
"no-var": 2, // http://eslint.org/docs/rules/no-var

/**
* Variables
*/
"no-shadow": 2, // http://eslint.org/docs/rules/no-shadow
"no-shadow-restricted-names": 2, // http://eslint.org/docs/rules/no-shadow-restricted-names
"no-const-assign": 2, // http://eslint.org/docs/rules/no-const-assign
"no-unused-vars": [2, { // http://eslint.org/docs/rules/no-unused-vars
"vars": "local",
"args": "after-used"
"vars": "all",
"args": "after-used",
"ignoreRestSiblings": true
}],
"no-use-before-define": [2, "nofunc"], // http://eslint.org/docs/rules/no-use-before-define
"no-implicit-globals": 2, // http://eslint.org/docs/rules/no-implicit-globals

/**
* Possible errors
*/
"comma-dangle": [2, "never"], // http://eslint.org/docs/rules/comma-dangle
"comma-dangle": ["error", "never"], // http://eslint.org/docs/rules/comma-dangle
"no-cond-assign": [2, "always"], // http://eslint.org/docs/rules/no-cond-assign
"no-console": 2, // http://eslint.org/docs/rules/no-console
"no-debugger": 1, // http://eslint.org/docs/rules/no-debugger
Expand All @@ -80,7 +85,7 @@
"no-duplicate-case": 2, // http://eslint.org/docs/rules/no-duplicate-case
"no-empty": 2, // http://eslint.org/docs/rules/no-empty
"no-ex-assign": 2, // http://eslint.org/docs/rules/no-ex-assign
"no-extra-boolean-cast": 0, // http://eslint.org/docs/rules/no-extra-boolean-cast
"no-extra-boolean-cast": 2, // http://eslint.org/docs/rules/no-extra-boolean-cast
"no-extra-semi": 2, // http://eslint.org/docs/rules/no-extra-semi
"no-func-assign": 2, // http://eslint.org/docs/rules/no-func-assign
"no-inner-declarations": 2, // http://eslint.org/docs/rules/no-inner-declarations
Expand Down Expand Up @@ -166,7 +171,7 @@
"no-param-reassign": 2, // http://eslint.org/docs/rules/no-param-reassign
"no-proto": 2, // http://eslint.org/docs/rules/no-proto
"no-redeclare": 2, // http://eslint.org/docs/rules/no-redeclare
"no-return-assign": 2, // http://eslint.org/docs/rules/no-return-assign
"no-return-assign": ["error", "always"], // http://eslint.org/docs/rules/no-return-assign
"no-script-url": 2, // http://eslint.org/docs/rules/no-script-url
"no-self-compare": 2, // http://eslint.org/docs/rules/no-self-compare
"no-sequences": 2, // http://eslint.org/docs/rules/no-sequences
Expand All @@ -175,7 +180,7 @@
"no-undef": 2,
"radix": 2, // http://eslint.org/docs/rules/radix
"vars-on-top": 2, // http://eslint.org/docs/rules/vars-on-top
"wrap-iife": [2, "any"], // http://eslint.org/docs/rules/wrap-iife
"wrap-iife": ["error", "outside", { "functionPrototypeMethods": false }], // http://eslint.org/docs/rules/wrap-iife
"yoda": 2, // http://eslint.org/docs/rules/yoda
"max-len": [1, 160, 2, {
"ignoreComments": true,
Expand All @@ -196,6 +201,7 @@
}
}], // http://eslint.org/docs/rules/valid-jsdoc
"quote-props": [2, "consistent-as-needed"], // http://eslint.org/docs/rules/quote-props

/**
* Style
*/
Expand All @@ -205,9 +211,7 @@
"allowSingleLine": true
}
],
"quotes": [
2, "double", "avoid-escape" // http://eslint.org/docs/rules/quotes
],
"quotes": ["error", "double", { "avoidEscape": true }], // http://eslint.org/docs/rules/quotes
"camelcase": [2, { // http://eslint.org/docs/rules/camelcase
"properties": "always"
}],
Expand Down Expand Up @@ -253,6 +257,100 @@
"space-infix-ops": 2, // http://eslint.org/docs/rules/space-infix-ops
"space-in-parens": [2, "never"], // http://eslint.org/docs/rules/space-in-parens
"spaced-comment": [2, "always"], // http://eslint.org/docs/rules/spaced-comment
"arrow-spacing": [2, { "before": true, "after": true }] // https://eslint.org/docs/rules/arrow-spacing
"arrow-spacing": [2, { "before": true, "after": true }], // https://eslint.org/docs/rules/arrow-spacing

/**
* Additional rules to enable one by one
*/
"array-bracket-spacing": ["error", "never"],
"array-callback-return": ["error", { "allowImplicit": true }],
"arrow-body-style": ["error", "as-needed", { "requireReturnForObjectLiteral": false }],
"arrow-parens": [ "error", "always", { "requireForBlockBody": true }],
"block-spacing": ["error", "always"],
"computed-property-spacing": ["error", "never"],
"dot-location": ["error", "property"],
"function-paren-newline": ["error", "multiline"],
"import/export": "error",
"import/order": ["error", {
"groups": [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index"
]
}],
"import/newline-after-import": "error",
"import/no-duplicates": "error",
"import/no-mutable-exports": "error",
"import/no-named-default": "error",
"new-parens": "error",
"newline-per-chained-call": ["error", { "ignoreChainWithDepth": 4 }],
"no-await-in-loop": "error",
"no-bitwise": "error",
"no-case-declarations": "error",
"no-confusing-arrow": ["error", { "allowParens": true }],
"no-empty-pattern": "error",
"no-lonely-if": "error",
// This rule copied from Airbnb's config
"no-mixed-operators": ["error", {
"groups": [
["%", "**"],
["%", "+"],
["%", "-"],
["%", "*"],
["%", "/"],
["**", "+"],
["**", "-"],
["**", "*"],
["**", "/"],
["&", "|", "^", "~", "<<", ">>", ">>>"],
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
["&&", "||"],
["in", "instanceof"]
],
"allowSamePrecedence": false
}],
"no-multi-assign": ["error"],
"no-multi-spaces": ["error", { "ignoreEOLComments": false }],
"no-plusplus": "error",
"no-prototype-builtins": "error",
"no-tabs": "error",
"no-undef-init": "error",
"no-unneeded-ternary": ["error", { "defaultAssignment": false }],
"no-unsafe-finally": "error",
"no-useless-computed-key": "error",
"no-useless-concat": "error",
"no-useless-constructor": "error",
"no-useless-escape": "error",
"no-void": "error",
"object-curly-newline": ["error", { "ObjectExpression": { "multiline": true, "consistent": true }, "ObjectPattern": { "multiline": true, "consistent": true } }],
"object-property-newline": ["error", { "allowAllPropertiesOnSameLine": true }],
"object-shorthand": ["error", "always"],
"operator-assignment": ["error", "always"],
"prefer-arrow-callback": ["error", { "allowNamedFunctions": false, "allowUnboundThis": true }],
"prefer-destructuring": ["error", {
"VariableDeclarator": {
"array": false,
"object": true
},
"AssignmentExpression": {
"array": true,
"object": true
}
}, {
"enforceForRenamedProperties": false
}],
"prefer-rest-params": "error",
"prefer-spread": "error",
"prefer-template": "error",
"rest-spread-spacing": ["error", "never"],
"space-unary-ops": ["error", {
"words": true,
"nonwords": false,
"overrides": {}
}],
"template-curly-spacing": "error"
}
}
}
4 changes: 2 additions & 2 deletions client/components/cartIcon.js
@@ -1,10 +1,10 @@
import React from "react";
import PropTypes from "prop-types";
import { Components } from "@reactioncommerce/reaction-components";
import { Components } from "@reactioncommerce/reaction-components";


const CartIcon = ({ handleClick, cart }) => (
<div className="cart-icon" onClick={handleClick}>
<div className="cart-icon" onClick={handleClick} role={"presentation"}>
<span data-event-category="cart">
<Components.Translation
className="cart-label"
Expand Down
2 changes: 1 addition & 1 deletion client/components/core/ui/icon/icon.js
Expand Up @@ -27,7 +27,7 @@ const Icon = ({ className, icon, style, onClick }) => {
}, classes, className);

return (
<i style={style} className={classes} onClick={onClick} />
<i style={style} className={classes} onClick={onClick} role={"presentation"}/>
);
};

Expand Down
116 changes: 58 additions & 58 deletions client/components/core/ui/tags/tagItem.js
Expand Up @@ -12,8 +12,8 @@ import { Tags } from "/lib/collections/index";
the exported React component is already wrapped with a HOC. We need the rawComponent here to extend.
*/
class TagItem extends getRawComponent("TagItem") {
constructor() {
super(...arguments);
constructor(...args) {
super(...args);
this.state = {
popOverIsOpen: false,
catTileImageUrl: this.tag.catTileImageUrl,
Expand All @@ -36,7 +36,7 @@ class TagItem extends getRawComponent("TagItem") {
}

handleBlur = (event) => {
let value = event.currentTarget.value;
let { value } = event.currentTarget;
if (typeof value !== "string") {
return;
}
Expand Down Expand Up @@ -80,62 +80,62 @@ class TagItem extends getRawComponent("TagItem") {
"full-width": this.props.fullWidth
});

return (
this.props.connectDropTarget(
<div onMouseLeave={this.handleMouseLeave} className="rui item edit draggable">
<div
className={baseClassName}
data-id={this.props.tag._id}
>
<form onSubmit={this.handleTagFormSubmit}>
<Components.Popover
isOpen={this.state.popOverIsOpen}
attachment="top left"
targetAttachment="bottom left"
constraints={[
{
to: "scrollParent",
pin: true
},
{
to: "window",
attachment: "together"
}
]}
showDropdownButton={false}
>
<div ref="popoverContent" onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave} className={"tag-image-form"}>
<Components.TextField
label="Category Tile Image URL"
i18nKeyLabel="catTileImageUrl"
type="text"
name="catTileImageUrl"
value={this.state.catTileImageUrl}
onBlur={this.handleBlur}
onChange={this.handleImageUrlChange}
/>
<Components.TextField
label="Category Hero Image URL"
i18nKeyLabel="catHeroImageUrl"
type="text"
name="catHeroImageUrl"
value={this.state.catHeroImageUrl}
onBlur={this.handleBlur}
onChange={this.handleImageUrlChange}
/>
</div>
</Components.Popover>
<Handle onClick={this.handleHandleClick} connectDragSource={this.props.connectDragSource} />
{this.renderAutosuggestInput()}
<Button icon="times-circle" onClick={this.handleTagRemove} status="danger" />
{this.props.isTagNav &&
<Button icon="chevron-down" onClick={this.handleTagSelect} status="default" />
return this.props.connectDropTarget(<div onMouseLeave={this.handleMouseLeave} className="rui item edit draggable">
<div
className={baseClassName}
data-id={this.props.tag._id}
>
<form onSubmit={this.handleTagFormSubmit}>
<Components.Popover
isOpen={this.state.popOverIsOpen}
attachment="top left"
targetAttachment="bottom left"
constraints={[
{
to: "scrollParent",
pin: true
},
{
to: "window",
attachment: "together"
}
</form>
</div>
</div>
)
);
]}
showDropdownButton={false}
>
<div ref="popoverContent"
onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave}
className={"tag-image-form"}
>
<Components.TextField
label="Category Tile Image URL"
i18nKeyLabel="catTileImageUrl"
type="text"
name="catTileImageUrl"
value={this.state.catTileImageUrl}
onBlur={this.handleBlur}
onChange={this.handleImageUrlChange}
/>
<Components.TextField
label="Category Hero Image URL"
i18nKeyLabel="catHeroImageUrl"
type="text"
name="catHeroImageUrl"
value={this.state.catHeroImageUrl}
onBlur={this.handleBlur}
onChange={this.handleImageUrlChange}
/>
</div>
</Components.Popover>
<Handle onClick={this.handleHandleClick} connectDragSource={this.props.connectDragSource} />
{this.renderAutosuggestInput()}
<Button icon="times-circle" onClick={this.handleTagRemove} status="danger" />
{this.props.isTagNav &&
<Button icon="chevron-down" onClick={this.handleTagSelect} status="default" />
}
</form>
</div>
</div>);
}
}

Expand Down

0 comments on commit 5a18517

Please sign in to comment.