diff --git a/.eslintrc.js b/.eslintrc.js
index e2178ed..d79380a 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -1,10 +1,6 @@
module.exports = {
parser: 'babel-eslint',
extends: 'airbnb',
- plugins: ['import', 'html'],
- settings: {
- 'html/html-extensions': ['.html', '.jsx'],
- },
env: {
jest: true,
browser: true,
diff --git a/package.json b/package.json
index c50508a..01409ca 100644
--- a/package.json
+++ b/package.json
@@ -9,7 +9,7 @@
"start": "concurrently -k -p \"[{name} - {time}]\" -c \"cyan,magenta\" -n \"Client,Server\" \"yarn start-client\"",
"test": "jest --no-cache --coverage",
"test-update-snapshot": "jest --json --updateSnapshot",
- "lint": "eslint --ext .js --ext .jsx src",
+ "lint": "eslint ./src --ext js,jsx",
"serve-prod": "concurrently -k -p \"[{name} - {time}]\" -c \"cyan,magenta\" -n \"Client,Server\" \"serve ./public\""
},
"author": "",
diff --git a/src/components/Author.jsx b/src/components/Author.jsx
index 4945d4e..3f80130 100644
--- a/src/components/Author.jsx
+++ b/src/components/Author.jsx
@@ -6,14 +6,13 @@ const Author = ({ author }) => (
{author.name}
);
-Author.PropTypes = {
- author: PropTypes.shape(),
+Author.propTypes = {
+ author: PropTypes.shape().isRequired,
};
export default Author;
diff --git a/src/components/Console.jsx b/src/components/Console.jsx
index 98008d8..8d5c70f 100644
--- a/src/components/Console.jsx
+++ b/src/components/Console.jsx
@@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
-import { parse } from 'markdown-to-ast';
+// import { parse } from 'markdown-to-ast';
import componentFactory from '../services/componentFactory';
@@ -95,7 +95,7 @@ export default class Console extends React.Component {
event.persist();
this.setState({
- md: await getPost(event.target.value),
+ // md: await getPost(event.target.value),
});
}
diff --git a/src/components/CourseItem.jsx b/src/components/CourseItem.jsx
index a736ffb..4cb921f 100644
--- a/src/components/CourseItem.jsx
+++ b/src/components/CourseItem.jsx
@@ -1,4 +1,4 @@
-import React, { Component } from 'react';
+import React from 'react';
import PropTypes from 'prop-types';
import urlJoin from 'url-join';
@@ -13,11 +13,6 @@ const dateOptions = {
day: 'numeric',
};
-const timeOptions = {
- hour: '2-digit',
- minute: '2-digit',
-};
-
const authorRenderer = (author, index) => (
);
@@ -52,10 +47,10 @@ const CourseItem = ({ course }) => {
);
-}
+};
-CourseItem.PropTypes = {
- course: PropTypes.shape(),
+CourseItem.propTypes = {
+ course: PropTypes.shape().isRequired,
};
export default CourseItem;
diff --git a/src/components/CourseList.jsx b/src/components/CourseList.jsx
index cf9e6e8..b5917f8 100644
--- a/src/components/CourseList.jsx
+++ b/src/components/CourseList.jsx
@@ -1,11 +1,11 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
-import urlJoin from 'url-join';
+// import urlJoin from 'url-join';
import CourseItem from './CourseItem';
-import play from '../assets/images/icons/icon_play.svg';
-import clock from '../assets/images/icons/icon_clock.svg';
+// import play from '../assets/images/icons/icon_play.svg';
+// import clock from '../assets/images/icons/icon_clock.svg';
const courseRenderer = (course, index) => (
diff --git a/src/components/Highlight.jsx b/src/components/Highlight.jsx
index 74cabd6..b6107c9 100644
--- a/src/components/Highlight.jsx
+++ b/src/components/Highlight.jsx
@@ -1,11 +1,11 @@
-import highlight from 'highlight.js'
+import highlight from 'highlight.js';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
class Highlight extends Component {
static propTypes = {
- children: PropTypes.node,
- language: PropTypes.string,
+ children: PropTypes.node.isRequired,
+ language: PropTypes.string.isRequired,
};
componentDidMount() {
@@ -13,8 +13,8 @@ class Highlight extends Component {
highlight.highlightBlock(this.element);
}
}
-
- componentDidUpdate () {
+
+ componentDidUpdate() {
if (this.element) {
highlight.initHighlighting.called = false;
highlight.highlightBlock(this.element);
diff --git a/src/components/Search.jsx b/src/components/Search.jsx
index 4ad020d..6c68a56 100644
--- a/src/components/Search.jsx
+++ b/src/components/Search.jsx
@@ -1,5 +1,4 @@
import React, { Component } from 'react';
-import PropTypes from 'prop-types';
class Search extends Component {
constructor(props) {
diff --git a/src/components/Session.jsx b/src/components/Session.jsx
deleted file mode 100644
index 808c1d4..0000000
--- a/src/components/Session.jsx
+++ /dev/null
@@ -1,21 +0,0 @@
-import React, { Component } from 'react';
-import { Link } from 'react-router-dom';
-
-import defaultAvatar from '../assets/images/avatar.png';
-
-class Session extends Component {
- render() {
- return (
-
- {/* TODO: add buttons for some features like notifications, progress, */}
-
-
-
-
-
-
- );
- }
-}
-
-export default Session;
diff --git a/src/components/Splash.jsx b/src/components/Splash.jsx
index 805abd0..5299893 100644
--- a/src/components/Splash.jsx
+++ b/src/components/Splash.jsx
@@ -1,5 +1,4 @@
import React, { Component } from 'react';
-import PropTypes from 'prop-types';
import flask from '../assets/images/icons/icon_flask.svg';
@@ -12,13 +11,17 @@ class Splash extends Component {
return (
-
+
Bienvenue sur Eleven Code Labs
- Cette plateforme est votre nouvelle ressource de tutoriels orientés développement web et mobile. Suivez à votre rythme des exercices complets, qui couvrent des sujets allant du développement de petites applications, à des cas pratiques vous faisant découvrir un nouvel outil...
+ Cette plateforme est votre nouvelle ressource de tutoriels
+ orientés développement web et mobile. Suivez à votre rythme
+ des exercices complets, qui couvrent des sujets allant du
+ développement de petites applications, à des cas pratiques
+ vous faisant découvrir un nouvel outil...
diff --git a/src/components/Summary.jsx b/src/components/Summary.jsx
index 390819c..e042ea5 100644
--- a/src/components/Summary.jsx
+++ b/src/components/Summary.jsx
@@ -1,35 +1,33 @@
import React from 'react';
import PropTypes from 'prop-types';
-import { NOOP } from '../constants';
import SummaryItem from './SummaryItem';
-const Summary = ({ stepTitles = [], currentStep, gotoStep }) => {
- return (
-
- Étapes
-
- {stepTitles.map((title, index) => (
- gotoStep(index)}
- />
- ))}
-
-
- );
-};
+const Summary = ({ stepTitles = [], currentStep, gotoStep }) => (
+
+ Étapes
+
+ {stepTitles.map((title, index) => (
+ gotoStep(index)}
+ />
+ ))}
+
+
+);
-Summary.PropTypes = {
+Summary.propTypes = {
stepTitles: PropTypes.arrayOf(PropTypes.string),
currentStep: PropTypes.number,
+ gotoStep: PropTypes.func.isRequired,
};
Summary.defaultProps = {
- stepTitles: {},
+ stepTitles: [],
currentStep: 0,
};
diff --git a/src/components/SummaryItem.jsx b/src/components/SummaryItem.jsx
index 4e4b7e4..1a40b2c 100644
--- a/src/components/SummaryItem.jsx
+++ b/src/components/SummaryItem.jsx
@@ -1,3 +1,4 @@
+/* eslint jsx-a11y/no-noninteractive-element-interactions: off */
import React from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
@@ -9,11 +10,12 @@ const SummaryItem = ({ title, onClick, isCurrentStep, index }) => (
className={cx('summary__step', { '-current': isCurrentStep })}
onClick={onClick}
>
-
{index + 1} {title}
+
{index + 1}
+
{title}
);
-SummaryItem.PropTypes = {
+SummaryItem.propTypes = {
title: PropTypes.string.isRequired,
index: PropTypes.number.isRequired,
isCurrentStep: PropTypes.bool.isRequired,
diff --git a/src/containers/App.jsx b/src/containers/App.jsx
index 5c9bcb2..8266739 100644
--- a/src/containers/App.jsx
+++ b/src/containers/App.jsx
@@ -1,9 +1,18 @@
import React from 'react';
+import PropTypes from 'prop-types';
import { renderRoutes } from 'react-router-config';
-import Header from './Header';
+import ConnectedHeader from './Header';
export default class App extends React.Component {
+ static propTypes = {
+ route: PropTypes.shape(),
+ };
+
+ static defaultProps = {
+ route: undefined,
+ };
+
shouldComponentUpdate() {
return false;
}
@@ -13,7 +22,7 @@ export default class App extends React.Component {
return (
-
+
{route && renderRoutes(route.routes)}
);
diff --git a/src/containers/Course.jsx b/src/containers/Course.jsx
index eb817e9..b443f63 100644
--- a/src/containers/Course.jsx
+++ b/src/containers/Course.jsx
@@ -1,9 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
-import urlJoin from 'url-join';
-import Splash from '../components/Splash';
import Summary from '../components/Summary';
import clock from '../assets/images/icons/icon_clock.svg';
@@ -22,11 +20,9 @@ const mapStateToProps = ({
courses,
currentStepMD,
currentCourse,
- currentStepIndex,
}) => ({
courses,
currentStepMD,
- currentStepIndex,
course: currentCourse,
});
@@ -40,30 +36,26 @@ export class Course extends React.Component {
static propTypes = {
courses: PropTypes.arrayOf(PropTypes.shape()),
currentStepMD: PropTypes.string,
- currentStepIndex: PropTypes.number,
course: PropTypes.shape(),
loadCourses: PropTypes.func,
loadStep: PropTypes.func,
setCurrentCourse: PropTypes.func,
+
+ match: PropTypes.shape(),
};
static defaultProps = {
courses: null,
currentStepMD: '',
- currentStepIndex: null,
course: null,
- loadCourses: PropTypes.func,
- loadStep: PropTypes.func,
- setCurrentCourse: PropTypes.func,
+ loadCourses: NOOP,
+ loadStep: NOOP,
+ setCurrentCourse: NOOP,
+ match: { params: {} },
};
- state = {
- steps: [],
- currentStep: 0,
- }
-
constructor(props) {
super(props);
@@ -74,6 +66,11 @@ export class Course extends React.Component {
this.gotoStep = this.gotoStep.bind(this);
}
+ state = {
+ steps: [],
+ currentStep: 0,
+ };
+
componentDidMount() {
this.props.loadCourses();
}
@@ -85,7 +82,7 @@ export class Course extends React.Component {
},
} = this.props;
- const { course, courses, currentStepMD, currentStepIndex } = nextProps;
+ const { course, courses, currentStepMD } = nextProps;
const { steps = {}, currentStep } = this.state;
// Set the course in redux's store.
diff --git a/src/containers/Header.jsx b/src/containers/Header.jsx
index 244ea39..2c9d2a4 100644
--- a/src/containers/Header.jsx
+++ b/src/containers/Header.jsx
@@ -2,12 +2,10 @@ import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
-import Search from '../components/Search';
-
const mapStateToProps = ({
currentCourse,
currentStepIndex,
-}) => ({
+}) => ({
currentCourse,
currentStepIndex,
});
@@ -44,8 +42,6 @@ export class Header extends React.Component {
{currentStepIndex + 1} - {stepTitles[currentStepIndex]}
)}
-
-
);
}
diff --git a/src/index.dev.jsx b/src/index.dev.jsx
index 51db3e1..35c01f7 100644
--- a/src/index.dev.jsx
+++ b/src/index.dev.jsx
@@ -4,7 +4,6 @@ import BrowserRouter from 'react-router-dom/BrowserRouter';
import { renderRoutes } from 'react-router-config';
import { Provider } from 'react-redux';
-import App from './containers/App';
import createStore from './store/dev';
import routes from './routes';
diff --git a/src/index.prod.jsx b/src/index.prod.jsx
index 9f681b2..c38bb53 100644
--- a/src/index.prod.jsx
+++ b/src/index.prod.jsx
@@ -4,7 +4,6 @@ import BrowserRouter from 'react-router-dom/BrowserRouter';
import { renderRoutes } from 'react-router-config';
import { Provider } from 'react-redux';
-import App from './containers/App';
import createStore from './store/prod';
import routes from './routes';