Skip to content

Commit

Permalink
lint all of example app and add example to lint script
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Lund committed May 3, 2018
1 parent 3ced2d6 commit dbe78c1
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 46 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/example/test-app/node_modules
/example/test-app/src/registerServiceWorker.js
6 changes: 0 additions & 6 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
{
"globals": {
"Stripe": false,
"CONFIG": false,
"React": true,
"analytics": true
},
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
Expand Down
12 changes: 6 additions & 6 deletions example/test-app/src/App.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React, { Component } from "react";
import logo from "./logo.svg";
import "./App.css";
import FeatureWithVariantsDisplay from "./appStuff/containers/FeatureWithVariantsDisplay";
import FeatureDisplay from "./appStuff/containers/FeatureDisplay";
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
import FeatureWithVariantsDisplay from './appStuff/containers/FeatureWithVariantsDisplay';
import FeatureDisplay from './appStuff/containers/FeatureDisplay';

class App extends Component {
render() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<img src={ logo } className="App-logo" alt="logo" />
<h1 className="App-title">Welcome to LD Redux Components</h1>
</header>
<div className="App-intro">
Expand Down
8 changes: 4 additions & 4 deletions example/test-app/src/appStuff/components/item.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import React from "react";
import PropTypes from "prop-types";
import React from 'react';
import PropTypes from 'prop-types';
const Item = ({ name, color, icon }) => (
<div>
<p>{name}</p>
<i style={{ color: color }} className={"fa fa-10x fa-" + icon} />
<i style={ { color: color } } className={ `fa fa-10x fa-${icon}` } />
</div>
);

Item.propTypes = {
name: PropTypes.string.isRequired,
color: PropTypes.string.isRequired,
icon: PropTypes.string.isRequired
icon: PropTypes.string.isRequired,
};

export default Item;
12 changes: 6 additions & 6 deletions example/test-app/src/appStuff/containers/FeatureDisplay.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import React, { Component, Fragment } from "react";
import Item from "./../components/item";
import { Feature, Variant } from "ld-redux-components";
import React, { Component, Fragment } from 'react';
import Item from './../components/item';
import { Feature } from 'ld-redux-components';

export default class FeatureDisplay extends Component {
render() {
return (
<Fragment>
<Feature flagId="test-flag-id" variation={true}>
<Feature flagId="test-flag-id" variation={ true }>
<Item name="FLAG IS TRUE" icon="smile" color="green" />
</Feature>
<Feature flagId="test-flag-id" variation={false}>
<Feature flagId="test-flag-id" variation={ false }>
<Item name="FLAG IS FALSE" icon="frown" color="red" />
</Feature>
<Feature flagId="test-flag-id" variation={null}>
<Feature flagId="test-flag-id" variation={ null }>
<Item name="FLAG IS NULL" icon="meh" color="blue" />
</Feature>
</Fragment>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import React, { Component, Fragment } from "react";
import Item from "./../components/item";
import { Feature, Variant } from "ld-redux-components";
import React, { Component, Fragment } from 'react';
import Item from './../components/item';
import { Feature, Variant } from 'ld-redux-components';

export default class FeatureWithVariantsDisplay extends Component {
render() {
return (
<Fragment>
<Feature flagId="test-flag-id">
<Variant name={true}>
<Variant name={ true }>
<Item name="FLAG IS TRUE" icon="smile" color="green" />
</Variant>
<Variant name={false}>
<Variant name={ false }>
<Item name="FLAG IS FALSE" icon="frown" color="red" />
</Variant>
<Variant isDefault>
Expand Down
30 changes: 15 additions & 15 deletions example/test-app/src/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import App from "./App";
import { Provider } from "react-redux";
import { createStore } from "redux";
import ldRedux from "ld-redux";
import myApp from "./rootReducer";
import registerServiceWorker from "./registerServiceWorker";
import { ldrComponentConfig } from "ld-redux-components";
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import { Provider } from 'react-redux';
import { createStore } from 'redux';
import ldRedux from 'ld-redux';
import myApp from './rootReducer';
import registerServiceWorker from './registerServiceWorker';
import { ldrComponentConfig } from 'ld-redux-components';

const store = createStore(
myApp,
Expand All @@ -16,19 +16,19 @@ const store = createStore(
);

ldRedux.init({
clientSideId: "YOUR_CLIENT_SIDE_ID", //SET THIS TO SEE THE EXAMPLE
clientSideId: 'YOUR_CLIENT_SIDE_ID', //SET THIS TO SEE THE EXAMPLE
store,
flags: { "test-flag-id": true } //SET THIS TO A REAL FLAG ID TO SEE AN EXAMPLE
flags: { 'test-flag-id': true }, //SET THIS TO A REAL FLAG ID TO SEE AN EXAMPLE
});

ldrComponentConfig.init({
reduxKey: "LD" //This value will be the key in your redux store where you flags are
reduxKey: 'LD', //This value will be the key in your redux store where you flags are
});

ReactDOM.render(
<Provider store={store}>
<Provider store={ store }>
<App />
</Provider>,
document.getElementById("root")
document.getElementById('root')
);
registerServiceWorker();
6 changes: 3 additions & 3 deletions example/test-app/src/rootReducer.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { combineReducers } from "redux";
import ldRedux from "ld-redux";
import { combineReducers } from 'redux';
import ldRedux from 'ld-redux';

const myApp = combineReducers({
LD: ldRedux.reducer()
LD: ldRedux.reducer(),
});

export default myApp;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"build": "./node_modules/.bin/babel src --out-dir build",
"clean": "rimraf build",
"prepare": "yarn clean && yarn build",
"lint": "./node_modules/.bin/eslint src test spec",
"lint": "./node_modules/.bin/eslint src test spec example",
"unit": "./node_modules/.bin/jest",
"test": "yarn lint && yarn unit"
},
Expand Down

0 comments on commit dbe78c1

Please sign in to comment.