]> git.proxmox.com Git - mirror_novnc.git/blobdiff - .eslintrc
noVNC 1.2.0
[mirror_novnc.git] / .eslintrc
index aef4c0d0e4ff09d437ea4931dda3fac934ec8c0b..a53bb402b0aac4b583959af74951fe83c0e93648 100644 (file)
--- a/.eslintrc
+++ b/.eslintrc
@@ -1,15 +1,50 @@
 {
-  "env": {
-    "browser": true,
-    "es6": true
-  },
-  "parserOptions": {
-    "sourceType": "module"
-  },
-  "extends": "eslint:recommended",
-  "rules": {
-      "no-unused-vars": ["error", { "vars": "all", "args": "none", "ignoreRestSiblings": true }],
-      "no-constant-condition": ["error", { "checkLoops": false }],
-      "no-var": "error"
-  }
+    "env": {
+        "browser": true,
+        "es6": true
+    },
+    "parserOptions": {
+        "sourceType": "module"
+    },
+    "extends": "eslint:recommended",
+    "rules": {
+        // Unsafe or confusing stuff that we forbid
+
+        "no-unused-vars": ["error", { "vars": "all", "args": "none", "ignoreRestSiblings": true }],
+        "no-constant-condition": ["error", { "checkLoops": false }],
+        "no-var": "error",
+        "no-useless-constructor": "error",
+        "object-shorthand": ["error", "methods", { "avoidQuotes": true }],
+        "prefer-arrow-callback": "error",
+        "arrow-body-style": ["error", "as-needed", { "requireReturnForObjectLiteral": false } ],
+        "arrow-parens": ["error", "as-needed", { "requireForBlockBody": true }],
+        "arrow-spacing": ["error"],
+        "no-confusing-arrow": ["error", { "allowParens": true }],
+
+        // Enforced coding style
+
+        "brace-style": ["error", "1tbs", { "allowSingleLine": true }],
+        "indent": ["error", 4, { "SwitchCase": 1,
+                                 "FunctionDeclaration": { "parameters": "first" },
+                                 "CallExpression": { "arguments": "first" },
+                                 "ArrayExpression": "first",
+                                 "ObjectExpression": "first",
+                                 "ignoreComments": true }],
+        "comma-spacing": ["error"],
+        "comma-style": ["error"],
+        "curly": ["error", "multi-line"],
+        "func-call-spacing": ["error"],
+        "func-names": ["error"],
+        "func-style": ["error", "declaration", { "allowArrowFunctions": true }],
+        "key-spacing": ["error"],
+        "keyword-spacing": ["error"],
+        "no-trailing-spaces": ["error"],
+        "semi": ["error"],
+        "space-before-blocks": ["error"],
+        "space-before-function-paren": ["error", { "anonymous": "always",
+                                                   "named": "never",
+                                                   "asyncArrow": "always" }],
+        "switch-colon-spacing": ["error"],
+        "camelcase": ["error", { allow: ["^XK_", "^XF86XK_"] }],
+    }
 }