Skip to content

Commit b8e21bb

Browse files
committed
code linting and cleanup
1 parent c05273a commit b8e21bb

18 files changed

+430
-414
lines changed

.eslintrc.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
"use strict";
2+
3+
module.exports = {
4+
extends: [
5+
"reverentgeek/browser",
6+
"reverentgeek/blog",
7+
"plugin:react/recommended"
8+
],
9+
rules: {
10+
"no-var": [ "error" ]
11+
}
12+
};

package-lock.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,10 @@
3737
"last 1 firefox version",
3838
"last 1 safari version"
3939
]
40+
},
41+
"devDependencies": {
42+
"eslint": "^6.8.0",
43+
"eslint-config-reverentgeek": "^2.1.2",
44+
"eslint-plugin-react": "^7.19.0"
4045
}
4146
}

src/App.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import React from 'react';
2-
import { BrowserRouter as Router } from 'react-router-dom';
3-
import AppWithRouterAccess from './AppWithRouterAccess';
4-
import 'bootstrap/dist/css/bootstrap.min.css';
1+
import React from "react";
2+
import { BrowserRouter as Router } from "react-router-dom";
3+
import AppWithRouterAccess from "./AppWithRouterAccess";
4+
import "bootstrap/dist/css/bootstrap.min.css";
55

66
const App = () => {
77
return (
88
<Router>
99
<AppWithRouterAccess/>
1010
</Router>
1111
);
12-
}
12+
};
1313

14-
export default App;
14+
export default App;

src/App.test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import React from 'react';
2-
import { render } from '@testing-library/react';
3-
import App from './App';
1+
import React from "react";
2+
import { render } from "@testing-library/react";
3+
import App from "./App";
44

5-
test('renders learn react link', () => {
6-
const { getByText } = render(<App />);
7-
const linkElement = getByText(/learn react/i);
8-
expect(linkElement).toBeInTheDocument();
9-
});
5+
test( "renders learn react link", () => {
6+
const { getByText } = render( <App /> );
7+
const linkElement = getByText( /learn react/i );
8+
expect( linkElement ).toBeInTheDocument();
9+
} );

src/AppWithRouterAccess.jsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
import React from 'react';
2-
import { Route, useHistory } from 'react-router-dom';
3-
import { Security, SecureRoute, LoginCallback } from '@okta/okta-react';
4-
import Home from './Pages/Home';
5-
import Game from './Pages/Game'
6-
import Login from './Pages/Login'
1+
import React from "react";
2+
import { Route, useHistory } from "react-router-dom";
3+
import { Security, SecureRoute, LoginCallback } from "@okta/okta-react";
4+
import Home from "./Pages/Home";
5+
import Game from "./Pages/Game";
6+
import Login from "./Pages/Login";
77

88
const AppWithRouterAccess = () => {
99
const history = useHistory();
1010
const onAuthRequired = () => {
11-
history.push('/login');
11+
history.push( "/login" );
1212
};
1313

1414
const baseDomain = process.env.REACT_APP_OKTA_URL_BASE;
15-
const issuer = baseDomain + '/oauth2/default'
15+
const issuer = baseDomain + "/oauth2/default";
1616
const clientId = process.env.REACT_APP_OKTA_CLIENTID;
17-
const redirect = process.env.REACT_APP_OKTA_APP_BASE_URL + '/implicit/callback';
17+
const redirect = process.env.REACT_APP_OKTA_APP_BASE_URL + "/implicit/callback";
1818

1919
return (
2020
<Security issuer={issuer}
@@ -29,4 +29,4 @@ const AppWithRouterAccess = () => {
2929
</Security>
3030
);
3131
};
32-
export default AppWithRouterAccess;
32+
export default AppWithRouterAccess;

src/Components/Card.jsx

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
import React from 'react';
1+
import React from "react";
22

3-
import '../cards.css';
3+
import "../cards.css";
44

5-
const Card = ({ card }) => {
5+
const Card = ( { card } ) => {
66

7-
var content;
7+
let content;
88

9-
if (card.visible) {
10-
var cardClass = "card rank-" + card.rank.toLowerCase() + " " + card.suit;
11-
content =
9+
if ( card.visible ) {
10+
const cardClass = "card rank-" + card.rank.toLowerCase() + " " + card.suit;
11+
content =
1212
<div className={cardClass}>
13-
<div className="rank">{card.rank}</div>
14-
<div className="suit"></div>
13+
<div className="rank">{card.rank}</div>
14+
<div className="suit"></div>
1515
</ div>;
16-
}
17-
else {
18-
content = <div className="card back">*</div>
19-
}
16+
}
17+
else {
18+
content = <div className="card back">*</div>;
19+
}
2020

21-
return (
22-
<div className="playingCards faceImages">
23-
{content}
24-
</div>
25-
);
21+
return (
22+
<div className="playingCards faceImages">
23+
{content}
24+
</div>
25+
);
2626
};
2727

28-
export default Card;
28+
export default Card;

0 commit comments

Comments
 (0)