Skip to content

Commit 2bddb80

Browse files
committed
Update linters to conform to ShakaCode standards
This change is in paralell with the change made for the webpack tutorial. See shakacode/react-webpack-rails-tutorial#159
1 parent b5cb83e commit 2bddb80

File tree

4 files changed

+109
-13
lines changed

4 files changed

+109
-13
lines changed

.eslintrc

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,46 @@ extends: eslint-config-airbnb
66
plugins:
77
- react
88

9+
globals:
10+
__DEBUG_SERVER_ERRORS__: true
11+
__SERVER_ERRORS__: true
12+
google: true
13+
amenitiesList: true
14+
File: true
15+
916
env:
1017
browser: true
1118
node: true
19+
mocha: true
1220

1321
rules:
22+
### Variables
23+
no-undef: 2
24+
no-unused-vars: [2, { vars: all, args: none }]
25+
26+
### Stylistic issues
1427
indent: [1, 2, { SwitchCase: 1, VariableDeclarator: 2 }]
15-
react/sort-comp: 0
16-
react/jsx-quotes: 0
1728
id-length: [1, { min: 2, exceptions: [_, e, i, k, v] }]
29+
30+
### React
31+
jsx-quotes: [1, prefer-double]
32+
react/display-name: 0
33+
react/jsx-boolean-value: [1, always]
34+
react/jsx-curly-spacing: [1, never]
35+
react/jsx-no-duplicate-props: [2, { ignoreCase: true }]
36+
react/jsx-no-undef: 2
37+
react/jsx-sort-prop-types: 0
38+
react/jsx-sort-props: 0
39+
react/jsx-uses-react: 2
40+
react/jsx-uses-vars: 2
41+
react/no-danger: 0
42+
react/no-did-mount-set-state: 1
43+
react/no-did-update-set-state: 0
44+
react/no-multi-comp: 2
45+
react/no-unknown-property: 2
46+
react/prop-types: 1
47+
react/react-in-jsx-scope: 2
48+
react/require-extension: [1, { extensions: [.js, .jsx] }]
49+
react/self-closing-comp: 2
50+
react/sort-comp: 0 # Should be 1. `statics` should be on top.
51+
react/wrap-multilines: 2

.jscsrc

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
11
{
22
"preset": "airbnb",
3-
"fileExtensions": [".js", ".jsx"],
4-
"excludeFiles": ["**/build/**", "**/node_modules/**", "**/generated/**", "**/docs/**", "**/tmp/**", "**/sample_generated/**", "**/coverage/**", "**/vendor/**", "**/dummy-for-generators/**"],
5-
"requireTrailingComma": { "ignoreSingleValue": true, "ignoreSingleLine": true },
6-
"validateQuoteMarks": false
3+
"fileExtensions": [
4+
".js",
5+
".jsx"
6+
],
7+
"excludeFiles": [
8+
"**/build/**",
9+
"**/node_modules/**",
10+
"**/generated/**",
11+
"**/docs/**",
12+
"**/tmp/**",
13+
"**/sample_generated/**",
14+
"**/coverage/**",
15+
"**/vendor/**",
16+
"**/dummy-for-generators/**"
17+
],
18+
"esprima": "babel-jscs",
19+
"validateQuoteMarks": {
20+
"mark": "'",
21+
"escape": true,
22+
"ignoreJSX": true
23+
}
724
}

lib/generators/react_on_rails/templates/js_linters/client/.eslintrc

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,46 @@ extends: eslint-config-airbnb
66
plugins:
77
- react
88

9+
globals:
10+
__DEBUG_SERVER_ERRORS__: true
11+
__SERVER_ERRORS__: true
12+
google: true
13+
amenitiesList: true
14+
File: true
15+
916
env:
1017
browser: true
1118
node: true
19+
mocha: true
1220

1321
rules:
22+
### Variables
23+
no-undef: 2
24+
no-unused-vars: [2, { vars: all, args: none }]
25+
26+
### Stylistic issues
1427
indent: [1, 2, { SwitchCase: 1, VariableDeclarator: 2 }]
15-
react/sort-comp: 0
16-
react/jsx-quotes: 1
17-
id-length: [2, {"exceptions": ["e", "i", "_"]}]
28+
id-length: [1, { min: 2, exceptions: [_, e, i, k, v] }]
29+
30+
### React
31+
jsx-quotes: [1, prefer-double]
32+
react/display-name: 0
33+
react/jsx-boolean-value: [1, always]
34+
react/jsx-curly-spacing: [1, never]
35+
react/jsx-no-duplicate-props: [2, { ignoreCase: true }]
36+
react/jsx-no-undef: 2
37+
react/jsx-sort-prop-types: 0
38+
react/jsx-sort-props: 0
39+
react/jsx-uses-react: 2
40+
react/jsx-uses-vars: 2
41+
react/no-danger: 0
42+
react/no-did-mount-set-state: 1
43+
react/no-did-update-set-state: 0
44+
react/no-multi-comp: 2
45+
react/no-unknown-property: 2
46+
react/prop-types: 1
47+
react/react-in-jsx-scope: 2
48+
react/require-extension: [1, { extensions: [.js, .jsx] }]
49+
react/self-closing-comp: 2
50+
react/sort-comp: 0 # Should be 1. `statics` should be on top.
51+
react/wrap-multilines: 2
Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
{
22
"preset": "airbnb",
3-
"fileExtensions": [".js", ".jsx"],
4-
"excludeFiles": ["build/**", "node_modules/**"],
5-
6-
"validateQuoteMarks": null // Issue with JSX quotemarks: https://github.com/jscs-dev/babel-jscs/issues/12
3+
"fileExtensions": [
4+
".js",
5+
".jsx"
6+
],
7+
"excludeFiles": [
8+
"assets/**",
9+
"build/**",
10+
"node_modules/**"
11+
],
12+
"esprima": "babel-jscs",
13+
"validateQuoteMarks": {
14+
"mark": "'",
15+
"escape": true,
16+
"ignoreJSX": true
17+
}
718
}

0 commit comments

Comments
 (0)