Skip to content

Commit 7b5e114

Browse files
committed
Added eslint and code inspection
* RubyMine and Webstorm can use the client/jetbrains/Inspection_RailsOnMaui_Default.xml inspection setting. * Run eslint via command /client/bin/lint * Not using the gulpfile one as the gulp-eslint is locked to the older eslint * Using the AirBnb JavaScript standard (https://github.com/airbnb/javascript). * Add code style and readme file to /client/jetbrains directory
1 parent 96926f6 commit 7b5e114

36 files changed

+1504
-401
lines changed

Diff for: app/assets/javascripts/application.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@
1717

1818
// Important to import jquery_ujs before rails-bundle as that patches jquery xhr to use the authenticity token!
1919

20-
//= require client-bundle
20+
//= require generated/client-bundle
2121
//= require turbolinks

Diff for: app/assets/stylesheets/scaffolds.css.scss

+2-3
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ div {
4848
#error_explanation {
4949
width: 450px;
5050
border: 2px solid red;
51-
padding: 7px;
52-
padding-bottom: 0;
51+
padding: 7px 7px 0;
5352
margin-bottom: 20px;
5453
background-color: #f0f0f0;
5554
h2 {
@@ -58,7 +57,7 @@ div {
5857
padding: 5px 5px 5px 15px;
5958
font-size: 12px;
6059
margin: -7px;
61-
margin-bottom: 0px;
60+
margin-bottom: 0;
6261
background-color: #c00;
6362
color: #fff;
6463
}

Diff for: client/.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

Diff for: client/.eslintrc

+173
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
# ESLint documentation can be found at http://eslint.org/docs/
2+
# find . -path ./node_modules -prune -o -name "*.js" -o -name "*.jsx" -exec eslint {} \;
3+
parser: "babel-eslint"
4+
plugins: ["react"]
5+
ecmaFeatures:
6+
jsx: true
7+
env:
8+
browser: true
9+
node: true
10+
amd: false
11+
mocha: true
12+
jasmine: false
13+
rules:
14+
no-alert: 2
15+
no-array-constructor: 2
16+
no-bitwise: 0
17+
no-caller: 2
18+
no-catch-shadow: 2
19+
no-comma-dangle: 2
20+
no-cond-assign: [2, 'always']
21+
no-console: 0
22+
no-constant-condition: 2
23+
no-control-regex: 2
24+
no-debugger: 2
25+
no-delete-var: 2
26+
no-div-regex: 0
27+
no-dupe-keys: 2
28+
no-dupe-args: 2
29+
no-duplicate-case: 2
30+
no-else-return: 2
31+
no-empty: 2
32+
no-empty-class: 2
33+
no-empty-label: 2
34+
no-eq-null: 2
35+
no-eval: 2
36+
no-ex-assign: 2
37+
no-extend-native: 2
38+
no-extra-bind: 2
39+
no-extra-boolean-cast: 2
40+
no-extra-parens: 0
41+
no-extra-semi: 2
42+
no-fallthrough: 2
43+
no-floating-decimal: 0
44+
no-func-assign: 2
45+
no-implied-eval: 2
46+
no-inline-comments: 0
47+
no-inner-declarations: [2, 'functions']
48+
no-invalid-regexp: 2
49+
no-irregular-whitespace: 2
50+
no-iterator: 2
51+
no-label-var: 2
52+
no-labels: 2
53+
no-lone-blocks: 2
54+
no-lonely-if: 2
55+
no-loop-func: 2
56+
no-mixed-requires: [0, false]
57+
no-mixed-spaces-and-tabs: [2, false]
58+
no-multi-spaces: 2
59+
no-multi-str: 2
60+
no-multiple-empty-lines: [2, {max: 2}]
61+
no-native-reassign: 2
62+
no-negated-in-lhs: 2
63+
no-nested-ternary: 0
64+
no-new: 2
65+
no-new-func: 2
66+
no-new-object: 2
67+
no-new-require: 0
68+
no-new-wrappers: 2
69+
no-obj-calls: 2
70+
no-octal: 2
71+
no-octal-escape: 2
72+
no-path-concat: 0
73+
no-plusplus: 0
74+
no-process-env: 0
75+
no-process-exit: 0
76+
no-proto: 2
77+
no-redeclare: 2
78+
no-regex-spaces: 2
79+
no-reserved-keys: 0
80+
no-restricted-modules: 0
81+
no-return-assign: 2
82+
no-script-url: 2
83+
no-self-compare: 2
84+
no-sequences: 2
85+
no-shadow: 2
86+
no-shadow-restricted-names: 2
87+
no-space-before-semi: 2
88+
no-spaced-func: 2
89+
no-sparse-arrays: 2
90+
no-sync: 0
91+
no-ternary: 0
92+
no-trailing-spaces: 2
93+
no-undef: 2
94+
no-undef-init: 2
95+
no-undefined: 0
96+
no-underscore-dangle: 0
97+
no-unreachable: 2
98+
no-unused-expressions: 2
99+
no-unused-vars: [2, {vars: 'all', args: 'after-used'}]
100+
no-use-before-define: 2
101+
no-void: 2
102+
no-var: 0
103+
no-warning-comments: [0, {terms: ['todo', 'fixme', 'xxx'], location: 'start'}]
104+
no-with: 2
105+
no-wrap-func: 2
106+
block-scoped-var: 2
107+
brace-style: 2
108+
camelcase: 0
109+
comma-spacing: 2
110+
comma-style: 2
111+
complexity: [0, 11]
112+
consistent-return: 2
113+
consistent-this: [2, 'self']
114+
curly: [2, 'all']
115+
default-case: 0
116+
dot-notation: [2, {allowKeywords: true}]
117+
eol-last: 2
118+
eqeqeq: 2
119+
func-names: 0
120+
func-style: [2, 'declaration']
121+
generator-star: 0
122+
guard-for-in: 0
123+
handle-callback-err: 2
124+
indent: [2, 2]
125+
key-spacing: [2, {beforeColon: false, afterColon: true}]
126+
max-depth: [1, 4]
127+
# Different from 80 chars of AirBnb Javascript
128+
max-len: [2, 100]
129+
max-nested-callbacks: [1, 2]
130+
max-params: [1, 4]
131+
max-statements: [0, 10]
132+
new-cap: 2
133+
new-parens: 2
134+
one-var: 0
135+
operator-assignment: [0, 'always']
136+
padded-blocks: 0
137+
quote-props: 0
138+
quotes: [2, 'single']
139+
radix: 2
140+
semi: 2
141+
sort-vars: 0
142+
space-after-function-name: [0, 'never']
143+
space-after-keywords: 2
144+
space-before-blocks: 2
145+
space-before-function-parentheses: [2, "never"]
146+
space-in-brackets: 2
147+
space-in-parens: 2
148+
space-infix-ops: 2
149+
space-return-throw-case: 2
150+
space-unary-ops: [2, {words: true, nonwords: false}]
151+
spaced-line-comment: 2
152+
strict: [2, 'global']
153+
use-isnan: 2
154+
valid-jsdoc: 2
155+
valid-typeof: 2
156+
vars-on-top: 0
157+
wrap-iife: 0
158+
wrap-regex: 0
159+
yoda: [2, 'never']
160+
react/display-name: 1
161+
react/jsx-quotes: 1
162+
react/jsx-no-undef: 1
163+
react/jsx-uses-react: 1
164+
react/jsx-uses-vars: 1
165+
react/no-did-mount-set-state: 1
166+
react/no-did-update-set-state: 1
167+
react/no-multi-comp: 1
168+
react/prop-types: 1
169+
react/react-in-jsx-scope: 1
170+
react/self-closing-comp: 1
171+
react/wrap-multilines: 1
172+
globals:
173+
Promise: true

Diff for: client/README.md

+14
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
11
Please see parent directory README.md.
22

33
(We may move client side specific README material here in the near future).
4+
5+
6+
Running linter:
7+
===========================
8+
9+
Soon to be in gulpfile....but gulp-eslint depends on eslint 0.17.0
10+
11+
For now:
12+
13+
bin/lint
14+
15+
16+
17+

Diff for: client/assets/javascripts/Comment.jsx

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
'use strict';
2+
3+
import marked from 'marked';
4+
import React from 'react';
5+
6+
var Comment = React.createClass({
7+
displayName: 'Comment',
8+
9+
propTypes: {
10+
author: React.PropTypes.string.isRequired,
11+
text: React.PropTypes.string.isRequired
12+
},
13+
14+
render: function() {
15+
var rawMarkup = marked(this.props.text);
16+
return (
17+
<div className='comment'>
18+
<h2 className='comment-author foobar'>
19+
{this.props.author}
20+
</h2>
21+
<span dangerouslySetInnerHTML={{__html: rawMarkup}}/>
22+
</div>
23+
);
24+
}
25+
});
26+
27+
export default Comment;

0 commit comments

Comments
 (0)