From 0581ac2278364d82042035725ff0328cc829cd48 Mon Sep 17 00:00:00 2001
From: Hallaathrad <Hallaathrad@gmail.com>
Date: Sun, 6 Mar 2016 15:21:00 -0500
Subject: [PATCH] more improvements

---
 .babelrc                     |  2 +-
 .eslintrc                    | 17 +++++++++++++++++
 .travis.yml                  | 39 +++++++++++++++++++++++++++++++++++++++
 create_structure.js          |  3 ++-
 css/gatsby.css               |  1 +
 html.js                      | 41 -----------------------------------------
 package.json                 | 23 ++++++++++++-----------
 templates/_template.jsx      |  6 ++----
 templates/lang/_template.jsx | 12 ++----------
 utils/typography.js          | 25 -------------------------
 10 files changed, 76 insertions(+), 93 deletions(-)
 create mode 100644 .eslintrc
 create mode 100644 .travis.yml
 delete mode 100644 utils/typography.js

diff --git a/.babelrc b/.babelrc
index b0b9a96..cab5d10 100644
--- a/.babelrc
+++ b/.babelrc
@@ -1,3 +1,3 @@
 {
-  "stage": 0
+  "stage": 2
 }
diff --git a/.eslintrc b/.eslintrc
new file mode 100644
index 0000000..e229935
--- /dev/null
+++ b/.eslintrc
@@ -0,0 +1,17 @@
+{
+  "extends": "eslint-config-airbnb",
+  "rules": {
+    "indent": [2, 2, {"SwitchCase": 1}],
+    "no-console": [0],
+    "func-names": [0],
+    "semi": [2, "never"],
+    "no-extra-semi": [2],
+    "space-before-function-paren": [2, "always"],
+    "no-else-return": [0],
+    "space-infix-ops": [0],
+    "react/prefer-es6-class": [0],
+  },
+  "globals": {
+    "__PREFIX_LINKS__": true,
+  },
+}
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..1342e12
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,39 @@
+# back to language cpp to try to bypass osx node failure
+language: cpp
+sudo: false
+env:
+  - export NODE_VERSION="0.10"
+  - export NODE_VERSION="0.12"
+  - export NODE_VERSION="4"
+  - export NODE_VERSION="5"
+os:
+  - linux
+  - osx
+# pre-install to bring in the correct version of node via nvm
+before_install:
+  - git submodule update --init --recursive
+  - git clone https://github.com/creationix/nvm.git ./.nvm
+  - source ./.nvm/nvm.sh
+  - nvm install $NODE_VERSION
+  - nvm use $NODE_VERSION
+  - npm config set python `which python`
+  - if [ $TRAVIS_OS_NAME == "linux" ]; then
+      export CC="gcc-4.8";
+      export CXX="g++-4.8";
+      export LINK="gcc-4.8";
+      export LINKXX="g++-4.8";
+    fi
+  - gcc --version
+  - g++ --version
+# node 4 depends on gcc 4.8
+addons:
+  apt:
+    sources:
+    - ubuntu-toolchain-r-test
+    packages:
+    - g++-4.8
+    - gcc-4.8
+# script needed to test, because defaults don't work on osx
+script:
+  - npm install
+  - npm run lint
diff --git a/create_structure.js b/create_structure.js
index f9ba14b..eb7ff3c 100755
--- a/create_structure.js
+++ b/create_structure.js
@@ -52,7 +52,7 @@ fs.readdir('./wiki-master', function (err, files) {
   });
 
   // Get non-english files
-  var extra = folderList.reduce((thisList, langSubFolder) => {
+  var nonEnglishFileList = folderList.reduce((thisList, langSubFolder) => {
     var langDir = langSubFolder.match(/^\w{2}/)[0] + '/',
       langFiles = fs.readdirSync('./wiki-master/' + langSubFolder);
     
@@ -92,6 +92,7 @@ fs.readdir('./wiki-master', function (err, files) {
   
   // Create folders and copy *.md files
   createFolders(fileList);
+  createFolders(nonEnglishFileList);
 
   // Copy language templates and templates files to each language
   try {
diff --git a/css/gatsby.css b/css/gatsby.css
index 94bceae..51af657 100644
--- a/css/gatsby.css
+++ b/css/gatsby.css
@@ -22,6 +22,7 @@ body,html {
 }
 a{
   text-decoration: none;
+  color:#006400;
 }
 a:hover {
   text-decoration: underline;
diff --git a/html.js b/html.js
index ba891c5..2b55f4d 100644
--- a/html.js
+++ b/html.js
@@ -2,8 +2,6 @@ import React from 'react';
 import DocumentTitle from 'react-document-title';
 
 import { link } from 'gatsby-helpers';
-import typography from './utils/typography';
-const { TypographyStyle } = typography;
 
 module.exports = React.createClass({
  propTypes () {
@@ -30,45 +28,6 @@ module.exports = React.createClass({
           <meta name='viewport' content='user-scalable=no width=device-width, initial-scale=1.0 maximum-scale=1.0'/>
           <title>{title}</title>
           <link rel="shortcut icon" href={this.props.favicon}/>
-          <TypographyStyle/>
-          <style dangerouslySetInnerHTML={{__html:
-            `
-              a {
-                color: #006400;
-              }
-              pre {
-                background: #fff;
-                padding: 1.5rem;
-              }
-              .demo1-ball {
-                border-radius: 99px;
-                background-color: white;
-                width: 50px;
-                height: 50px;
-                border: 3px solid white;
-                position: absolute;
-                background-size: 50px;
-              }
-              .ball-0 {
-                background-image: url(${link("/some-react-code/0.jpg")});
-              }
-              .ball-1 {
-                background-image: url(${link("/some-react-code/1.jpg")});
-              }
-              .ball-2 {
-                background-image: url(${link("/some-react-code/2.jpg")});
-              }
-              .ball-3 {
-                background-image: url(${link("/some-react-code/3.jpg")});
-              }
-              .ball-4 {
-                background-image: url(${link("/some-react-code/4.jpg")});
-              }
-              .ball-5 {
-                background-image: url(${link("/some-react-code/5.jpg")});
-              }
-            `
-          }} />
         </head>
         <body className="landing-page">
           <div id="react-mount" dangerouslySetInnerHTML={{__html: this.props.body}} />
diff --git a/package.json b/package.json
index 6c92f8d..8463e3e 100644
--- a/package.json
+++ b/package.json
@@ -2,9 +2,10 @@
   "name": "wiki-generator",
   "version": "1.0.0",
   "description": "Wiki Pages Generator for Free Code Camp",
-  "main": "index.js",
+  "main": "n/a",
   "scripts": {
-    "test": "echo \"Error: no test specified\" && exit 1"
+    "test": "echo \"Error: no test specified\" && exit 1",
+    "lint": "./node_modules/.bin/eslint --ext .js,.jsx --ignore-pattern public ."
   },
   "repository": {
     "type": "git",
@@ -17,25 +18,25 @@
   "homepage": "https://github.com/FreeCodeCamp/wiki-generator#readme",
   "license": "(BSD-3-Clause AND CC-BY-SA-4.0)",
   "dependencies": {
-    "chroma-js": "0.7.2",
-    "color-pairs-picker": "^1.3.5",
+    "babel-plugin-react-transform": "^1.1.1",
     "fs-extra": "^0.26.5",
     "lodash": "^4.5.1",
-    "mkdirp": "^0.5.1",  
-    "promise": "^7.0.4",  
+    "mkdirp": "^0.5.1",
+    "promise": "^7.0.4",
     "react": "^0.14.7",
     "react-document-title": "^2.0.1",
     "react-dom": "^0.14.7",
     "react-motion": "^0.1.0",
     "react-responsive-grid": "^0.3.1",
     "react-router": "^2.0.0",
-    "typography": "^0.7.0",
+    "react-transform-catch-errors": "^1.0.2",
+    "react-transform-hmr": "^1.0.2",
+    "redbox-react": "^1.2.2",
     "underscore.string": "^3.2.2"
   },
   "devDependencies": {
-    "babel-plugin-react-transform": "^1.1.1",
-    "react-transform-catch-errors": "^1.0.2",
-    "react-transform-hmr": "^1.0.2",
-    "redbox-react": "^1.2.2"
+    "eslint": "^1.10.3",
+    "eslint-config-airbnb": "^5.0.1",
+    "eslint-plugin-react": "^3.16.1"
   }
 }
diff --git a/templates/_template.jsx b/templates/_template.jsx
index 36119ef..2d03e09 100644
--- a/templates/_template.jsx
+++ b/templates/_template.jsx
@@ -1,10 +1,8 @@
 import React from 'react';
 import { Link, State, Navigation } from 'react-router';
-import { Container, Grid, Breakpoint, Span } from 'react-responsive-grid';
-import colorPairsPicker from 'color-pairs-picker';
-import chroma from 'chroma-js';
+import { Breakpoint } from 'react-responsive-grid';
 import includes from 'underscore.string/include';
-import { link, templateChildrenPages } from 'gatsby-helpers';
+import { link } from 'gatsby-helpers';
 
 // Style code
 import 'css/github.css';
diff --git a/templates/lang/_template.jsx b/templates/lang/_template.jsx
index 3cd51c7..a45ca26 100755
--- a/templates/lang/_template.jsx
+++ b/templates/lang/_template.jsx
@@ -1,12 +1,10 @@
 import React from 'react';
 import { Link, State, Navigation } from 'react-router';
-import { Container, Grid, Breakpoint, Span } from 'react-responsive-grid';
+import { Breakpoint } from 'react-responsive-grid';
 import find from 'lodash/find';
 import { link } from 'gatsby-helpers';
 import pageList from './_pages.yaml';
 
-import typography from 'utils/typography';
-
 // Style code
 import 'css/github.css';
 import 'css/gatsby.css';
@@ -42,7 +40,7 @@ module.exports = React.createClass({
         order: page.data.order,
         path: page.path,
       }
-    }).sort((a,b) => { return a.order - b.order });
+    }).sort((a,b) => a.title.localeCompare(b.title));
     const docOptions = childPages.map((child) =>
       <option
         key={link(child.path)}
@@ -66,15 +64,9 @@ module.exports = React.createClass({
       return (
         <li
           key={child.path}
-          style={{
-            marginBottom: rhythm(1/2),
-          }}
         >
           <Link
             to={link(child.path)}
-            style={{
-              textDecoration: 'none',
-            }}
           >
             {isActive ? <strong>{child.title}</strong> : child.title }
           </Link>
diff --git a/utils/typography.js b/utils/typography.js
deleted file mode 100644
index f21c139..0000000
--- a/utils/typography.js
+++ /dev/null
@@ -1,25 +0,0 @@
-import Typography from 'typography';
-
-const options = {
-  baseFontSize: '16px',
-  baseLineHeight: '24px',
-  bodyFontFamily: '"Helvetica Neue", "Segoe UI", Helvetica, Arial, sans-serif',
-  headerFontFamily: '"Helvetica Neue", "Segoe UI", Helvetica, Arial, sans-serif',
-  bodyWeight: 300,
-  headerWeight: 600,
-  boldWeight: 600,
-  modularScales: [
-    {
-      "scale": "minor third"
-    }
-  ]
-}
-
-const typography = new Typography(options)
-
-// Hot reload typography in development.
-if (process.env.NODE_ENV !== "production") {
-  typography.injectStyles()
-}
-
-export default typography
