]> git.r.bdr.sh - rbdr/forum/commitdiff
Add svelte linting
authorBen Beltran <redacted>
Tue, 18 Feb 2020 22:34:51 +0000 (23:34 +0100)
committerBen Beltran <redacted>
Tue, 18 Feb 2020 22:34:51 +0000 (23:34 +0100)
.eslintignore
.eslintrc
app/application.js
app/components/forum_list/forum_list.svelte
app/forum.svelte
app/utils/glyph_hash.js
package-lock.json
package.json

index 7e2f179b52bfdb0e9106bcb5b92a123b3a347bd7..78f02adaf638be17fc1a6e1f7cd9f8ba8d67bc03 100644 (file)
@@ -1 +1,2 @@
 assets
+dist
index bd7f88597119de48c7531b5bffe1a07f481dccf8..8902297c7e2746bddb7258e178a0c52dd874769b 100644 (file)
--- a/.eslintrc
+++ b/.eslintrc
@@ -1,7 +1,24 @@
 {
+  "parserOptions": {
+    "ecmaVersion": 2019,
+    "sourceType": "module"
+  },
+  "env": {
+    "es6": true,
+    "browser": true
+  },
   "extends": [
     "@hapi/eslint-config-hapi"
   ],
+  "plugins": [
+    "svelte3"
+  ],
+  "overrides": [
+    {
+      "files": ["**/*.svelte"],
+      "processor": "svelte3/svelte3"
+    }
+  ],
   "rules": {
     "indent": [
       2,
@@ -9,8 +26,5 @@
     ],
     "no-undef": 2,
     "require-yield": 0
-  },
-  "parserOptions": {
-    "sourceType": "module"
   }
 }
index f5012fda6ee87d224bcb6876ed860a7c3f3337dd..6f4486940ae892ec26f7736bf0bd276ff759b81e 100644 (file)
@@ -1,7 +1,5 @@
 import Forum from './forum.svelte';
 
-/* global document */
-
 const forum = new Forum({
   target: document.body,
   props: {
index e49c8d827ef0c0757c468f4d4e8e17efe4e79d4e..f77c79aac9ca9ebd3bea73f391d8420578de8aa0 100644 (file)
@@ -1,5 +1,5 @@
 <script>
-  import {forums, addForum} from '../../stores/forums.js'
+  import { forums } from '../../stores/forums.js';
 </script>
 
 <nav title="List of Forums">
index 038f17665ca8ed35876fad6063b4a5262b4384ce..bb2513dc4f1a459bdaeccf059be0c11dad95faca 100644 (file)
   const setRoute = function setRoute(targetPage) {
 
     return function (routerParams) {
+
       params = routerParams;
       page = targetPage;
-    }
-  }
+    };
+  };
 
   const router = new LightRouter({
     routes: {
-      '': () => page = Home,
+      '': () => (page = Home) && true,
       'f/{id}': setRoute(TopicIndex),
       'g/{id}': setRoute(TopicIndex),
       'a/{id}': setRoute(Author),
index 2d9b3f33df276a740e791a9f7fc18dc68b670ad5..120c02ace705490c7ceeea0a723554ae48aa2504 100644 (file)
@@ -27,7 +27,7 @@ const getGlyphHashFragment = function (uuidFragment) {
   return {
     glyph: internals.kGlyphs[glyphIndex],
     color: `#${uuidFragment.substring(2,8)}`
-  }
+  };
 };
 
 // Return an array of glyphs based on a UUIDv4
index a418fc85992e7cac9743b7cc4ec8bd7d3a4448fb..93362327f6b25dff78f85d0f92a34082bc532006 100644 (file)
         "v8-compile-cache": "^2.0.3"
       }
     },
+    "eslint-plugin-svelte3": {
+      "version": "2.7.3",
+      "resolved": "https://registry.npmjs.org/eslint-plugin-svelte3/-/eslint-plugin-svelte3-2.7.3.tgz",
+      "integrity": "sha512-p6HhxyICX9x/x+8WSy6AVk2bmv9ayoznoTSyCvK47th/k/07ksuJixMwbGX9qxJVAmPBaYMjEIMSEZtJHPIN7w==",
+      "dev": true
+    },
     "eslint-scope": {
       "version": "5.0.0",
       "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz",
index 704c540ed2090a35c8860ac9857f4a67c9072b17..8c047ebb1cb4237fcba97aeda5e38a24c38e5c3a 100644 (file)
@@ -17,7 +17,7 @@
   "scripts": {
     "build": "parcel build --no-source-maps ./app/index.html",
     "document": "jsdoc2md > doc/README.md",
-    "lint": "eslint lib app bin/forum",
+    "lint": "eslint --ext .svelte --ext .js .",
     "linthtml": "htmlhint",
     "setup-hooks": "ln -s ../../scripts/git-hooks/pre-commit .git/hooks/pre-commit",
     "test": "lab -r lab-markdown-reporter -o doc/COVERAGE.md -r console -o stdout -c --coverage-path lib -L -t 100 test",
@@ -39,6 +39,7 @@
     "@hapi/eslint-plugin-hapi": "^4.3.4",
     "@hapi/lab": "^21.0.0",
     "eslint": "^6.7.2",
+    "eslint-plugin-svelte3": "^2.7.3",
     "htmlhint": "^0.11.0",
     "jsdoc-to-markdown": "^5.0.3",
     "lab-markdown-reporter": "^1.0.2",