From d1075b7512f5004614ac98c174f2ba699cb510b9 Mon Sep 17 00:00:00 2001 From: Marc Tobias Date: Wed, 16 Nov 2022 12:42:18 +0100 Subject: [PATCH] convert mocha and eslint configuration to json file --- .eslintrc.js | 59 ------------------------------------------------ .eslintrc.json | 59 ++++++++++++++++++++++++++++++++++++++++++++++++ .mocharc.js | 9 -------- .mocharc.json | 6 +++++ package.json | 4 ++-- rollup.config.js | 6 +++-- 6 files changed, 71 insertions(+), 72 deletions(-) delete mode 100644 .eslintrc.js create mode 100644 .eslintrc.json delete mode 100644 .mocharc.js create mode 100644 .mocharc.json diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 95d8b34..0000000 --- a/.eslintrc.js +++ /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 index 0000000..908eb4d --- /dev/null +++ b/.eslintrc.json @@ -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 index 4ee1dd1..0000000 --- a/.mocharc.js +++ /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 index 0000000..49e0f0e --- /dev/null +++ b/.mocharc.json @@ -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 diff --git a/package.json b/package.json index d9b4baa..70fbba1 100644 --- a/package.json +++ b/package.json @@ -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" }, diff --git a/rollup.config.js b/rollup.config.js index db42070..1a24b92 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -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 -- 2.39.5