From 09e4145b245a431cee944ed66d28ed2490d141be Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Mon, 21 Dec 2020 15:18:15 +0100
Subject: [PATCH] notification: add eslint support

---
 packages/notification/.eslintignore       |  3 +++
 packages/notification/.eslintrc.json      | 25 +++++++++++++++++++++++
 packages/notification/package.json        |  7 +++++--
 packages/notification/src/notification.js |  5 ++---
 4 files changed, 35 insertions(+), 5 deletions(-)
 create mode 100644 packages/notification/.eslintignore
 create mode 100644 packages/notification/.eslintrc.json

diff --git a/packages/notification/.eslintignore b/packages/notification/.eslintignore
new file mode 100644
index 00000000..7b596da7
--- /dev/null
+++ b/packages/notification/.eslintignore
@@ -0,0 +1,3 @@
+/vendor/**
+/dist/**
+/*.js
\ No newline at end of file
diff --git a/packages/notification/.eslintrc.json b/packages/notification/.eslintrc.json
new file mode 100644
index 00000000..1ccd30a3
--- /dev/null
+++ b/packages/notification/.eslintrc.json
@@ -0,0 +1,25 @@
+{
+    "env": {
+        "browser": true,
+        "es6": true,
+        "mocha": true
+    },
+    "extends": ["eslint:recommended", "plugin:jsdoc/recommended"],
+    "globals": {
+        "Atomics": "readonly",
+        "SharedArrayBuffer": "readonly"
+    },
+    "parser": "babel-eslint",
+    "parserOptions": {
+        "ecmaVersion": 2018,
+        "sourceType": "module"
+    },
+    "rules": {
+        "no-unused-vars": ["error", { "args": "none" }],
+        "semi": [2, "always"],
+        "jsdoc/require-jsdoc": 0,
+        "jsdoc/require-param-description": 0,
+        "jsdoc/require-returns": 0,
+        "jsdoc/require-param-type": 0
+    }
+}
\ No newline at end of file
diff --git a/packages/notification/package.json b/packages/notification/package.json
index 77212273..9a2c562d 100644
--- a/packages/notification/package.json
+++ b/packages/notification/package.json
@@ -30,7 +30,9 @@
     "rollup-plugin-copy": "^3.1.0",
     "rollup-plugin-delete": "^2.0.0",
     "rollup-plugin-serve": "^1.0.1",
-    "rollup-plugin-terser": "^7.0.2"
+    "rollup-plugin-terser": "^7.0.2",
+    "eslint": "^7.3.1",
+    "eslint-plugin-jsdoc": "^30.6.4"
   },
   "dependencies": {
     "@dbp-toolkit/common": "^0.1.0",
@@ -49,6 +51,7 @@
     "watch": "npm run watch-local",
     "watch-local": "rollup -c --watch",
     "watch-dev": "rollup -c --watch --environment BUILD:development",
-    "test": "npm run build-test && karma start --singleRun"
+    "test": "npm run build-test && karma start --singleRun",
+    "lint": "eslint ."
   }
 }
diff --git a/packages/notification/src/notification.js b/packages/notification/src/notification.js
index c08d2163..51247ff8 100644
--- a/packages/notification/src/notification.js
+++ b/packages/notification/src/notification.js
@@ -1,8 +1,7 @@
 import {i18n} from './i18n';
-import {createUUID} from './utils'
+import {createUUID} from './utils';
 import {css, html} from 'lit-element';
 import DBPLitElement from '@dbp-toolkit/common/dbp-lit-element';
-import * as commonUtils from '@dbp-toolkit/common/utils';
 import * as commonStyles from '@dbp-toolkit/common/styles';
 
 /**
@@ -28,7 +27,7 @@ export class Notification extends DBPLitElement {
         i18n.changeLanguage(this.lang);
         const that = this;
 
-        const listener = window.addEventListener("dbp-notification-send", (e) => {
+        window.addEventListener("dbp-notification-send", (e) => {
             if (typeof e.detail === 'undefined') {
                 return;
             }
-- 
GitLab