Skip to content

Commit 22967b4

Browse files
committed
Linting fixes
1 parent 505bb12 commit 22967b4

File tree

6 files changed

+196
-26
lines changed

6 files changed

+196
-26
lines changed

.babelrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"plugins": [
3+
["transform-class-properties", { "spec": true }]
4+
]
5+
}

.eslintrc.json

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
{
2-
"extends": "airbnb",
1+
{
2+
"parser": "babel-eslint",
3+
"extends": ["plugin:prettier/recommended"],
34
"parserOptions": {
45
"ecmaVersion": 6,
56
"sourceType": "module",
@@ -8,7 +9,9 @@
89
}
910
},
1011
"rules": {
11-
"semi": 2
12+
"strict": 0,
13+
"semi": 2,
14+
"arrow-parens": 0
1215
},
1316
"globals": {
1417
"document": true,

package.json

+9
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
"eslint-config-airbnb": "^16.1.0",
77
"eslint-plugin-import": "^2.8.0",
88
"eslint-plugin-jsx-a11y": "^6.0.3",
9+
"eslint-plugin-prettier": "^2.6.0",
910
"eslint-plugin-react": "^7.6.1",
11+
"prettier": "^1.10.2",
12+
"prop-types": "^15.6.0",
1013
"react": "^16.2.0",
1114
"react-dom": "^16.2.0",
1215
"react-scripts": "1.1.1",
@@ -18,5 +21,11 @@
1821
"test": "react-scripts test --env=jsdom",
1922
"eject": "react-scripts eject",
2023
"lint": "eslint"
24+
},
25+
"devDependencies": {
26+
"babel-eslint": "^8.2.1",
27+
"babel-plugin-transform-class-properties": "^6.24.1",
28+
"eslint": "^4.18.0",
29+
"eslint-config-prettier": "^2.9.0"
2130
}
2231
}

src/module/MemoryCard.jsx

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
import React from "react";
2-
import PropTypes from "prop-types";
3-
import styled from "styled-components";
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
import styled from 'styled-components';
44

55
export const CARD_STATE = {
6-
CLOSED: "CLOSED",
7-
OPEN: "OPEN",
8-
FOUND: "FOUND"
6+
CLOSED: 'CLOSED',
7+
OPEN: 'OPEN',
8+
FOUND: 'FOUND',
99
};
1010

1111
const Card = styled.button`
1212
cursor: pointer;
1313
flex 1 0 0%;
1414
background: rgba(255, 255, 255, .8);
1515
background: ${state => {
16-
debugger;
17-
return state.state === CARD_STATE.CLOSED ? "red" : "blue";
16+
return state.state === CARD_STATE.CLOSED ? 'red' : 'blue';
1817
}};
1918
color: #333;
2019
padding: 10%;

src/module/index.jsx

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
import React, { Component } from "react";
2-
import PropTypes from "prop-types";
3-
import { shuffle } from "lodash";
1+
import React, { Component } from 'react';
2+
import PropTypes from 'prop-types';
3+
import { shuffle } from 'lodash';
44

5-
import MemoryGrid from "./MemoryGrid";
6-
import MemoryCard, { CARD_STATE } from "./MemoryCard";
5+
import MemoryGrid from './MemoryGrid';
6+
import MemoryCard, { CARD_STATE } from './MemoryCard';
77

88
export class MemoryGame extends Component {
99
static propTypes = {
10-
cards: PropTypes.arrayOf(PropTypes.any).isRequired
10+
cards: PropTypes.arrayOf(PropTypes.any).isRequired,
1111
};
1212

1313
constructor(props) {
1414
super(props);
1515
this.state = {
1616
cards: shuffle(props.cards.concat(props.cards)).map(value => ({
1717
value,
18-
state: CARD_STATE.CLOSED
19-
}))
18+
state: CARD_STATE.CLOSED,
19+
})),
2020
};
2121
}
2222

0 commit comments

Comments
 (0)