diff --git a/.eslintrc.js b/.eslintrc.js index 3a699223a..3283fa5a5 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -2,22 +2,30 @@ module.exports = { env: { browser: true, commonjs: true, - es2017: true, + es2020: true, node: true, }, extends: [ "eslint:recommended", "plugin:vue/vue3-recommended", ], + parser: "@babel/eslint-parser", parserOptions: { - ecmaVersion: 2018, sourceType: "module", + requireConfigFile: false, }, rules: { // override/add rules settings here, such as: // 'vue/no-unused-vars': 'error' "no-unused-vars": "warn", - indent: ["error", 4], + indent: [ + "error", + 4, + { + ignoredNodes: ["TemplateLiteral"], + SwitchCase: 1, + }, + ], quotes: ["warn", "double"], //semi: ['off', 'never'], "vue/html-indent": ["warn", 4], // default: 2 @@ -53,6 +61,9 @@ module.exports = { "space-infix-ops": "warn", "arrow-spacing": "warn", "no-trailing-spaces": "warn", + "no-constant-condition": ["error", { + "checkLoops": false, + }], "space-before-blocks": "warn", //'no-console': 'warn', "no-extra-boolean-cast": "off", diff --git a/package-lock.json b/package-lock.json index 810fe3059..c62dc8eed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -96,6 +96,25 @@ } } }, + "@babel/eslint-parser": { + "version": "7.14.7", + "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.14.7.tgz", + "integrity": "sha512-6WPwZqO5priAGIwV6msJcdc9TsEPzYeYdS/Xuoap+/ihkgN6dzHp2bcAAwyWZ5bLzk0vvjDmKvRwkqNaiJ8BiQ==", + "dev": true, + "requires": { + "eslint-scope": "^5.1.1", + "eslint-visitor-keys": "^2.1.0", + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, "@babel/generator": { "version": "7.14.8", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.14.8.tgz", diff --git a/package.json b/package.json index 4d6a0fb6e..7b80ae39b 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "vue-toastification": "^2.0.0-rc.1" }, "devDependencies": { + "@babel/eslint-parser": "^7.13.10", "@types/bootstrap": "^5.0.17", "@vitejs/plugin-legacy": "^1.5.0", "@vitejs/plugin-vue": "^1.3.0", diff --git a/server/database.js b/server/database.js index bde0c2792..571313bc4 100644 --- a/server/database.js +++ b/server/database.js @@ -1,8 +1,9 @@ const fs = require("fs"); -const {sleep} = require("../src/util"); -const {R} = require("redbean-node"); -const {setSetting, setting} = require("./util-server"); - +const { sleep } = require("../src/util"); +const { R } = require("redbean-node"); +const { + setSetting, setting, +} = require("./util-server"); class Database { @@ -95,7 +96,7 @@ class Database { const listener = (reason, p) => { Database.noReject = false; }; - process.addListener('unhandledRejection', listener); + process.addListener("unhandledRejection", listener); console.log("Closing DB") @@ -112,7 +113,7 @@ class Database { } console.log("SQLite closed") - process.removeListener('unhandledRejection', listener); + process.removeListener("unhandledRejection", listener); } }