Skip to content

Commit 33fd71a

Browse files
committed
Switch to Airbnb eslint config and refactor code
1 parent db4557c commit 33fd71a

File tree

3 files changed

+65
-242
lines changed

3 files changed

+65
-242
lines changed

.eslintrc

Lines changed: 5 additions & 198 deletions
Original file line numberDiff line numberDiff line change
@@ -1,202 +1,9 @@
11
{
2-
"parser": "babel-eslint",
3-
"env": {
4-
"browser": false,
5-
"node": true
6-
},
7-
"plugins": [
8-
"react"
9-
],
10-
"ecmaFeatures": {
11-
"arrowFunctions": true,
12-
"blockBindings": true,
13-
"classes": true,
14-
"defaultParams": true,
15-
"destructuring": true,
16-
"experimentalObjectRestSpread": true,
17-
"forOf": true,
18-
"generators": false,
19-
"modules": true,
20-
"objectLiteralComputedProperties": true,
21-
"objectLiteralDuplicateProperties": false,
22-
"objectLiteralShorthandMethods": true,
23-
"objectLiteralShorthandProperties": true,
24-
"spread": true,
25-
"superInFunctions": true,
26-
"templateStrings": true,
27-
"jsx": true
28-
},
2+
"extends": "airbnb",
293
"rules": {
30-
/**
31-
* ES6
32-
*/
33-
"no-var": 0,
34-
"prefer-const": 0,
35-
36-
/**
37-
* Variables
38-
*/
39-
"no-shadow": 0,
40-
"no-shadow-restricted-names": 2,
41-
"no-undef": 2,
42-
"no-unused-vars": [2, {
43-
"vars": "local",
44-
"args": "after-used"
45-
}],
46-
"no-use-before-define": 0,
47-
48-
/**
49-
* Possible errors
50-
*/
51-
"comma-dangle": [2, "always-multiline"],
52-
"no-cond-assign": [2, "always"],
53-
"no-console": 0,
54-
"no-debugger": 1,
55-
"no-alert": 1,
56-
"no-constant-condition": 1,
57-
"no-dupe-keys": 2,
58-
"no-duplicate-case": 2,
59-
"no-empty": 2,
60-
"no-ex-assign": 2,
61-
"no-extra-boolean-cast": 0,
62-
"no-extra-semi": 2,
63-
"no-func-assign": 2,
64-
"no-inner-declarations": 2,
65-
"no-invalid-regexp": 2,
66-
"no-irregular-whitespace": 2,
67-
"no-obj-calls": 2,
68-
"no-sparse-arrays": 2,
69-
"no-unreachable": 2,
70-
"use-isnan": 2,
71-
"block-scoped-var": 2,
72-
73-
/**
74-
* Best practices
75-
*/
76-
"consistent-return": 2,
77-
"curly": [2, "multi-line"],
78-
"default-case": 2,
79-
"dot-notation": [2, {
80-
"allowKeywords": true
81-
}],
82-
"eqeqeq": 2,
83-
"guard-for-in": 2,
84-
"no-caller": 2,
85-
"no-else-return": 2,
86-
"no-eq-null": 2,
87-
"no-eval": 2,
88-
"no-extend-native": 2,
89-
"no-extra-bind": 2,
90-
"no-fallthrough": 2,
91-
"no-floating-decimal": 2,
92-
"no-implied-eval": 2,
93-
"no-lone-blocks": 2,
94-
"no-loop-func": 2,
95-
"no-multi-str": 2,
96-
"no-native-reassign": 2,
97-
"no-new": 2,
98-
"no-new-func": 2,
99-
"no-new-wrappers": 2,
100-
"no-octal": 2,
101-
"no-octal-escape": 2,
102-
"no-param-reassign": 2,
103-
"no-proto": 2,
104-
"no-redeclare": 2,
105-
"no-return-assign": 2,
106-
"no-script-url": 2,
107-
"no-self-compare": 2,
108-
"no-sequences": 2,
109-
"no-throw-literal": 2,
110-
"no-with": 2,
111-
"radix": 2,
112-
"vars-on-top": 0,
113-
"wrap-iife": [2, "any"],
114-
"yoda": 2,
115-
116-
/**
117-
* Style
118-
*/
119-
"indent": [2, 2, {"SwitchCase": 1, "VariableDeclarator": { "var": 2, "let": 2, "const": 3}}],
120-
"brace-style": [
121-
2,
122-
"1tbs", {
123-
"allowSingleLine": true
124-
}
125-
],
126-
"quotes": [
127-
2, "single", "avoid-escape"
128-
],
129-
"camelcase": [2, {
130-
"properties": "never"
131-
}],
132-
"comma-spacing": [2, {
133-
"before": false,
134-
"after": true
135-
}],
136-
"comma-style": [2, "last"],
137-
"eol-last": 2,
138-
"func-names": 0,
139-
"key-spacing": [2, {
140-
"beforeColon": false,
141-
"afterColon": true
142-
}],
143-
"keyword-spacing": 2,
144-
"new-cap": [2, {
145-
"newIsCap": true,
146-
"capIsNew": false
147-
}],
148-
"no-multiple-empty-lines": [2, {
149-
"max": 2
150-
}],
151-
"no-nested-ternary": 2,
152-
"no-new-object": 2,
153-
"no-spaced-func": 2,
154-
"no-trailing-spaces": 2,
155-
"no-extra-parens": [2, "functions"],
156-
"no-underscore-dangle": 0,
157-
"one-var": [2, "never"],
158-
"padded-blocks": [2, "never"],
159-
"semi": [2, "always"],
160-
"semi-spacing": [2, {
161-
"before": false,
162-
"after": true
163-
}],
164-
"space-before-blocks": 2,
165-
"space-before-function-paren": [2, "never"],
166-
"space-infix-ops": 2,
167-
"spaced-comment": [2, "always", {
168-
"exceptions": ["-", "+"],
169-
"markers": ["=", "!"]
170-
}],
171-
172-
/**
173-
* JSX style
174-
*/
175-
"jsx-quotes": [2, "prefer-double"],
176-
"react/display-name": 0,
177-
"react/jsx-boolean-value": 2,
178-
"react/jsx-no-undef": 2,
179-
"react/jsx-sort-props": 0,
180-
"react/jsx-sort-prop-types": 0,
181-
"react/jsx-uses-react": 2,
182-
"react/jsx-uses-vars": 2,
183-
"react/jsx-wrap-multilines": 2,
184-
"react/no-did-mount-set-state": 2,
185-
"react/no-did-update-set-state": 2,
186-
"react/no-multi-comp": 2,
187-
"react/no-unknown-property": 2,
188-
"react/prop-types": 2,
189-
"react/react-in-jsx-scope": 2,
190-
"react/self-closing-comp": 2,
191-
"react/sort-comp": [2, {
192-
"order": [
193-
"lifecycle",
194-
"/^on.+$/",
195-
"/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/",
196-
"everything-else",
197-
"/^render.+$/",
198-
"render"
199-
]
200-
}]
4+
"prefer-const": ["error", {"destructuring": "all"}],
5+
"import/no-extraneous-dependencies": ["error", {"devDependencies": true, "peerDependencies": true}],
6+
"react/jsx-filename-extension": ["error", {"extensions": [".js", ".jsx"]}],
7+
"react/require-default-props": "off"
2018
}
2029
}

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,16 @@
3636
"chai": "^3.5.0",
3737
"enzyme": "^2.4.1",
3838
"eslint": "^3.13.0",
39+
"eslint-config-airbnb": "^14.1.0",
40+
"eslint-plugin-import": "^2.2.0",
41+
"eslint-plugin-jsx-a11y": "^3.0.2",
3942
"eslint-plugin-react": "^6.9.0",
4043
"mocha": "^3.1.0",
4144
"react": "^15.3.2",
4245
"react-addons-test-utils": "^15.3.2",
4346
"react-dom": "^15.3.2",
4447
"react-native": ">=0.25.0",
45-
"react-native-mock": "^0.2.7",
48+
"react-native-mock": "^0.3.1",
4649
"sinon": "^1.17.6"
4750
},
4851
"peerDependencies": {

0 commit comments

Comments
 (0)