]> git.openstreetmap.org Git - nominatim-ui.git/commitdiff
convert mocha and eslint configuration to json file
authorMarc Tobias <mtmail@gmx.net>
Wed, 16 Nov 2022 11:42:18 +0000 (12:42 +0100)
committermtmail <mtmail@gmx.net>
Wed, 16 Nov 2022 11:53:46 +0000 (12:53 +0100)
.eslintrc.js [deleted file]
.eslintrc.json [new file with mode: 0644]
.mocharc.js [deleted file]
.mocharc.json [new file with mode: 0644]
package.json
rollup.config.js

diff --git a/.eslintrc.js b/.eslintrc.js
deleted file mode 100644 (file)
index 95d8b34..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-module.exports = {
-  extends: [
-    'airbnb-base/legacy',
-    'plugin:mocha/recommended'
-  ],
-  parserOptions: {
-    ecmaVersion: 2019,
-    sourceType: 'module'
-  },
-  env: {
-    browser: true,
-    jquery: true
-  },
-  plugins: [
-    'svelte3',
-    'mocha'
-  ],
-  overrides: [
-    {
-      files: ['*'],
-      globals: {
-        L: true, // leaflet library
-        Nominatim_Config: true
-      },
-      rules: {
-        camelcase: 'off', // my_var is fine, no need for myVar
-        'func-names': 'off', // anonymous 'function()' is fine
-        'vars-on-top': 'off',
-        'new-cap': 'off', // constructor name can start lowercase (as Leaflet does)
-        'no-multiple-empty-lines': 'off',
-        'no-use-before-define': ['error', { functions: false }],
-        'padded-blocks': 'off',
-        'no-param-reassign': 'off',
-        'max-len': [
-          'error',
-          100,
-          2,
-          {
-            ignoreUrls: true,
-            ignoreComments: false
-          }
-        ]
-      }
-    },
-    {
-      files: ['*.svelte'],
-      processor: 'svelte3/svelte3',
-      rules: {
-        'no-label-var': 'off' // eslint thinks $: (https://svelte.dev/tutorial/reactive-statements) are labels
-      }
-    },
-    {
-      files: ['test/**'],
-      globals: {
-        browser: true
-      }
-    }
-  ]
-};
diff --git a/.eslintrc.json b/.eslintrc.json
new file mode 100644 (file)
index 0000000..908eb4d
--- /dev/null
@@ -0,0 +1,59 @@
+// https://eslint.org/docs/latest/user-guide/configuring/configuration-files
+{
+  "extends": [
+    "airbnb-base/legacy",
+    "plugin:mocha/recommended"
+  ],
+  "parserOptions": {
+    "ecmaVersion": 2019,
+    "sourceType": "module"
+  },
+  "env": {
+    "browser": true
+  },
+  "plugins": [
+    "svelte3",
+    "mocha"
+  ],
+  "overrides": [
+    {
+      "files": ["*"],
+      "globals": {
+        "L": true, // leaflet library
+        "Nominatim_Config": true
+      },
+      "rules": {
+        "camelcase": "off", // my_var is fine, no need for myVar
+        "func-names": "off", // anonymous "function()" is fine
+        "vars-on-top": "off",
+        "new-cap": "off", // constructor name can start lowercase (as Leaflet does)
+        "no-multiple-empty-lines": "off",
+        "no-use-before-define": ["error", { "functions": false }],
+        "padded-blocks": "off",
+        "no-param-reassign": "off",
+        "max-len": [
+          "error",
+          100,
+          2,
+          {
+            "ignoreUrls": true,
+            "ignoreComments": false
+          }
+        ]
+      }
+    },
+    {
+      "files": ["*.svelte"],
+      "processor": "svelte3/svelte3",
+      "rules": {
+        "no-label-var": "off" // eslint thinks $: (https://svelte.dev/tutorial/reactive-statements) are labels
+      }
+    },
+    {
+      "files": ["test/**"],
+      "globals": {
+        "browser": true
+      }
+    }
+  ]
+}
diff --git a/.mocharc.js b/.mocharc.js
deleted file mode 100644 (file)
index 4ee1dd1..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-// https://github.com/mochajs/mocha/blob/master/example/config/.mocharc.js
-
-'use strict';
-
-module.exports = {
-  ignore: ['test/_bootstrap.js'],
-  require: ['test/_bootstrap.js'],
-  timeout: '5s'
-};
diff --git a/.mocharc.json b/.mocharc.json
new file mode 100644 (file)
index 0000000..49e0f0e
--- /dev/null
@@ -0,0 +1,6 @@
+// https://github.com/mochajs/mocha/blob/master/example/config/.mocharc.json
+{
+  "ignore": ["test/_bootstrap.js"],
+  "require": ["test/_bootstrap.js"],
+  "timeout": "5s"
+}
\ No newline at end of file
index d9b4baa039224e7ae9516c7767b12049c4043d05..70fbba1360e79b8d357ae61749a53c35f4cba21c 100644 (file)
@@ -6,8 +6,8 @@
   "scripts": {
     "build": "rollup -c",
     "dev": "rollup -c -w",
-    "lint": "eslint --quiet .*.js src/ test/",
-    "lint:fix": "eslint --fix .*.js src/ test/",
+    "lint": "eslint --quiet *.js src/ test/",
+    "lint:fix": "eslint --fix *.js src/ test/",
     "test": "rollup -c && mocha --recursive test/",
     "start": "static-server dist"
   },
index db42070d2ef196cf1c6e391557d54a48a968c0e5..1a24b92e40fabad9b9d4c7c4f9345d7a46144201 100644 (file)
@@ -5,6 +5,7 @@ import livereload from 'rollup-plugin-livereload';
 import { terser } from 'rollup-plugin-terser';
 import css from 'rollup-plugin-css-only';
 import { readFileSync, writeFileSync } from 'fs';
+import { spawn } from 'child_process';
 
 const production = !process.env.ROLLUP_WATCH;
 
@@ -18,7 +19,7 @@ function serve() {
   return {
     writeBundle() {
       if (server) return;
-      server = require('child_process').spawn('yarn', ['start', '-d'], {
+      server = spawn('yarn', ['start', '-d'], {
         stdio: ['ignore', 'inherit', 'inherit'],
         shell: true
       });
@@ -45,7 +46,8 @@ export default {
       }
     }),
     css({
-      output: function (styles, styleNodes) {
+      // output: function (styles, styleNodes) {
+      output: function (styles) {
         // make sure global_styles.css gets appended to bundle.css,
         // not prepended.
         // The ':global()' rules (https://svelte.dev/docs#style) get