Jelajahi Sumber

🔧 add ESLint

+ lint files
jmacura 3 tahun lalu
induk
melakukan
34e5ef251e

+ 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"
+        ]
+      }
+    }
+  }
+}

File diff ditekan karena terlalu besar
+ 5672 - 5217
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.2.1",
+    "@angular-eslint/eslint-plugin": "^13.2.1",
+    "@angular-eslint/eslint-plugin-template": "^13.2.1",
+    "@angular-eslint/template-parser": "^13.2.1",
     "@angular/cli": "^12.2.13",
     "@types/karma-jasmine": "^4.0.2",
+    "@typescript-eslint/eslint-plugin": "^5.23.0",
+    "eslint": "^7.32.0",
+    "eslint-config-openlayers": "^16.1.0",
+    "eslint-plugin-import": "^2.26.0",
+    "eslint-plugin-tsdoc": "^0.2.16",
     "file-loader": "^6.2.0",
     "karma-jasmine": "^4.0.1"
   }

+ 4 - 7
src/app/irrigation/irrigation-info.component.ts

@@ -1,13 +1,10 @@
-import {Component, OnInit} from '@angular/core';
+import {Component} from '@angular/core';
 
 @Component({
   selector: 'irrigation-info',
   templateUrl: './irrigation-info.component.html',
   styleUrls: ['../app.component.scss'],
 })
-
-export class IrrigationInfoComponent implements OnInit {
-  constructor() { }
-
-  ngOnInit() { }
-}
+export class IrrigationInfoComponent {
+  constructor() {}
+}

+ 1 - 1
src/app/irrigation/irrigation.module.ts

@@ -8,4 +8,4 @@ import {IrrigationInfoComponent} from './irrigation-info.component';
   declarations: [IrrigationInfoComponent],
   providers: [],
 })
-export class IrrigationModule { }
+export class IrrigationModule {}

+ 3 - 3
src/app/irrigation/irrigation.service.ts

@@ -1,7 +1,7 @@
-import { Injectable } from '@angular/core';
-import { HttpClient } from '@angular/common/http';
+import {HttpClient} from '@angular/common/http';
+import {Injectable} from '@angular/core';
 
 @Injectable({providedIn: 'root'})
 export class IrrigationService {
   constructor(private httpClient: HttpClient) {}
-}
+}

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini