From 836904727653789e169972645da1fe9b03780664 Mon Sep 17 00:00:00 2001 From: Jake Marsh Date: Wed, 11 May 2016 22:31:45 -0700 Subject: [PATCH] fix new linter violations --- app/js/App.js | 2 +- app/js/actions/CurrentUserActions.js | 2 +- app/js/components/Footer.js | 2 +- app/js/components/Header.js | 2 +- app/js/index.js | 2 +- app/js/pages/HomePage.js | 2 +- app/js/pages/NotFoundPage.js | 2 +- app/js/pages/SearchPage.js | 2 +- app/js/utils/AuthAPI.js | 2 +- gulp/index.js | 11 ++++++----- gulp/tasks/browserSync.js | 4 ++-- gulp/tasks/browserify.js | 4 ++-- gulp/tasks/clean.js | 2 +- gulp/tasks/copyIcons.js | 1 - gulp/tasks/copyIndex.js | 2 +- gulp/tasks/deploy.js | 3 +-- gulp/tasks/development.js | 3 +-- gulp/tasks/imagemin.js | 3 +-- gulp/tasks/production.js | 2 +- gulp/tasks/watch.js | 8 ++++---- gulp/util/handle-errors.js | 8 ++++---- gulp/util/script-filter.js | 6 +++--- tests/helper.js | 2 +- 23 files changed, 37 insertions(+), 40 deletions(-) diff --git a/app/js/App.js b/app/js/App.js index df6df5f..021291c 100644 --- a/app/js/App.js +++ b/app/js/App.js @@ -75,4 +75,4 @@ class App extends React.Component { App.propTypes = propTypes; -export default App; \ No newline at end of file +export default App; diff --git a/app/js/actions/CurrentUserActions.js b/app/js/actions/CurrentUserActions.js index 003d77c..88d1259 100644 --- a/app/js/actions/CurrentUserActions.js +++ b/app/js/actions/CurrentUserActions.js @@ -10,4 +10,4 @@ const CurrentUserActions = Reflux.createActions([ ]); -export default CurrentUserActions; \ No newline at end of file +export default CurrentUserActions; diff --git a/app/js/components/Footer.js b/app/js/components/Footer.js index 3adc488..07a319e 100644 --- a/app/js/components/Footer.js +++ b/app/js/components/Footer.js @@ -20,4 +20,4 @@ class Footer extends React.Component{ } -export default Footer; \ No newline at end of file +export default Footer; diff --git a/app/js/components/Header.js b/app/js/components/Header.js index b5d839f..3b8057d 100644 --- a/app/js/components/Header.js +++ b/app/js/components/Header.js @@ -20,4 +20,4 @@ class Header extends React.Component { } -export default Header; \ No newline at end of file +export default Header; diff --git a/app/js/index.js b/app/js/index.js index 3d8dc70..2f7a057 100644 --- a/app/js/index.js +++ b/app/js/index.js @@ -10,4 +10,4 @@ if ( process.env.NODE_ENV !== 'production' ) { window.React = React; } -ReactDOM.render(Routes, document.getElementById('app')); \ No newline at end of file +ReactDOM.render(Routes, document.getElementById('app')); diff --git a/app/js/pages/HomePage.js b/app/js/pages/HomePage.js index a8c0d63..c0a7636 100644 --- a/app/js/pages/HomePage.js +++ b/app/js/pages/HomePage.js @@ -36,4 +36,4 @@ class HomePage extends React.Component { HomePage.propTypes = propTypes; -export default HomePage; \ No newline at end of file +export default HomePage; diff --git a/app/js/pages/NotFoundPage.js b/app/js/pages/NotFoundPage.js index 8399382..12d51f8 100644 --- a/app/js/pages/NotFoundPage.js +++ b/app/js/pages/NotFoundPage.js @@ -29,4 +29,4 @@ class NotFoundPage extends React.Component { NotFoundPage.propTypes = propTypes; -export default NotFoundPage; \ No newline at end of file +export default NotFoundPage; diff --git a/app/js/pages/SearchPage.js b/app/js/pages/SearchPage.js index 8cac077..34c22c1 100644 --- a/app/js/pages/SearchPage.js +++ b/app/js/pages/SearchPage.js @@ -52,4 +52,4 @@ class SearchPage extends React.Component { SearchPage.propTypes = propTypes; -export default SearchPage; \ No newline at end of file +export default SearchPage; diff --git a/app/js/utils/AuthAPI.js b/app/js/utils/AuthAPI.js index b1d9a1c..c7ee21e 100644 --- a/app/js/utils/AuthAPI.js +++ b/app/js/utils/AuthAPI.js @@ -18,4 +18,4 @@ const AuthAPI = { }; -export default AuthAPI; \ No newline at end of file +export default AuthAPI; diff --git a/gulp/index.js b/gulp/index.js index 6039b89..4be0b19 100644 --- a/gulp/index.js +++ b/gulp/index.js @@ -1,9 +1,10 @@ 'use strict'; -var fs = require('fs'); -var onlyScripts = require('./util/script-filter'); -var tasks = fs.readdirSync('./gulp/tasks/').filter(onlyScripts); +import fs from 'fs'; +import onlyScripts from './util/script-filter'; -tasks.forEach(function(task) { +const TASKS = fs.readdirSync('./gulp/tasks/').filter(onlyScripts); + +TASKS.forEach(function(task) { require('./tasks/' + task); -}); \ No newline at end of file +}); diff --git a/gulp/tasks/browserSync.js b/gulp/tasks/browserSync.js index 9cebe37..b566d3c 100644 --- a/gulp/tasks/browserSync.js +++ b/gulp/tasks/browserSync.js @@ -14,7 +14,7 @@ gulp.task('browserSync', function() { server: { baseDir: config.buildDir, middleware: function(req, res, next) { - let fileHref = url.parse(req.url).href; + const fileHref = url.parse(req.url).href; if ( !ASSET_EXTENSION_REGEX.test(fileHref)) { req.url = '/' + DEFAULT_FILE; @@ -32,4 +32,4 @@ gulp.task('browserSync', function() { } }); -}); \ No newline at end of file +}); diff --git a/gulp/tasks/browserify.js b/gulp/tasks/browserify.js index 45f31de..7d2a247 100644 --- a/gulp/tasks/browserify.js +++ b/gulp/tasks/browserify.js @@ -19,7 +19,7 @@ import config from '../config'; // Based on: http://blog.avisi.nl/2014/04/25/how-to-keep-a-fast-build-with-browserify-and-reactjs/ function buildScript(file, watch) { - var bundler = browserify({ + let bundler = browserify({ entries: [config.sourceDir + 'js/' + file], debug: !global.isProd, cache: {}, @@ -36,7 +36,7 @@ function buildScript(file, watch) { bundler.transform(debowerify); function rebundle() { - let stream = bundler.bundle(); + const stream = bundler.bundle(); gutil.log('Rebundle...'); diff --git a/gulp/tasks/clean.js b/gulp/tasks/clean.js index 6df5528..bcd171e 100644 --- a/gulp/tasks/clean.js +++ b/gulp/tasks/clean.js @@ -8,4 +8,4 @@ gulp.task('clean', function() { return del([config.buildDir]); -}); \ No newline at end of file +}); diff --git a/gulp/tasks/copyIcons.js b/gulp/tasks/copyIcons.js index 2af6f8f..b771593 100644 --- a/gulp/tasks/copyIcons.js +++ b/gulp/tasks/copyIcons.js @@ -5,7 +5,6 @@ import config from '../config'; gulp.task('copyIcons', function() { - // Copy icons from root directory to build/ return gulp.src(['./*.png', './favicon.ico']) .pipe(gulp.dest(config.buildDir)); diff --git a/gulp/tasks/copyIndex.js b/gulp/tasks/copyIndex.js index 03de0c8..45fbe60 100644 --- a/gulp/tasks/copyIndex.js +++ b/gulp/tasks/copyIndex.js @@ -7,4 +7,4 @@ gulp.task('copyIndex', function() { gulp.src(config.sourceDir + 'index.html').pipe(gulp.dest(config.buildDir)); -}); \ No newline at end of file +}); diff --git a/gulp/tasks/deploy.js b/gulp/tasks/deploy.js index 8bf693f..a39b0e6 100644 --- a/gulp/tasks/deploy.js +++ b/gulp/tasks/deploy.js @@ -1,10 +1,9 @@ 'use strict'; import gulp from 'gulp'; -//import config from '../config'; gulp.task('deploy', ['prod'], function() { // Deploy to hosting environment -}); \ No newline at end of file +}); diff --git a/gulp/tasks/development.js b/gulp/tasks/development.js index 955d25c..b761fe3 100644 --- a/gulp/tasks/development.js +++ b/gulp/tasks/development.js @@ -9,7 +9,6 @@ gulp.task('dev', ['clean'], function(cb) { global.isProd = false; - // Run all tasks once return runSequence(['sass', 'imagemin', 'browserify', 'copyFonts', 'copyIndex', 'copyIcons'], 'watch', cb); -}); \ No newline at end of file +}); diff --git a/gulp/tasks/imagemin.js b/gulp/tasks/imagemin.js index 164b91f..48c9bf8 100644 --- a/gulp/tasks/imagemin.js +++ b/gulp/tasks/imagemin.js @@ -8,10 +8,9 @@ import config from '../config'; gulp.task('imagemin', function() { - // Run imagemin task on all images return gulp.src(config.images.src) .pipe(gulpif(global.isProd, imagemin())) .pipe(gulp.dest(config.images.dest)) .pipe(gulpif(browserSync.active, browserSync.reload({ stream: true, once: true }))); -}); \ No newline at end of file +}); diff --git a/gulp/tasks/production.js b/gulp/tasks/production.js index 3e86401..89c2f53 100644 --- a/gulp/tasks/production.js +++ b/gulp/tasks/production.js @@ -11,4 +11,4 @@ gulp.task('prod', ['clean'], function(cb) { runSequence(['sass', 'imagemin', 'browserify', 'copyFonts', 'copyIndex', 'copyIcons'], cb); -}); \ No newline at end of file +}); diff --git a/gulp/tasks/watch.js b/gulp/tasks/watch.js index c9b65bc..f142f2f 100644 --- a/gulp/tasks/watch.js +++ b/gulp/tasks/watch.js @@ -6,8 +6,8 @@ import config from '../config'; gulp.task('watch', ['browserSync'], function() { // Scripts are automatically watched by Watchify inside Browserify task - gulp.watch(config.styles.src, ['sass']); - gulp.watch(config.images.src, ['imagemin']); - gulp.watch(config.sourceDir + 'index.html', ['copyIndex']); + gulp.watch(config.styles.src, ['sass']); + gulp.watch(config.images.src, ['imagemin']); + gulp.watch(config.sourceDir + 'index.html', ['copyIndex']); -}); \ No newline at end of file +}); diff --git a/gulp/util/handle-errors.js b/gulp/util/handle-errors.js index 3cf398a..ca5a24f 100644 --- a/gulp/util/handle-errors.js +++ b/gulp/util/handle-errors.js @@ -1,12 +1,12 @@ 'use strict'; -var notify = require('gulp-notify'); +import notify from 'gulp-notify'; -module.exports = function(error) { +export default function(error) { if( !global.isProd ) { - var args = Array.prototype.slice.call(arguments); + const args = Array.prototype.slice.call(arguments); // Send error to notification center with gulp-notify notify.onError({ @@ -24,4 +24,4 @@ module.exports = function(error) { process.exit(1); } -}; \ No newline at end of file +}; diff --git a/gulp/util/script-filter.js b/gulp/util/script-filter.js index 3157bf6..3f86791 100644 --- a/gulp/util/script-filter.js +++ b/gulp/util/script-filter.js @@ -1,9 +1,9 @@ 'use strict'; -var path = require('path'); +import path from 'path'; // Filters out non .coffee and .js files. Prevents // accidental inclusion of possible hidden files -module.exports = function(name) { +export default function(name) { return /(\.(js|coffee)$)/i.test(path.extname(name)); -}; \ No newline at end of file +}; diff --git a/tests/helper.js b/tests/helper.js index d7a2096..a3b729a 100644 --- a/tests/helper.js +++ b/tests/helper.js @@ -6,4 +6,4 @@ beforeEach(function() { afterEach(function() { global.sandbox.restore(); -}); \ No newline at end of file +});