diff --git a/.eslintrc b/.eslintrc
index 74bf0806..683bc59a 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -1,9 +1,11 @@
{
"parser": "babel-eslint",
- "ecmaFeatures": {
- "jsx": true,
- "classes": true,
- "modules": true
+ "parserOptions": {
+ "ecmaFeatures": {
+ "jsx": true,
+ "classes": true,
+ "modules": true
+ },
},
"env": {
"browser": true,
@@ -12,6 +14,12 @@
"plugins": [
"react"
],
+ "extends": "plugin:react/recommended",
+ "settings": {
+ "react": {
+ "pragma": "React"
+ }
+ },
"rules": {
"strict": 0,
"no-underscore-dangle": 0,
diff --git a/package.json b/package.json
index 07f8aa37..6d2ad6ae 100644
--- a/package.json
+++ b/package.json
@@ -57,12 +57,12 @@
"babel-eslint": "*",
"babel-jest": "*",
"babel-loader": "*",
- "babel-preset-es2015": "^6.3.13",
- "babel-preset-react": "^6.3.13",
- "babel-preset-stage-0": "^6.3.13",
+ "babel-preset-es2015": "*",
+ "babel-preset-react": "*",
+ "babel-preset-stage-0": "*",
"css-loader": "^0.23.0",
- "eslint": "2.0.0-beta.1",
- "eslint-plugin-react": "^3.15.0",
+ "eslint": "2.2.0",
+ "eslint-plugin-react": "^4.0.0",
"expose-loader": "^0.7.1",
"express": "^4.13.3",
"extract-text-webpack-plugin": "^0.9.1",
@@ -82,7 +82,7 @@
"webpack-dev-server": "^1.14.0"
},
"dependencies": {
- "babel-polyfill": "^6.3.14",
+ "babel-polyfill": "*",
"classnames": "^2.2.0",
"coriolis-data": "cmmcleod/coriolis-data",
"d3": "^3.5.9",
diff --git a/src/app/Coriolis.jsx b/src/app/Coriolis.jsx
index e5d1a77c..39552804 100644
--- a/src/app/Coriolis.jsx
+++ b/src/app/Coriolis.jsx
@@ -279,9 +279,10 @@ export default class Coriolis extends React.Component {
* @return {React.Component} The main app
*/
render() {
+ let currentMenu = this.state.currentMenu;
return
-
- { this.state.error ? this.state.error : this.state.page ? : }
+
+ { this.state.error ? this.state.error : this.state.page ? React.createElement(this.state.page, { currentMenu }) : }
{ this.state.modal }
{ this.state.tooltip }
;
diff --git a/src/app/components/Link.jsx b/src/app/components/Link.jsx
index 5aad9f73..aef5db46 100644
--- a/src/app/components/Link.jsx
+++ b/src/app/components/Link.jsx
@@ -7,6 +7,12 @@ import { shallowEqual } from '../utils/UtilityFunctions';
*/
export default class Link extends React.Component {
+ static propTypes = {
+ children: React.PropTypes.any,
+ href: React.PropTypes.string.isRequired,
+ onClick: React.PropTypes.func
+ };
+
/**
* Constructor
* @param {Object} props React Component properties
diff --git a/src/app/components/ModalImport.jsx b/src/app/components/ModalImport.jsx
index aaa92e1a..64af00c7 100644
--- a/src/app/components/ModalImport.jsx
+++ b/src/app/components/ModalImport.jsx
@@ -522,7 +522,7 @@ export default class ModalImport extends TranslatedComponent {
);
}
- return e.stopPropagation() } onClick={ (e) => e.stopPropagation() }>
+ return
e.stopPropagation() }>
{translate('import')}
{importStage}
diff --git a/src/app/components/Slider.jsx b/src/app/components/Slider.jsx
index 1e57cdf2..38bbfe1e 100644
--- a/src/app/components/Slider.jsx
+++ b/src/app/components/Slider.jsx
@@ -15,13 +15,15 @@ export default class Slider extends React.Component {
scale: 1 // SVG render scale
};
- static PropTypes = {
+ static propTypes = {
axis: React.PropTypes.bool,
axisUnit: React.PropTypes.string,
- min: React.PropTypes.number,
max: React.PropTypes.number,
- scale: React.PropTypes.number,
+ min: React.PropTypes.number,
onChange: React.PropTypes.func.isRequired,
+ onResize: React.PropTypes.func,
+ percent: React.PropTypes.number.isRequired,
+ scale: React.PropTypes.number
};
/**
diff --git a/src/app/components/SvgIcons.jsx b/src/app/components/SvgIcons.jsx
index 8c272234..39f8290a 100644
--- a/src/app/components/SvgIcons.jsx
+++ b/src/app/components/SvgIcons.jsx
@@ -7,6 +7,11 @@ import { shallowEqual } from '../utils/UtilityFunctions';
*/
class SvgIcon extends React.Component {
+ static propTypes = {
+ className: React.PropTypes.any,
+ style: React.PropTypes.object
+ };
+
/**
* Only rerender an SVG Icon if properties have changed
* @param {Object} nextProps Next/Incoming properties
diff --git a/src/app/i18n/Language.jsx b/src/app/i18n/Language.jsx
index 8d32eb73..3c74a4dc 100644
--- a/src/app/i18n/Language.jsx
+++ b/src/app/i18n/Language.jsx
@@ -59,7 +59,7 @@ export function getLanguage(langCode) {
Ls: {' ' + translate('Ls')}, // Light Seconds
LY: {' ' + translate('LY')}, // Light Years
MJ: {' ' + translate('MJ')}, // Mega Joules
- 'm/s': {' ' + translate('m/s')}, // Meters per second
+ 'm/s': {' ' + translate('m/s')}, // Meters per second
MW: {' ' + translate('MW')}, // Mega Watts (same as Mega Joules per second)
ps: {translate('/s')}, // per second
pm: {translate('/min')}, // per minute
diff --git a/src/app/pages/OutfittingPage.jsx b/src/app/pages/OutfittingPage.jsx
index a63ef1bf..c499db0a 100644
--- a/src/app/pages/OutfittingPage.jsx
+++ b/src/app/pages/OutfittingPage.jsx
@@ -365,16 +365,18 @@ export default class OutfittingPage extends Page {
|
- {formats.f2(fuelLevel * fuelCapacity)}{units.T} {formats.pct1(fuelLevel)} |
+
+ {formats.f2(fuelLevel * fuelCapacity)}{units.T} {formats.pct1(fuelLevel)}
+ |
diff --git a/src/app/pages/ShipyardPage.jsx b/src/app/pages/ShipyardPage.jsx
index 27128b11..3798e7a0 100755
--- a/src/app/pages/ShipyardPage.jsx
+++ b/src/app/pages/ShipyardPage.jsx
@@ -27,13 +27,13 @@ function countInt(slot) {
this.maxCargo += crEligible ? ModuleUtils.findInternal('cr', slot.maxClass, 'E').cargo : 0;
}
-let cachedShipSummaries = null;
-
/**
* The Shipyard summary page
*/
export default class ShipyardPage extends Page {
+ static cachedShipSummaries = null;
+
/**
* Constructor
* @param {Object} props React Component properties
@@ -46,16 +46,15 @@ export default class ShipyardPage extends Page {
shipPredicate: 'name',
shipDesc: true
};
- this.context = context;
- if (!cachedShipSummaries) {
- cachedShipSummaries = [];
+ if (!ShipyardPage.cachedShipSummaries) {
+ ShipyardPage.cachedShipSummaries = [];
for (let s in Ships) {
- cachedShipSummaries.push(this._shipSummary(s, Ships[s]));
+ ShipyardPage.cachedShipSummaries.push(this._shipSummary(s, Ships[s]));
}
}
- this.shipSummaries = cachedShipSummaries;
+ this.shipSummaries = ShipyardPage.cachedShipSummaries;
}
/**
@@ -218,23 +217,22 @@ export default class ShipyardPage extends Page {
{translate('cost')} |
- {/* Base */}
| {translate('speed')} |
{translate('boost')} |
{translate('armour')} |
{translate('shields')} |
- {/* Max */}
+
{translate('speed')} |
{translate('boost')} |
{translate('jump')} |
{translate('cargo')} |
- {/* Hardpoints */}
+
{translate('S')} |
{translate('M')} |
{translate('L')} |
{translate('H')} |
{translate('U')} |
- {/* Internal */}
+
1 |
2 |
3 |