Skip to content

Commit ac20151

Browse files
committed
implement 11.6 Fix the code
1 parent 5ef61e0 commit ac20151

File tree

5 files changed

+51
-45
lines changed

5 files changed

+51
-45
lines changed

.eslintrc.js

+42-36
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,55 @@
11
module.exports = {
2-
"env": {
3-
"browser": true,
4-
"es6": true,
5-
"jest/globals": true
2+
'env': {
3+
'browser': true,
4+
'es6': true,
5+
'jest/globals': true,
6+
'node': true
67
},
7-
"extends": [
8-
"eslint:recommended",
9-
"plugin:react/recommended"
8+
'extends': [
9+
'eslint:recommended',
10+
'plugin:react/recommended'
1011
],
11-
"parserOptions": {
12-
"ecmaFeatures": {
13-
"jsx": true
12+
'parserOptions': {
13+
'ecmaFeatures': {
14+
'jsx': true
1415
},
15-
"ecmaVersion": 2018,
16-
"sourceType": "module"
16+
'ecmaVersion': 2018,
17+
'sourceType': 'module'
1718
},
18-
"plugins": [
19-
"react", "jest"
19+
'plugins': [
20+
'react', 'jest'
2021
],
21-
"rules": {
22-
"indent": [
23-
"error",
24-
2
25-
],
26-
"linebreak-style": [
27-
"error",
28-
"unix"
22+
'settings': {
23+
'react': {
24+
'version': 'detect'
25+
}
26+
},
27+
'rules': {
28+
'indent': [
29+
'error',
30+
2
31+
],
32+
'linebreak-style': [
33+
'error',
34+
'unix'
2935
],
30-
"quotes": [
31-
"error",
32-
"single"
36+
'quotes': [
37+
'error',
38+
'single'
3339
],
34-
"semi": [
35-
"error",
36-
"never"
40+
'semi': [
41+
'error',
42+
'never'
3743
],
38-
"eqeqeq": "error",
39-
"no-trailing-spaces": "error",
40-
"object-curly-spacing": [
41-
"error", "always"
44+
'eqeqeq': 'error',
45+
'no-trailing-spaces': 'error',
46+
'object-curly-spacing': [
47+
'error', 'always'
4248
],
43-
"arrow-spacing": [
44-
"error", { "before": true, "after": true }
49+
'arrow-spacing': [
50+
'error', { 'before': true, 'after': true }
4551
],
46-
"no-console": "error",
47-
"react/prop-types": 0
52+
'no-console': 'error',
53+
'react/prop-types': 0
4854
}
4955
}

app.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
const express = require("express");
2-
const app = express();
1+
const express = require('express')
2+
const app = express()
33

44
// get the port from env variable
5-
const PORT = process.env.PORT || 5001;
5+
const PORT = process.env.PORT || 5001
66

7-
app.use(express.static("dist"));
7+
app.use(express.static('dist'))
88

99
app.listen(PORT, () => {
10-
console.log(`server started on port ${PORT}`);
11-
});
10+
// eslint-disable-next-line no-console
11+
console.log(`server started on port ${PORT}`)
12+
})

src/App.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react'
2-
import { BrowserRouter as Router, Routes, Route, useMatch } from 'react-router-dom'
2+
import { Routes, Route, useMatch } from 'react-router-dom'
33
import { useApi } from './useApi'
44
import LoadingSpinner from './LoadingSpinner'
55
import ErrorMessage from './ErrorMessage'

src/PokemonPage.jsx

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ const PokemonPage = ({ previous, next }) => {
2626
const normalAbility = pokemon.abilities.find((ability) => !ability.is_hidden)
2727
const hiddenAbility = pokemon.abilities.find((ability) => ability.is_hidden === true)
2828

29-
console.log('hiddenAbility=', hiddenAbility)
3029
return (
3130
<>
3231
<div className="links">

test/PokemonPage.jest.spec.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,5 +130,5 @@ describe('<PokemonPage />', () => {
130130

131131
expect(screen.queryByText('Previous')).toBeNull()
132132
expect(screen.queryByText('Next')).toBeNull()
133-
})
133+
})
134134
})

0 commit comments

Comments
 (0)