Untangle ChargingStation class from OCPP services classes
[e-mobility-charging-stations-simulator.git] / .eslintrc
index 6d8714d77aad69508da20e66ad34406a37a87f57..4773a806ae1c15dbd0c4eaac2400a4b71d6b2bc5 100644 (file)
--- a/.eslintrc
+++ b/.eslintrc
@@ -1,66 +1,34 @@
 {
   "root": true,
-  "parser": "@typescript-eslint/parser",
+  "env": {
+    "es2020": true,
+    "node": true,
+    "mocha": true
+  },
   "parserOptions": {
-    "project": "./tsconfig.json"
+    "ecmaVersion": 2020,
+    "sourceType": "module"
   },
   "extends": [
     "eslint:recommended",
-    "plugin:@typescript-eslint/recommended",
-    "plugin:@typescript-eslint/recommended-requiring-type-checking",
     "plugin:import/errors",
     "plugin:import/warnings",
-    "plugin:import/typescript",
     "plugin:jsdoc/recommended",
-    "prettier"
+    "plugin:prettier/recommended"
   ],
-  "plugins": ["import", "jsdoc", "@typescript-eslint"],
+  "plugins": ["import", "jsdoc"],
   "settings": {
     "jsdoc": {
       "mode": "typescript"
     }
   },
   "rules": {
-    "indent": "off",
-    "@typescript-eslint/indent": [
-      "error",
-      2,
-      {
-        "SwitchCase": 1,
-        "CallExpression": {
-          "arguments": 1
-        },
-        "FunctionDeclaration": {
-          "parameters": 2,
-          "body": 1
-        },
-        "FunctionExpression": {
-          "parameters": 2,
-          "body": 1
-        }
-      }
-    ],
-    "@typescript-eslint/array-type": "off",
-    "semi": "off",
-    "@typescript-eslint/semi": ["error", "always"],
     "space-before-blocks": ["error", "always"],
-    "@typescript-eslint/no-empty-function": [
-      "warn",
-      {
-        "allow": ["arrowFunctions", "methods"]
-      }
-    ],
-    "@typescript-eslint/member-ordering": "error",
-    "@typescript-eslint/await-thenable": "error",
-    "@typescript-eslint/no-floating-promises": "error",
-    "@typescript-eslint/promise-function-async": "error",
-    "@typescript-eslint/no-misused-promises": "error",
-    "curly": "error",
+    "curly": ["error", "all"],
     "brace-style": "error",
     "eqeqeq": ["error", "always"],
     "no-else-return": "error",
     "no-eq-null": "error",
-    "no-undefined": "error",
     "no-extra-bind": "error",
     "no-lone-blocks": "error",
     "no-multi-spaces": "error",
@@ -68,8 +36,6 @@
     "no-return-assign": ["error", "always"],
     "no-useless-catch": "error",
     "no-useless-return": "error",
-    "no-shadow": "off", // This one is generating false positive no-shadow errors on exported/const enums
-    "@typescript-eslint/no-shadow": "error",
     "no-multiple-empty-lines": [
       "error",
       {
     "max-len": [
       "warn",
       {
-        "code": 180,
-        "ignoreComments": true,
-        "ignoreUrls": true,
-        "ignoreStrings": true,
-        "ignoreTemplateLiterals": true,
-        "ignoreRegExpLiterals": true,
-        "ignorePattern": "(^(import|export)|(public|private))\\s.+;"
+        "code": 100,
+        "ignoreUrls": true
       }
     ],
     "no-lonely-if": "error",
     "no-trailing-spaces": "error",
     "no-whitespace-before-property": "error",
-    "space-before-function-paren": [
-      "error",
-      {
-        "anonymous": "never",
-        "named": "never",
-        "asyncArrow": "always"
-      }
-    ],
     "space-in-parens": ["error", "never"],
     "space-infix-ops": "error",
     "space-unary-ops": "error",
         "exceptAfterSingleLine": true
       }
     ],
-    "quotes": ["error", "single"]
+    "quotes": [
+      "error",
+      "single",
+      {
+        "avoidEscape": true,
+        "allowTemplateLiterals": false
+      }
+    ]
   },
   "overrides": [
     {
-      "files": ["*.js"],
+      "files": ["**/*.ts"],
+      "parser": "@typescript-eslint/parser",
+      "parserOptions": {
+        "ecmaVersion": 2020,
+        "sourceType": "module",
+        "project": "./tsconfig.json"
+      },
+      "extends": [
+        "plugin:@typescript-eslint/recommended",
+        "plugin:@typescript-eslint/recommended-requiring-type-checking",
+        "plugin:import/typescript"
+      ],
+      "plugins": ["@typescript-eslint"],
+      "rules": {
+        "@typescript-eslint/array-type": "off",
+        "semi": "off",
+        "@typescript-eslint/semi": ["error", "always"],
+        "@typescript-eslint/no-empty-function": "warn",
+        "@typescript-eslint/member-ordering": "error",
+        "@typescript-eslint/await-thenable": "error",
+        "@typescript-eslint/no-floating-promises": "error",
+        "@typescript-eslint/promise-function-async": "error",
+        "@typescript-eslint/no-misused-promises": "error",
+        "no-shadow": "off", // This one is generating false positive no-shadow errors on exported/const enums
+        "@typescript-eslint/no-shadow": "error"
+      }
+    },
+    {
+      "files": ["**/*.js"],
       "extends": "plugin:node/recommended",
       "rules": {
-        "node/shebang": "off",
-        "@typescript-eslint/no-unused-vars": "off",
-        "@typescript-eslint/no-var-requires": "off"
+        "node/shebang": "off"
       }
     }
   ]