Bug 1249088 - Add eslint rules for React. r=pbrosset
authorLin Clark <lclark@mozilla.com>
Thu, 25 Feb 2016 08:25:00 +0100
changeset 285647 9e162af63f4c9772c7a63cfd8e1d96000109aaad
parent 285646 b4e7063014b72c0f0106fdc430fc0e736f9ad285
child 285648 0f3938e0df6405678c951e2541019354c109732b
push id17852
push userpbrosset@mozilla.com
push dateFri, 26 Feb 2016 15:57:29 +0000
treeherderfx-team@9e162af63f4c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspbrosset
bugs1249088
milestone47.0a1
Bug 1249088 - Add eslint rules for React. r=pbrosset MozReview-Commit-ID: Ll933hB8a1n
devtools/.eslintrc
--- a/devtools/.eslintrc
+++ b/devtools/.eslintrc
@@ -1,9 +1,12 @@
 {
+  "plugins": [
+    "react"
+  ],
   "globals": {
     "Cc": true,
     "Ci": true,
     "Components": true,
     "console": true,
     "Cr": true,
     "Cu": true,
     "devtools": true,
@@ -25,16 +28,33 @@
     // Rules from the mozilla plugin
     "mozilla/mark-test-function-used": 1,
     "mozilla/no-aArgs": 1,
     "mozilla/no-cpows-in-tests": 1,
     // See bug 1224289.
     "mozilla/reject-importGlobalProperties": 1,
     "mozilla/var-only-at-top-level": 1,
 
+    // Rules from the React plugin
+    "react/display-name": 1,
+    "react/no-danger": 1,
+    "react/no-did-mount-set-state": 1,
+    "react/no-did-update-set-state": 1,
+    "react/no-direct-mutation-state": 1,
+    "react/no-unknown-property": 1,
+    "react/prefer-es6-class": 1,
+    "react/prop-types": 1,
+    "react/sort-comp": [1, {
+      order: [
+        "propTypes",
+        "everything-else",
+        "render"
+      ]
+    }],
+
     // Disallow using variables outside the blocks they are defined (especially
     // since only let and const are used, see "no-var").
     "block-scoped-var": 2,
     // Enforce one true brace style (opening brace on the same line) and avoid
     // start and end braces on the same line.
     "brace-style": [2, "1tbs", {"allowSingleLine": false}],
     // Require camel case names
     "camelcase": 2,