Skip to content
Merged
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
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules
coverage
spec/react_on_rails/dummy-for-generators
spec/dummy
spec/dummy-react-013
35 changes: 33 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,43 @@ extends: eslint-config-airbnb
plugins:
- react

globals:
__DEBUG_SERVER_ERRORS__: true
__SERVER_ERRORS__: true

env:
browser: true
node: true
mocha: true

rules:
### Variables
no-undef: 2
no-unused-vars: [2, { vars: all, args: none }]

### Stylistic issues
indent: [1, 2, { SwitchCase: 1, VariableDeclarator: 2 }]
react/sort-comp: 0
react/jsx-quotes: 0
id-length: [1, { min: 2, exceptions: [_, e, i, k, v] }]

### React
jsx-quotes: [1, prefer-double]
react/display-name: 0
react/jsx-boolean-value: [1, always]
react/jsx-curly-spacing: [1, never]
react/jsx-no-duplicate-props: [2, { ignoreCase: true }]
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: 0
react/no-did-mount-set-state: 1
react/no-did-update-set-state: 0
react/no-multi-comp: 2
react/no-unknown-property: 2
react/prop-types: 1
react/react-in-jsx-scope: 2
react/require-extension: [1, { extensions: [.js, .jsx] }]
react/self-closing-comp: 2
react/sort-comp: 0 # Should be 1. `statics` should be on top.
react/wrap-multilines: 2
27 changes: 23 additions & 4 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
{
"preset": "airbnb",
"fileExtensions": [".js", ".jsx"],
"excludeFiles": ["**/build/**", "**/node_modules/**", "**/generated/**", "**/docs/**", "**/tmp/**", "**/sample_generated/**", "**/coverage/**", "**/vendor/**", "**/dummy-for-generators/**"],
"requireTrailingComma": { "ignoreSingleValue": true, "ignoreSingleLine": true },
"validateQuoteMarks": false
"fileExtensions": [
".js",
".jsx"
],
"excludeFiles": [
"**/build/**",
"**/node_modules/**",
"**/generated/**",
"**/docs/**",
"**/tmp/**",
"**/sample_generated/**",
"**/coverage/**",
"**/vendor/**",
"**/dummy-for-generators/**",
"**/dummy/**",
"**/dummy-react-013/**"
],
"esprima": "babel-jscs",
"validateQuoteMarks": {
"mark": "'",
"escape": true,
"ignoreJSX": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ if %w(development test).include? Rails.env
<%- end -%>

<%- enabled_linters = [] -%>
<%- enabled_linters << %i(rubocop ruby) if options.ruby_linters? -%>
<%- enabled_linters << %i(js scss) unless options.skip_js_linters? -%>
<%- enabled_linters << %i(rubocop ruby scss) if options.ruby_linters? -%>
<%- enabled_linters << %i(js) unless options.skip_js_linters? -%>
task lint: <%= enabled_linters.flatten %> do
puts "Completed all linting"
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,43 @@ extends: eslint-config-airbnb
plugins:
- react

globals:
__DEBUG_SERVER_ERRORS__: true
__SERVER_ERRORS__: true

env:
browser: true
node: true
mocha: true

rules:
### Variables
no-undef: 2
no-unused-vars: [2, { vars: all, args: none }]

### Stylistic issues
indent: [1, 2, { SwitchCase: 1, VariableDeclarator: 2 }]
react/sort-comp: 0
react/jsx-quotes: 1
id-length: [2, {"exceptions": ["e", "i", "_"]}]
id-length: [1, { min: 2, exceptions: [_, e, i, k, v] }]

### React
jsx-quotes: [1, prefer-double]
react/display-name: 0
react/jsx-boolean-value: [1, always]
react/jsx-curly-spacing: [1, never]
react/jsx-no-duplicate-props: [2, { ignoreCase: true }]
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: 0
react/no-did-mount-set-state: 1
react/no-did-update-set-state: 0
react/no-multi-comp: 2
react/no-unknown-property: 2
react/prop-types: 1
react/react-in-jsx-scope: 2
react/require-extension: [1, { extensions: [.js, .jsx] }]
react/self-closing-comp: 2
react/sort-comp: 0 # Should be 1. `statics` should be on top.
react/wrap-multilines: 2
19 changes: 15 additions & 4 deletions lib/generators/react_on_rails/templates/js_linters/client/.jscsrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
{
"preset": "airbnb",
"fileExtensions": [".js", ".jsx"],
"excludeFiles": ["build/**", "node_modules/**"],

"validateQuoteMarks": null // Issue with JSX quotemarks: https://github.com/jscs-dev/babel-jscs/issues/12
"fileExtensions": [
".js",
".jsx"
],
"excludeFiles": [
"assets/**",
"build/**",
"node_modules/**"
],
"esprima": "babel-jscs",
"validateQuoteMarks": {
"mark": "'",
"escape": true,
"ignoreJSX": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default class HelloWorldWidget extends React.Component {
</h3>
<p>
Say hello to:
<input type="text" ref="name" value={this.props.name} onChange={this._handleChange} />
<input type="text" value={this.props.name} onChange={this._handleChange} />
</p>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint no-console: 0 */
import _ from 'lodash';

// This logger should be configured not to run in a production environment.
// See https://github.com/petehunt/webpack-howto#6-feature-flags for you might turn this off for production.
Expand Down