Skip to content

Commit

Permalink
Merge pull request #39 from jakemmarsh/update-linter
Browse files Browse the repository at this point in the history
Update linter packages and config
  • Loading branch information
jakemmarsh committed May 12, 2016
2 parents 8e34e39 + 8369047 commit bd7d230
Show file tree
Hide file tree
Showing 29 changed files with 59 additions and 55 deletions.
17 changes: 11 additions & 6 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,28 @@
},
"env": {
"browser": true,
"node": true
"es6": true,
"node": true,
},
"rules": {
"quotes": [2, "single"],
"eol-last": 0,
"eol-last": 2,
"no-debugger": 1,
"no-mixed-requires": 0,
"no-underscore-dangle": 0,
"no-multi-spaces": 0,
"no-trailing-spaces": 0,
"no-extra-boolean-cast": 0,
"no-unused-vars": 1,
"no-undef": 2,
"no-unused-vars": 2,
"no-var": 2,
"prefer-const": 2,
"new-cap": 0,
"camelcase": 1,
"camelcase": 2,
"semi": 2,
"react/jsx-uses-react": 2,
"react/jsx-uses-vars": 2,
"react/react-in-jsx-scope": 0,
"react/react-in-jsx-scope": 2,
"react/prop-types": 2
}
}
}
2 changes: 1 addition & 1 deletion app/js/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ class App extends React.Component {

App.propTypes = propTypes;

export default App;
export default App;
2 changes: 1 addition & 1 deletion app/js/actions/CurrentUserActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ const CurrentUserActions = Reflux.createActions([

]);

export default CurrentUserActions;
export default CurrentUserActions;
2 changes: 1 addition & 1 deletion app/js/components/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ class Footer extends React.Component{

}

export default Footer;
export default Footer;
2 changes: 1 addition & 1 deletion app/js/components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ class Header extends React.Component {

}

export default Header;
export default Header;
2 changes: 1 addition & 1 deletion app/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ if ( process.env.NODE_ENV !== 'production' ) {
window.React = React;
}

ReactDOM.render(Routes, document.getElementById('app'));
ReactDOM.render(Routes, document.getElementById('app'));
2 changes: 1 addition & 1 deletion app/js/pages/HomePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ class HomePage extends React.Component {

HomePage.propTypes = propTypes;

export default HomePage;
export default HomePage;
2 changes: 1 addition & 1 deletion app/js/pages/NotFoundPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ class NotFoundPage extends React.Component {

NotFoundPage.propTypes = propTypes;

export default NotFoundPage;
export default NotFoundPage;
2 changes: 1 addition & 1 deletion app/js/pages/SearchPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ class SearchPage extends React.Component {

SearchPage.propTypes = propTypes;

export default SearchPage;
export default SearchPage;
2 changes: 1 addition & 1 deletion app/js/utils/AuthAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ const AuthAPI = {

};

export default AuthAPI;
export default AuthAPI;
4 changes: 3 additions & 1 deletion gulp/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ const config = {

scripts: {
src: './app/js/**/*.js',
dest: './build/js/'
dest: './build/js/',
test: './tests/**/*.js',
gulp: './gulp/**/*.js'
},

images: {
Expand Down
11 changes: 6 additions & 5 deletions gulp/index.js
Original file line number Diff line number Diff line change
@@ -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);
});
});
4 changes: 2 additions & 2 deletions gulp/tasks/browserSync.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -32,4 +32,4 @@ gulp.task('browserSync', function() {
}
});

});
});
4 changes: 2 additions & 2 deletions gulp/tasks/browserify.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {},
Expand All @@ -36,7 +36,7 @@ function buildScript(file, watch) {
bundler.transform(debowerify);

function rebundle() {
let stream = bundler.bundle();
const stream = bundler.bundle();

gutil.log('Rebundle...');

Expand Down
2 changes: 1 addition & 1 deletion gulp/tasks/clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ gulp.task('clean', function() {

return del([config.buildDir]);

});
});
1 change: 0 additions & 1 deletion gulp/tasks/copyIcons.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
2 changes: 1 addition & 1 deletion gulp/tasks/copyIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ gulp.task('copyIndex', function() {

gulp.src(config.sourceDir + 'index.html').pipe(gulp.dest(config.buildDir));

});
});
3 changes: 1 addition & 2 deletions gulp/tasks/deploy.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
'use strict';

import gulp from 'gulp';
//import config from '../config';

gulp.task('deploy', ['prod'], function() {

// Deploy to hosting environment

});
});
3 changes: 1 addition & 2 deletions gulp/tasks/development.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

});
});
3 changes: 1 addition & 2 deletions gulp/tasks/imagemin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 })));

});
});
4 changes: 2 additions & 2 deletions gulp/tasks/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import config from '../config';

gulp.task('lint', function() {

return gulp.src([config.scripts.src, config.testFiles, './*.js'])
return gulp.src([config.scripts.src, config.scripts.test, config.scripts.gulp])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());

});
});
2 changes: 1 addition & 1 deletion gulp/tasks/production.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ gulp.task('prod', ['clean'], function(cb) {

runSequence(['sass', 'imagemin', 'browserify', 'copyFonts', 'copyIndex', 'copyIcons'], cb);

});
});
2 changes: 1 addition & 1 deletion gulp/tasks/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ gulp.task('test', () => {
files = ['tests/helper.js', singleFile];
} else {
// Default to all test files
files = [config.testFiles];
files = [config.scripts.test];
}

// Ensure that all window/DOM related properties
Expand Down
8 changes: 4 additions & 4 deletions gulp/tasks/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']);

});
});
8 changes: 4 additions & 4 deletions gulp/util/handle-errors.js
Original file line number Diff line number Diff line change
@@ -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({
Expand All @@ -24,4 +24,4 @@ module.exports = function(error) {
process.exit(1);
}

};
};
6 changes: 3 additions & 3 deletions gulp/util/script-filter.js
Original file line number Diff line number Diff line change
@@ -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));
};
};
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
],
"devDependencies": {
"babel-core": "^6.3.15",
"babel-eslint": "^5.0.0-beta4",
"babel-eslint": "^6.0.4",
"babel-plugin-transform-object-rest-spread": "^6.3.13",
"babel-preset-es2015": "^6.3.13",
"babel-preset-react": "^6.3.13",
Expand All @@ -27,10 +27,10 @@
"change-case": "^2.3.1",
"debowerify": "^1.3.1",
"del": "^2.2.0",
"eslint-plugin-react": "^3.6.3",
"eslint-plugin-react": "^5.1.1",
"gulp": "^3.9.0",
"gulp-autoprefixer": "^3.1.0",
"gulp-eslint": "^1.1.1",
"gulp-eslint": "^2.0.0",
"gulp-if": "^2.0.0",
"gulp-imagemin": "^2.3.0",
"gulp-jsx-coverage": "^0.3.5",
Expand Down
4 changes: 2 additions & 2 deletions tests/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"globals": {
"sinon": true,
"sandbox": true,
"Should": true
"assert": true
}
}
}
2 changes: 1 addition & 1 deletion tests/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ beforeEach(function() {

afterEach(function() {
global.sandbox.restore();
});
});

0 comments on commit bd7d230

Please sign in to comment.