Use eslint
These rules are very close to what we have internally. We may still miss a couple things (jsdoc params being a big one) but it's good enough. This is also more restrictive than what we enforce internally, but it's for the best.
Paul O’Shannessy committed
Dec 4, 2014 at 16:21 UTC
3f8d4eaa63bf355e8c8931ce642ea6c59732a5ed
3 files changed
+62
-1
.eslintignore
new
+7
@@ -0,0 +1,7 @@
1
+# We can probably lint these later but not important at this point
2
+src/vendor
3
+src/vendor_deprecated
4
+# estraverse stumbles on XJSSpreadAttribute so just ignore tests for now
5
+src/**/__tests__/**
6
+# This should be enabled but that folder has too much in it that doesn't belong
7
+src/test
package.json
+3
-1
@@ -38,6 +38,7 @@
38
"envify": "^3.0.0",
39
"es3ify": "~0.1.2",
40
"es5-shim": "^4.0.0",
41
+ "eslint": "0.11.0-alpha.0",
42
"grunt": "~0.4.2",
43
"grunt-cli": "~0.1.9",
44
"grunt-compare-size": "~0.4.0",
@@ -70,7 +71,8 @@
71
},
72
"scripts": {
73
"test": "jest",
73
- "jest": "jest"
74
+ "jest": "jest",
75
+ "lint": "eslint src"
76
},
77
"jest": {
78
"rootDir": "",
src/.eslintrc
new
+52
@@ -0,0 +1,52 @@
1
+---
2
+settings:
3
+ jsx: true
4
+ ecmascript: 6
5
+
6
+env:
7
+ browser: true
8
+ node: true
9
+
10
+globals:
11
+ __DEV__: true
12
+
13
+rules:
14
+ # ERRORS
15
+ brace-style: 2
16
+ space-after-keywords: 2
17
+ strict: 2
18
+ # We actually have a transform to support this and we fix this for bundled
19
+ # releases but not for the npm package, so enforce it strictly
20
+ no-comma-dangle: 2
21
+ # Make this a warning for now. We do this in a few places so we might need to
22
+ # disable
23
+ no-unused-expressions: 2
24
+ block-scoped-var: 2
25
+ eol-last: 2
26
+ dot-notation: 2
27
+ consistent-return: 2
28
+
29
+ # WARNINGS
30
+ quotes: [1, 'single']
31
+ # This is the only one that's hard to track since we don't lint just changes.
32
+ max-len: [1, 80]
33
+
34
+ # WISHLIST. One day...
35
+ # We'll need a custom version of this that does a subset of the whole rule.
36
+ # Otherwise this is just too noisy.
37
+ # valid-jsdoc: 1
38
+
39
+ # DISABLED. These aren't compatible with our style
40
+ # We use this for private/internal variables
41
+ no-underscore-dangle: 0
42
+ # We pass constructors around / access them from members
43
+ new-cap: 0
44
+ # We do this a lot.
45
+ no-use-before-define: 0
46
+ # We should have this enabled but https://github.com/eslint/eslint/issues/1542
47
+ no-unused-vars: 0
48
+ # We do this in a few places to align values
49
+ key-spacing: 0
50
+
51
+ # DISABLED. These currently cause errors when running.
52
+ no-multi-spaces: 0