Ver Fonte

🔧 add ESLint & EditorConfig

jmacura há 4 anos atrás
pai
commit
63899e41e5
4 ficheiros alterados com 1197 adições e 0 exclusões
  1. 15 0
      .editorconfig
  2. 110 0
      .eslintrc.json
  3. 1063 0
      package-lock.json
  4. 9 0
      package.json

+ 15 - 0
.editorconfig

@@ -0,0 +1,15 @@
+
+# EditorConfig is awesome: https://EditorConfig.org
+
+# top-most EditorConfig file
+root = true
+
+# Newline ending every file and set default charset
+[*]
+insert_final_newline = true
+charset = utf-8
+
+# 2 space indentation
+[*.{js,ts,html,css}]
+indent_style = space
+indent_size = 2

+ 110 - 0
.eslintrc.json

@@ -0,0 +1,110 @@
+{
+  "env": {
+    "browser": true,
+    "es6": true
+  },
+  "globals": {},
+  "overrides": [
+    {
+      "files": [
+        "*.ts"
+      ],
+      "extends": [
+        "openlayers",
+        "plugin:@typescript-eslint/eslint-recommended",
+        "plugin:@typescript-eslint/recommended",
+        "plugin:@angular-eslint/recommended",
+        "plugin:@angular-eslint/recommended--extra"
+      ],
+      "plugins": [
+        "@typescript-eslint",
+        "@angular-eslint",
+        "eslint-plugin-tsdoc"
+      ],
+      "parser": "@typescript-eslint/parser",
+      "parserOptions": {
+        "ecmaVersion": 2018
+      },
+      "rules": {
+        "@angular-eslint/directive-selector": [
+          "error",
+          {
+            "type": "attribute",
+            "prefix": "fc",
+            "style": "camelCase"
+          }
+        ],
+        "@angular-eslint/component-selector": [
+          "error",
+          {
+            "type": "element",
+            "prefix": ["fc", "fieldcalc", ""],
+            "style": "kebab-case"
+          }
+        ],
+        "brace-style": "warn",
+        "no-console": "warn",
+        "object-curly-spacing": "warn",
+        "prefer-arrow-callback": "warn",
+        "space-before-function-paren": "off",
+        "import/extensions": [
+          "error",
+          "ignorePackages",
+          {
+            "js": "never",
+            "ts": "never"
+          }
+        ],
+        "@typescript-eslint/no-empty-function": [
+          "error",
+          {
+            "allow": [
+              "constructors"
+            ]
+          }
+        ],
+        "valid-jsdoc": "off",
+        "tsdoc/syntax": "warn"
+      },
+      "settings": {
+        "jsdoc": {
+          "tagNamePreference": {
+            "returns": "returns"
+          },
+          "require-returns-type": "off"
+        }
+      }
+    },
+    {
+      "files": [
+        "*.html"
+      ],
+      "parser": "@angular-eslint/template-parser",
+      "extends": [
+        "plugin:@angular-eslint/template/recommended"
+      ],
+      "plugins": [
+        "@angular-eslint/template"
+      ],
+      "rules": {}
+    },
+    {
+      "files": [
+        "**/*.spec.ts"
+      ],
+      "env": {
+        "jasmine": true
+      }
+    }
+  ],
+  "settings": {
+    "import/resolver": {
+      "node": {
+        "extensions": [
+          ".js",
+          ".ts"
+        ]
+      }
+    }
+  }
+}

Diff do ficheiro suprimidas por serem muito extensas
+ 1063 - 0
package-lock.json


+ 9 - 0
package.json

@@ -32,8 +32,17 @@
   "devDependencies": {
     "@angular-builders/custom-webpack": "^12.1.3",
     "@angular-devkit/build-angular": "^12.2.13",
+    "@angular-eslint/builder": "^13.0.1",
+    "@angular-eslint/eslint-plugin": "^13.0.1",
+    "@angular-eslint/eslint-plugin-template": "^13.0.1",
+    "@angular-eslint/template-parser": "^13.0.1",
     "@angular/cli": "^12.2.13",
     "@types/karma-jasmine": "^4.0.2",
+    "@typescript-eslint/eslint-plugin": "^5.7.0",
+    "eslint": "^8.4.1",
+    "eslint-config-openlayers": "^14.0.0",
+    "eslint-plugin-import": "^2.25.3",
+    "eslint-plugin-tsdoc": "^0.2.14",
     "karma-jasmine": "^4.0.1"
   }
 }

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff