Skip to content
This repository was archived by the owner on Jan 14, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# v0.1.1
* Updated ESLint React settings with new rules implemented
* Added ESLint settings for Backbone
4 changes: 3 additions & 1 deletion app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ module.exports = generators.Base.extend({
var devDependencies = [
'browser-sync',
'del',
'eslint-friendly-formatter',
'gulp',
'gulp-autoprefixer',
'gulp-eslint',
Expand Down Expand Up @@ -281,7 +282,8 @@ module.exports = generators.Base.extend({

if (this.useBackbone) {
devDependencies.push(
'node-underscorify'
'node-underscorify',
'eslint-plugin-backbone'
);
dependencies.push(
'backbone',
Expand Down
76 changes: 64 additions & 12 deletions app/templates/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
"computed-property-spacing": [2, "never"],
"consistent-this": [2, "self"],
"eol-last": 2,
"func-names": 2,
"func-names": 0,
"func-style": [2, "expression"],
"quotes": [1, "single"],
"no-underscore-dangle": 0,
Expand All @@ -126,21 +126,73 @@
}]<% if (useReact) { %>,

// react
"react/display-name": 2,
"react/jsx-quotes": [2, "double", "avoid-escape"],
"react/jsx-uses-react": 1,
"react/jsx-uses-vars": 1,
"react/display-name": 0,
"react/jsx-boolean-value": 0,
"react/jsx-closing-bracket-location": 2,
"react/jsx-curly-spacing": 2,
"react/jsx-indent-props": [2, 4],
"react/jsx-max-props-per-line": 0,
"react/jsx-no-duplicate-props": 2,
"react/jsx-no-literals": 0,
"react/jsx-no-undef": 2,
"react/jsx-sort-prop-types": 0,
"react/jsx-sort-props": 0,
"react/jsx-uses-react": 2,
"react/jsx-uses-vars": 2,
"react/no-danger": 2,
"react/no-did-mount-set-state": [1, "allow-in-func"],
"react/no-did-update-set-state": 1,
"react/no-multi-comp": 1,
"react/no-unknown-property": 1,
"react/prop-types": 1,
"react/self-closing-comp": 1,
"react/wrap-multilines": 1<% } %><% if (useBackbone) { %>,
"react/no-multi-comp": 2,
"react/no-set-state": 0,
"react/no-unknown-property": 2,
"react/prop-types": 2,
"react/react-in-jsx-scope": 0,
"react/require-extension": 2,
"react/self-closing-comp": 2,
"react/sort-comp": 2,
"react/wrap-multilines": 2<% } %><% if (useBackbone) { %>,

// backbone
// https://github.com/ilyavolodin/eslint-plugin-backbone
<% } %><% if (useBabel) { %>
"backbone/collection-model": 2,
"backbone/defaults-on-top": 2,
"backbone/event-scope": 0, // unfortunately this errors on jQuery events too which can't pass scope
"backbone/events-on-top": [2, [
"id",
"el",
"tagName",
"className"
]],
"backbone/initialize-on-top": [2, {
View: [
"id",
"el",
"tagName",
"className",
"events"
],
Model: [
"defaults",
"url",
"urlRoot"
],
Collection: [
"model",
"url",
"comparator"
]
}],
"backbone/model-defaults": 2,
"backbone/no-changed-set": 2,
"backbone/no-collection-models": 2,
"backbone/no-constructor": 2,
"backbone/no-el-assign": 2,
"backbone/no-model-attributes": 2,
"backbone/no-native-jquery": 0,
"backbone/no-silent": 0,
"backbone/no-view-collection-models": 2,
"backbone/no-view-model-attributes": 2,
"backbone/no-view-onoff-binding": 2,
"backbone/render-return": 2<% } %><% if (useBabel) { %>,

// es6
<% } %>
Expand Down
3 changes: 2 additions & 1 deletion app/templates/gulp/tasks/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
var gulp = require('gulp'),
config = require('../config.json'),
eslint = require('gulp-eslint'),
friendlyFormatter = require('eslint-friendly-formatter'),
handleErrors = require('../utils/handle-errors');

gulp.task('lint', function() {
Expand All @@ -13,7 +14,7 @@ gulp.task('lint', function() {
'!' + config.js + '/**/*.min.js'
])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.format(friendlyFormatter))
.pipe(eslint.failAfterError())
.on('error', handleErrors);
});
6 changes: 3 additions & 3 deletions app/templates/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "<%= slug %>",
"description": "<%= description %>",
"version": "0.1.0",
"version": "0.1.1",
"author": {
"name": "<%= name %>",
"email": "<%= email %>",
Expand All @@ -15,8 +15,8 @@
"main": <% if (useBrowserify) { %>"js/app.js"<% } else { %>"js/main.js"<% } %><% if (useBrowserify && (usejQuery || useBackbone || useBabel || useReact)) { %>,
"browserify": {
"transform": [
<% if (useBabel || useReact) { %>"babelify",<% } %>
<% if (useBackbone) { %>"browserify-shim",
<% if (useBabel || useReact) { %>"babelify"<% } %><% if (useBackbone) { %><% if (useBabel || useReact) { %>,
<% } %>"browserify-shim",
"node-underscorify"<% } %>
]
}<% if (usejQuery && useBackbone) { %>,
Expand Down
1 change: 0 additions & 1 deletion app/templates/react/es6/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ let routes = (

Router.run(
routes,
Router.HistoryLocation,
(Handler, state) => {
React.render(<Handler params={state.params} />, document.getElementById('wrapper'));
}
Expand Down
17 changes: 16 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,22 @@
"app"
],
"keywords": [
"yeoman-generator"
"yeoman-generator",
"backbone",
"react",
"sass",
"css",
"javascript",
"front-end",
"eslint",
"gulp",
"autoprefixer",
"babel",
"jquery",
"lodash",
"sprites",
"icon fonts",
"icomoon"
],
"dependencies": {
"lodash": "^3.10.0",
Expand Down