Skip to content

Commit b5d89fa

Browse files
committed
Merge pull request #139 from bhamodi/master
Applied eslint to docs grunt directory and applied lint fixes.
2 parents a284e34 + 69bf4a6 commit b5d89fa

File tree

7 files changed

+35
-32
lines changed

7 files changed

+35
-32
lines changed

docs/grunt/build-site.js

+20-18
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
var mkdirp = require("mkdirp")
2-
var path = require('path');
1+
var mkdirp = require('mkdirp')
2+
var path = require('path')
33
var glob = require('glob')
44
var async = require('async')
55
var fm = require('front-matter')
@@ -11,7 +11,7 @@ require('babel/register')({
1111
'src/',
1212
'node_modules/highlight.js',
1313
'node_modules/react-highlight',
14-
]
14+
],
1515
})
1616

1717
var React = require('react')
@@ -24,9 +24,9 @@ module.exports = function(grunt) {
2424

2525
async.parallel([
2626
buildPages.bind(null, '**/*.js', { cwd: 'src/pages' }),
27-
buildDocs.bind(null, 'docs/**/*.md', { cwd: 'src/' })
27+
buildDocs.bind(null, 'docs/**/*.md', { cwd: 'src/' }),
2828
], done)
29-
});
29+
})
3030
}
3131

3232
/**
@@ -37,15 +37,15 @@ module.exports = function(grunt) {
3737
*/
3838
function buildPages(pagesGlob, opts, cb) {
3939
var cwd = path.join(process.cwd(), opts.cwd)
40-
console.log('buildPages, cwd=%s', cwd)
40+
console.log('buildPages, cwd=%s', cwd) // eslint-disable-line no-console
4141

42-
glob(pagesGlob, opts, function(err, files) {
42+
glob(pagesGlob, opts, function(err, files) { // eslint-disable-line handle-callback-err
4343
async.each(files, function(item, cb) {
4444
var componentPath = path.relative(__dirname, path.join(cwd, item))
4545
var destFilepath = changeExtension(path.join(OUT, item), '.html')
4646

4747
var Component = require(componentPath)
48-
var html = React.renderToStaticMarkup(React.createElement(Component));
48+
var html = React.renderToStaticMarkup(React.createElement(Component))
4949

5050
writeFile(destFilepath, html, cb)
5151
}, cb)
@@ -60,14 +60,14 @@ function buildPages(pagesGlob, opts, cb) {
6060
*/
6161
function buildDocs(globPattern, opts, cb) {
6262
var DocWrapper = require('../src/layouts/doc-wrapper')
63-
parseDocs(globPattern, opts, function(err, docs) {
63+
parseDocs(globPattern, opts, function(err, docs) { // eslint-disable-line handle-callback-err
6464
var navData = docs.map(function(doc) {
6565
return {
6666
title: doc.attributes.title,
6767
relative: doc.relative,
6868
}
6969
})
70-
console.log('navdata', navData)
70+
console.log('navdata', navData) // eslint-disable-line no-console
7171

7272
async.each(docs, function(doc, cb) {
7373
fs.readFile(doc.src, 'utf8')
@@ -76,7 +76,7 @@ function buildDocs(globPattern, opts, cb) {
7676
contents: doc.body,
7777
navData: navData,
7878
}
79-
var html = React.renderToStaticMarkup(React.createElement(DocWrapper, props));
79+
var html = React.renderToStaticMarkup(React.createElement(DocWrapper, props))
8080
writeFile(path.join(OUT, doc.relative), html, cb)
8181
}, cb)
8282
})
@@ -91,7 +91,7 @@ function buildDocs(globPattern, opts, cb) {
9191
function parseDocs(globPattern, opts, cb) {
9292
var cwd = path.join(process.cwd(), opts.cwd)
9393

94-
glob(globPattern, opts, function(err, files) {
94+
glob(globPattern, opts, function(err, files) { // eslint-disable-line handle-callback-err
9595
async.map(files, function(item, cb) {
9696
var filepath = path.join(cwd, item)
9797
var relativeFilepath = changeExtension(item, '.html')
@@ -118,16 +118,18 @@ function filenameOnly(filepath) {
118118
}
119119

120120
function changeExtension(filepath, newExt) {
121-
var newFilename = filenameOnly(filepath) + newExt;
121+
var newFilename = filenameOnly(filepath) + newExt
122122
return path.join(path.dirname(filepath), newFilename)
123123
}
124124

125125

126-
function writeFile (p, contents, cb) {
127-
mkdirp(path.dirname(p), function (err) {
128-
console.log('writing file: [%s]', p)
129-
if (err) return cb(err)
130-
fs.writeFile(p, contents, cb)
126+
function writeFile(p, contents, cb) {
127+
mkdirp(path.dirname(p), function(err) {
128+
console.log('writing file: [%s]', p) // eslint-disable-line no-console
129+
if (err) {
130+
return cb(err)
131+
}
132+
fs.writeFile(p, contents, cb)
131133
})
132134
}
133135

docs/grunt/concurrent.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ module.exports = {
33
options: {
44
logConcurrentOutput: true,
55
},
6-
tasks: ['exec:watch-sass', 'watch:build-site']
7-
}
6+
tasks: ['exec:watch-sass', 'watch:build-site'],
7+
},
88
}

docs/grunt/connect.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ module.exports = {
33
options: {
44
base: 'dist/',
55
port: 4000,
6-
}
7-
}
6+
},
7+
},
88
}

docs/grunt/exec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var CMD = 'node_modules/.bin/node-sass sass/main.scss dist/assets/css/output.css
22
var WATCH_CMD = CMD + ' -w'
33

44
module.exports = {
5-
'watch-sass': WATCH_CMD,
5+
'watch-sass': WATCH_CMD,
66
'sass': CMD,
7-
'generate': "BASE_URL='https://optimizely.github.io/nuclear-js/' grunt generate",
7+
'generate': 'BASE_URL=\'https://optimizely.github.io/nuclear-js/\' grunt generate',
88
}

docs/grunt/gh-pages.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
22
options: {
33
base: 'dist',
4-
repo: '[email protected]:optimizely/nuclear-js.git'
4+
repo: '[email protected]:optimizely/nuclear-js.git',
55
},
66
src: ['**'],
77
}

docs/grunt/webpack.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var webpack = require("webpack");
1+
var webpack = require('webpack')
22

33
module.exports = {
44
options: {
@@ -8,25 +8,24 @@ module.exports = {
88

99
output: {
1010
path: './dist',
11-
filename: "app.js",
11+
filename: 'app.js',
1212
},
1313

1414
module: {
1515
loaders: [
1616
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader'},
1717
{ test: /\.jsx$/, loader: 'babel-loader'},
18-
]
18+
],
1919
},
2020
},
2121

2222
dev: {
2323
watch: true,
24-
//keepalive: true,
24+
// keepalive: true,
2525
},
2626

2727
prod: {
2828
watch: false,
29-
3029
plugins: [
3130
new webpack.optimize.DedupePlugin(),
3231
new webpack.optimize.UglifyJsPlugin({
@@ -38,4 +37,4 @@ module.exports = {
3837
}),
3938
],
4039
},
41-
};
40+
}

grunt/eslint.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ module.exports = {
88
tests: [
99
'tests/*',
1010
],
11-
1211
grunt: [
1312
'grunt/*',
1413
],
14+
docs_grunt: [
15+
'docs/grunt/*',
16+
],
1517
}

0 commit comments

Comments
 (0)