diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 000000000..dbe2a89be --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,56 @@ +{ + "env": { + "browser": true, + "es2021": true, + "node": true + }, + "globals": { + "firebase": "readonly", + "$": "readonly", + "moment": "readonly", + "jQuery": "readonly", + "html2canvas": "readonly", + "ClipboardItem": "readonly", + "grecaptcha": "readonly" + }, + "extends": [ + "eslint:recommended", + "plugin:json/recommended", + "plugin:require-path-exists/recommended" + ], + "plugins": ["json", "require-path-exists"], + "parserOptions": { + "ecmaVersion": 12, + "sourceType": "module" + }, + "rules": { + "json/*": ["error"], + "indent": ["error", 2], + "linebreak-style": ["error", "unix"], + "quotes": [ + "error", + "double", + { "allowTemplateLiterals": true, "avoidEscape": true } + ], + "semi": ["error", "always"], + "no-unused-vars": ["error", { "argsIgnorePattern": "^(_|e|event)" }], + "require-path-exists/notEmpty": 2, + "require-path-exists/tooManyArguments": 2, + "require-path-exists/exists": [ + 2, + { + "extensions": [ + "", + ".js", + ".jsx", + ".es.js", + ".jsx", + ".json5", + ".es", + ".es6", + ".coffee" + ] + } + ] + } +} diff --git a/backend/.eslintrc.json b/backend/.eslintrc.json deleted file mode 100644 index 0a50e7673..000000000 --- a/backend/.eslintrc.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "env": { - "browser": true, - "es2021": true, - "node": true - }, - "extends": "eslint:recommended", - "parserOptions": { - "ecmaVersion": 12, - "sourceType": "module" - }, - "rules": { - "indent": ["error", 2], - "linebreak-style": ["error", "unix"], - "quotes": ["error", "double"], - "semi": ["error", "always"], - "no-unused-vars": ["error", { "argsIgnorePattern": "^_" }] - } -} diff --git a/gulpfile.js b/gulpfile.js index efdb77742..942ea3e13 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,5 +1,5 @@ const { task, src, dest, series, watch } = require("gulp"); -const axios = require("axios"); +// const axios = require("axios"); const browserify = require("browserify"); const babelify = require("babelify"); const concat = require("gulp-concat"); @@ -7,89 +7,104 @@ const del = require("del"); const source = require("vinyl-source-stream"); const buffer = require("vinyl-buffer"); const vinylPaths = require("vinyl-paths"); -const eslint = require("gulp-eslint"); +const eslint = require("gulp-eslint-new"); var sass = require("gulp-sass")(require("dart-sass")); const replace = require("gulp-replace"); const uglify = require("gulp-uglify"); const through2 = require("through2"); // sass.compiler = require("dart-sass"); -let eslintConfig = { - parser: "babel-eslint", - globals: [ - "jQuery", - "$", - "firebase", - "moment", - "html2canvas", - "ClipboardItem", - "grecaptcha", - ], - envs: ["es6", "browser", "node"], - plugins: ["json"], - extends: ["plugin:json/recommended"], - rules: { - "json/*": ["error"], - "constructor-super": "error", - "for-direction": "error", - "getter-return": "error", - "no-async-promise-executor": "error", - "no-case-declarations": "error", - "no-class-assign": "error", - "no-compare-neg-zero": "error", - "no-cond-assign": "error", - "no-const-assign": "error", - "no-constant-condition": "error", - "no-control-regex": "error", - "no-debugger": "error", - "no-delete-var": "error", - "no-dupe-args": "error", - "no-dupe-class-members": "error", - "no-dupe-else-if": "warn", - "no-dupe-keys": "error", - "no-duplicate-case": "error", - "no-empty": ["warn", { allowEmptyCatch: true }], - "no-empty-character-class": "error", - "no-empty-pattern": "error", - "no-ex-assign": "error", - "no-extra-boolean-cast": "error", - "no-extra-semi": "error", - "no-fallthrough": "error", - "no-func-assign": "error", - "no-global-assign": "error", - "no-import-assign": "error", - "no-inner-declarations": "error", - "no-invalid-regexp": "error", - "no-irregular-whitespace": "warn", - "no-misleading-character-class": "error", - "no-mixed-spaces-and-tabs": "error", - "no-new-symbol": "error", - "no-obj-calls": "error", - "no-octal": "error", - "no-prototype-builtins": "error", - "no-redeclare": "error", - "no-regex-spaces": "error", - "no-self-assign": "error", - "no-setter-return": "error", - "no-shadow-restricted-names": "error", - "no-sparse-arrays": "error", - "no-this-before-super": "error", - "no-undef": "error", - "no-unexpected-multiline": "warn", - "no-unreachable": "error", - "no-unsafe-finally": "error", - "no-unsafe-negation": "error", - "no-unused-labels": "error", - "no-unused-vars": ["warn", { argsIgnorePattern: "e|event" }], - "no-use-before-define": "warn", - "no-useless-catch": "error", - "no-useless-escape": "error", - "no-with": "error", - "require-yield": "error", - "use-isnan": "error", - "valid-typeof": "error", - }, -}; +let eslintConfig = ".eslintrc.json"; +// let eslintConfig = { +// parser: "babel-eslint", +// globals: [ +// "jQuery", +// "$", +// "firebase", +// "moment", +// "html2canvas", +// "ClipboardItem", +// "grecaptcha", +// ], +// envs: ["es6", "browser", "node"], +// plugins: ["json","require-path-exists"], +// extends: ["plugin:json/recommended","plugin:require-path-exists/recommended"], +// rules: { +// "require-path-exists/notEmpty": 2, +// "require-path-exists/tooManyArguments": 2, +// "require-path-exists/exists": [ 2, { +// "extensions": [ +// "", +// ".jsx", +// ".es.js", +// ".jsx", +// ".json5", +// ".es", +// ".es6", +// ".coffee" +// ] +// }], +// "json/*": ["error"], +// "constructor-super": "error", +// "for-direction": "error", +// "getter-return": "error", +// "no-async-promise-executor": "error", +// "no-case-declarations": "error", +// "no-class-assign": "error", +// "no-compare-neg-zero": "error", +// "no-cond-assign": "error", +// "no-const-assign": "error", +// "no-constant-condition": "error", +// "no-control-regex": "error", +// "no-debugger": "error", +// "no-delete-var": "error", +// "no-dupe-args": "error", +// "no-dupe-class-members": "error", +// "no-dupe-else-if": "warn", +// "no-dupe-keys": "error", +// "no-duplicate-case": "error", +// "no-empty": ["warn", { allowEmptyCatch: true }], +// "no-empty-character-class": "error", +// "no-empty-pattern": "error", +// "no-ex-assign": "error", +// "no-extra-boolean-cast": "error", +// "no-extra-semi": "error", +// "no-fallthrough": "error", +// "no-func-assign": "error", +// "no-global-assign": "error", +// "no-import-assign": "error", +// "no-inner-declarations": "error", +// "no-invalid-regexp": "error", +// "no-irregular-whitespace": "warn", +// "no-misleading-character-class": "error", +// "no-mixed-spaces-and-tabs": "error", +// "no-new-symbol": "error", +// "no-obj-calls": "error", +// "no-octal": "error", +// "no-prototype-builtins": "error", +// "no-redeclare": "error", +// "no-regex-spaces": "error", +// "no-self-assign": "error", +// "no-setter-return": "error", +// "no-shadow-restricted-names": "error", +// "no-sparse-arrays": "error", +// "no-this-before-super": "error", +// "no-undef": "error", +// "no-unexpected-multiline": "warn", +// "no-unreachable": "error", +// "no-unsafe-finally": "error", +// "no-unsafe-negation": "error", +// "no-unused-labels": "error", +// "no-unused-vars": ["warn", { argsIgnorePattern: "e|event" }], +// "no-use-before-define": "warn", +// "no-useless-catch": "error", +// "no-useless-escape": "error", +// "no-with": "error", +// "require-yield": "error", +// "use-isnan": "error", +// "valid-typeof": "error", +// }, +// }; //refactored files, which should be es6 modules //once all files are moved here, then can we use a bundler to its full potential @@ -223,7 +238,9 @@ task("static", function () { //copies refactored js files to dist/gen so that they can be required by dist/gen/index.js task("copy-modules", function () { - return src(refactoredSrc, { allowEmpty: true }).pipe(dest("./dist/gen")); + return src(refactoredSrc, { allowEmpty: true, base: "./src/js" }).pipe( + dest("./dist/gen") + ); }); //bundles the refactored js files together with index.js (the concatenated legacy js files) diff --git a/package-lock.json b/package-lock.json index 5830ab678..a082f1eac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2072,6 +2072,22 @@ "@types/node": "*" } }, + "@types/eslint": { + "version": "8.4.1", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.4.1.tgz", + "integrity": "sha512-GE44+DNEyxxh2Kc6ro/VkIj+9ma0pO0bwv9+uHSyBrikYOHr8zYcdPvnBOp1aw8s+CjRvuSx7CyWqRrNFQ59mA==", + "dev": true, + "requires": { + "@types/estree": "*", + "@types/json-schema": "*" + } + }, + "@types/estree": { + "version": "0.0.51", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.51.tgz", + "integrity": "sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ==", + "dev": true + }, "@types/expect": { "version": "1.20.4", "resolved": "https://registry.npmjs.org/@types/expect/-/expect-1.20.4.tgz", @@ -2115,6 +2131,12 @@ "@types/express": "*" } }, + "@types/json-schema": { + "version": "7.0.9", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz", + "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==", + "dev": true + }, "@types/json5": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", @@ -2576,6 +2598,12 @@ "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", "dev": true }, + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "dev": true + }, "async-done": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/async-done/-/async-done-1.3.2.tgz", @@ -3176,6 +3204,12 @@ "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", "dev": true }, + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + }, "builtin-status-codes": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", @@ -4214,7 +4248,6 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-4.1.2.tgz", "integrity": "sha512-fz3OjcNCHmRP12MJoZMPglx8m4rrFP8rovnk4vT8Fs+aonZoCwGg10dSsQsfP/E62eZcPTMSMP6686fu9Qlqtw==", - "optional": true, "requires": { "end-of-stream": "^1.4.1", "inherits": "^2.0.3", @@ -4226,7 +4259,6 @@ "version": "3.6.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "optional": true, "requires": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -4891,6 +4923,17 @@ "integrity": "sha512-NGmI6BH5L12pl7ScQHbg7tvtk4wPxxj8yPHH47NvSmMtFneC077PSeY3huFj06ZWZvtbfxSPt3RuOQD5XcR4ng==", "dev": true }, + "eslint-plugin-require-path-exists": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/eslint-plugin-require-path-exists/-/eslint-plugin-require-path-exists-1.1.9.tgz", + "integrity": "sha512-moZRfrPr4GFyT/W8PHzjzC7D4Hnj7Us+GYj0fbVKQoPvP4xIF8VG702L1jzyhqE8eIYkcs8p1CoqSfjk9WkxBg==", + "dev": true, + "requires": { + "builtin-modules": "^1.1.1", + "fs-plus": "^3.0.0", + "resolve": "^1.1.7" + } + }, "eslint-rule-docs": { "version": "1.1.231", "resolved": "https://registry.npmjs.org/eslint-rule-docs/-/eslint-rule-docs-1.1.231.tgz", @@ -5655,6 +5698,12 @@ "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", "dev": true }, + "fork-stream": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/fork-stream/-/fork-stream-0.0.4.tgz", + "integrity": "sha1-24Sfznf2cIpfjzhq5TOgkHtUrnA=", + "dev": true + }, "forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -5696,6 +5745,29 @@ } } }, + "fs-plus": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/fs-plus/-/fs-plus-3.1.1.tgz", + "integrity": "sha512-Se2PJdOWXqos1qVTkvqqjb0CSnfBnwwD+pq+z4ksT+e97mEShod/hrNg0TRCCsXPbJzcIq+NuzQhigunMWMJUA==", + "dev": true, + "requires": { + "async": "^1.5.2", + "mkdirp": "^0.5.1", + "rimraf": "^2.5.2", + "underscore-plus": "1.x" + }, + "dependencies": { + "rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + } + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -6880,6 +6952,293 @@ } } }, + "gulp-eslint-new": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/gulp-eslint-new/-/gulp-eslint-new-1.3.0.tgz", + "integrity": "sha512-xIM5AuUgd5XahjwZMKMPbABx6Kxs7GHEftc886RNdVjAfZ6steurmg1zW8K81xNspPMHrQBrLKbqeR5xQLnLYw==", + "dev": true, + "requires": { + "@types/eslint": "^8.4.1", + "@types/node": "^17.0.15", + "eslint": "^8.8.0", + "fancy-log": "^2.0.0", + "plugin-error": "^1.0.1", + "ternary-stream": "^3.0.0", + "vinyl-fs": "^3.0.3" + }, + "dependencies": { + "@eslint/eslintrc": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.0.5.tgz", + "integrity": "sha512-BLxsnmK3KyPunz5wmCCpqy0YelEoxxGmH73Is+Z74oOTMtExcjkr3dDR6quwrjh1YspA8DH9gnX1o069KiS9AQ==", + "dev": true, + "requires": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.2.0", + "globals": "^13.9.0", + "ignore": "^4.0.6", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" + }, + "dependencies": { + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + } + } + }, + "@humanwhocodes/config-array": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.3.tgz", + "integrity": "sha512-3xSMlXHh03hCcCmFc0rbKp3Ivt2PFEJnQUJDDMTJQ2wkECZWdq4GePs2ctc5H8zV+cHPaq8k2vU8mrQjA6iHdQ==", + "dev": true, + "requires": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.4" + } + }, + "@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true + }, + "@types/node": { + "version": "17.0.15", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.15.tgz", + "integrity": "sha512-zWt4SDDv1S9WRBNxLFxFRHxdD9tvH8f5/kg5/IaLFdnSNXsDY4eL3Q3XXN+VxUnWIhyVFDwcsmAprvwXoM/ClA==", + "dev": true + }, + "acorn": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", + "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", + "dev": true + }, + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, + "eslint": { + "version": "8.8.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.8.0.tgz", + "integrity": "sha512-H3KXAzQGBH1plhYS3okDix2ZthuYJlQQEGE5k0IKuEqUSiyu4AmxxlJ2MtTYeJ3xB4jDhcYCwGOg2TXYdnDXlQ==", + "dev": true, + "requires": { + "@eslint/eslintrc": "^1.0.5", + "@humanwhocodes/config-array": "^0.9.2", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.1.0", + "eslint-utils": "^3.0.0", + "eslint-visitor-keys": "^3.2.0", + "espree": "^9.3.0", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^6.0.1", + "globals": "^13.6.0", + "ignore": "^5.2.0", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "regexpp": "^3.2.0", + "strip-ansi": "^6.0.1", + "strip-json-comments": "^3.1.0", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + } + }, + "eslint-scope": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.0.tgz", + "integrity": "sha512-aWwkhnS0qAXqNOgKOK0dJ2nvzEbhEvpy8OlJ9kZ0FeZnA6zpjv1/Vei+puGFFX7zkPCkHHXb7IDX3A+7yPrRWg==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + } + }, + "eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^2.0.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true + } + } + }, + "eslint-visitor-keys": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.2.0.tgz", + "integrity": "sha512-IOzT0X126zn7ALX0dwFiUQEdsfzrm4+ISsQS8nukaJXwEyYKRSnEIIDULYg1mCtGp7UUXgfGl7BIolXREQK+XQ==", + "dev": true + }, + "espree": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.0.tgz", + "integrity": "sha512-d/5nCsb0JcqsSEeQzFZ8DH1RmxPcglRWh24EFTlUEmCKoehXGdpsx0RkHDubqUI8LSAIKMQp4r9SzQ3n+sm4HQ==", + "dev": true, + "requires": { + "acorn": "^8.7.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^3.1.0" + } + }, + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + }, + "fancy-log": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fancy-log/-/fancy-log-2.0.0.tgz", + "integrity": "sha512-9CzxZbACXMUXW13tS0tI8XsGGmxWzO2DmYrGuBJOJ8k8q2K7hwfJA5qHjuPPe8wtsco33YR9wc+Rlr5wYFvhSA==", + "dev": true, + "requires": { + "color-support": "^1.1.3" + } + }, + "glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "requires": { + "is-glob": "^4.0.3" + }, + "dependencies": { + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + } + } + }, + "globals": { + "version": "13.12.1", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.12.1.tgz", + "integrity": "sha512-317dFlgY2pdJZ9rspXDks7073GpDmXdfbM3vYYp0HAMKGDh1FfWPleI2ljVNLQX5M5lXcAslTcPTrOrMEFOjyw==", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "ignore": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "dev": true + }, + "js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "requires": { + "argparse": "^2.0.1" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true + } + } + }, "gulp-replace": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/gulp-replace/-/gulp-replace-1.1.3.tgz", @@ -11329,6 +11688,30 @@ "resolved": "https://registry.npmjs.org/term-size/-/term-size-2.2.1.tgz", "integrity": "sha512-wK0Ri4fOGjv/XPy8SBHZChl8CM7uMc5VML7SqiQ0zG7+J5Vr+RMQDoHa2CNT6KHUnTGIXH34UDMkPzAUyapBZg==" }, + "ternary-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ternary-stream/-/ternary-stream-3.0.0.tgz", + "integrity": "sha512-oIzdi+UL/JdktkT+7KU5tSIQjj8pbShj3OASuvDEhm0NT5lppsm7aXWAmAq4/QMaBIyfuEcNLbAQA+HpaISobQ==", + "dev": true, + "requires": { + "duplexify": "^4.1.1", + "fork-stream": "^0.0.4", + "merge-stream": "^2.0.0", + "through2": "^3.0.1" + }, + "dependencies": { + "through2": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.2.tgz", + "integrity": "sha512-enaDQ4MUyP2W6ZyT6EsMzqBPZaM/avg8iuo+l2d3QCs0J+6RaqkHV/2/lOwDTueBHeJ/2LG9lrLW3d5rWPucuQ==", + "dev": true, + "requires": { + "inherits": "^2.0.4", + "readable-stream": "2 || 3" + } + } + } + }, "text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -11679,6 +12062,21 @@ } } }, + "underscore": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.2.tgz", + "integrity": "sha512-ekY1NhRzq0B08g4bGuX4wd2jZx5GnKz6mKSqFL4nqBlfyMGiG10gDFhDTMEfYmDL6Jy0FUIZp7wiRB+0BP7J2g==", + "dev": true + }, + "underscore-plus": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/underscore-plus/-/underscore-plus-1.7.0.tgz", + "integrity": "sha512-A3BEzkeicFLnr+U/Q3EyWwJAQPbA19mtZZ4h+lLq3ttm9kn8WC4R3YpuJZEXmWdLjYP47Zc8aLZm9kwdv+zzvA==", + "dev": true, + "requires": { + "underscore": "^1.9.1" + } + }, "undertaker": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/undertaker/-/undertaker-1.3.0.tgz", diff --git a/package.json b/package.json index 1992fb5b7..6c38fec96 100644 --- a/package.json +++ b/package.json @@ -31,9 +31,11 @@ "eslint-plugin-json": "^2.1.2", "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^5.1.0", + "eslint-plugin-require-path-exists": "^1.1.9", "gulp": "^4.0.2", "gulp-concat": "^2.6.1", "gulp-eslint": "^6.0.0", + "gulp-eslint-new": "^1.3.0", "gulp-sass": "^5.0.0", "gulp-uglify": "^3.0.2", "husky": "^4.3.0", diff --git a/src/js/account-controller.js b/src/js/account-controller.js index 0b7bad15c..2c766e514 100644 --- a/src/js/account-controller.js +++ b/src/js/account-controller.js @@ -1,20 +1,20 @@ -import * as Notifications from "./notifications"; +import * as Notifications from "./elements/notifications"; import Config, * as UpdateConfig from "./config"; -import * as AccountButton from "./account-button"; +import * as AccountButton from "./elements/account-button"; import * as Account from "./account"; import * as AccountController from "./account-controller"; import * as CommandlineLists from "./commandline-lists"; -import * as VerificationController from "./verification-controller"; +import * as VerificationController from "./account/verification-controller"; import * as Misc from "./misc"; import * as Settings from "./settings"; -import * as AllTimeStats from "./all-time-stats"; +import * as AllTimeStats from "./account/all-time-stats"; import * as DB from "./db"; -import * as TestLogic from "./test-logic"; +import * as TestLogic from "./test/test-logic"; import * as UI from "./ui"; import axiosInstance from "./axios-instance"; -import * as PSA from "./psa"; -import * as Focus from "./focus"; -import * as Loader from "./loader"; +import * as PSA from "./elements/psa"; +import * as Focus from "./test/focus"; +import * as Loader from "./elements/loader"; export const gmailProvider = new firebase.auth.GoogleAuthProvider(); // const githubProvider = new firebase.auth.GithubAuthProvider(); @@ -307,7 +307,7 @@ export function addGoogleAuth() { firebase .auth() .currentUser.linkWithPopup(gmailProvider) - .then(function (result) { + .then(function () { Loader.hide(); Notifications.add("Google authentication added", 1); Settings.updateAuthSections(); @@ -336,7 +336,7 @@ export async function removeGoogleAuth() { firebase .auth() .currentUser.unlink("google.com") - .then((result) => { + .then(() => { Notifications.add("Google authentication removed", 1); Loader.hide(); Settings.updateAuthSections(); @@ -375,7 +375,7 @@ export async function addPasswordAuth(email, password) { firebase .auth() .currentUser.linkWithCredential(credential) - .then(function (result) { + .then(function () { Loader.hide(); Notifications.add("Password authenication added", 1); Settings.updateAuthSections(); diff --git a/src/js/account.js b/src/js/account.js index b7e1e7baf..757a65beb 100644 --- a/src/js/account.js +++ b/src/js/account.js @@ -1,26 +1,25 @@ import * as DB from "./db"; import * as Misc from "./misc"; -import * as Notifications from "./notifications"; -import * as ResultFilters from "./result-filters"; +import * as Notifications from "./elements/notifications"; +import * as ResultFilters from "./account/result-filters"; import * as ThemeColors from "./theme-colors"; import * as ChartController from "./chart-controller"; import Config, * as UpdateConfig from "./config"; -import * as AccountButton from "./account-button"; -import * as TestLogic from "./test-logic"; -import * as PaceCaret from "./pace-caret"; +import * as AccountButton from "./elements/account-button"; +import * as TestLogic from "./test/test-logic"; +import * as PaceCaret from "./test/pace-caret"; import * as TagController from "./tag-controller"; import * as UI from "./ui"; import * as CommandlineLists from "./commandline-lists"; import * as MiniResultChart from "./mini-result-chart"; -import * as ResultTagsPopup from "./result-tags-popup"; +import * as ResultTagsPopup from "./popups/result-tags-popup"; import * as Settings from "./settings"; -import * as ThemePicker from "./theme-picker"; -import * as AllTimeStats from "./all-time-stats"; -import * as PbTables from "./pb-tables"; +import * as AllTimeStats from "./account/all-time-stats"; +import * as PbTables from "./account/pb-tables"; import * as AccountController from "./account-controller"; -import * as LoadingPage from "./loading-page"; -import * as Focus from "./focus"; -import * as SignOutButton from "./sign-out-button"; +import * as LoadingPage from "./elements/loading-page"; +import * as Focus from "./test/focus"; +import * as SignOutButton from "./elements/sign-out-button"; import axiosInstance from "./axios-instance"; let filterDebug = false; diff --git a/src/js/db.js b/src/js/db.js index dfde91510..4b6c9a0d5 100644 --- a/src/js/db.js +++ b/src/js/db.js @@ -1,9 +1,9 @@ -import { loadTags } from "./result-filters"; -import * as AccountButton from "./account-button"; -import * as Notifications from "./notifications"; +import { loadTags } from "./account/result-filters"; +import * as AccountButton from "./elements/account-button"; +import * as Notifications from "./elements/notifications"; import axiosInstance from "./axios-instance"; -import * as TodayTracker from "./today-tracker"; -import * as LoadingPage from "./loading-page"; +import * as TodayTracker from "./test/today-tracker"; +import * as LoadingPage from "./elements/loading-page"; import * as UI from "./ui"; let dbSnapshot = null; diff --git a/src/js/global-dependencies.js b/src/js/global-dependencies.js index f4e2c0479..da3cc25a8 100644 --- a/src/js/global-dependencies.js +++ b/src/js/global-dependencies.js @@ -9,22 +9,22 @@ Chart.plugins.register(chartAnnotation); import * as DB from "./db"; import * as Misc from "./misc"; -import * as ResultFilters from "./result-filters"; +import * as ResultFilters from "./account/result-filters"; import Config from "./config"; import * as SimplePopups from "./simple-popups"; import * as AccountController from "./account-controller"; -import { toggleGlarses } from "./test-logic"; -import "./caps-warning"; -import "./support-popup"; -import "./contact-popup"; -import "./version-popup"; +import { toggleGlarses } from "./test/test-logic"; +import "./test/caps-warning"; +import "./popups/support-popup"; +import "./popups/contact-popup"; +import "./popups/version-popup"; import "./input-controller"; import "./ready"; -import "./about-page"; -import "./pb-tables-popup"; -import "./scroll-to-top"; +import "./elements/about-page"; +import "./popups/pb-tables-popup"; +import "./elements/scroll-to-top"; import * as Account from "./account"; -import * as TestStats from "./test-stats"; +import * as TestStats from "./test/test-stats"; import * as Replay from "./replay"; -import * as TestTimer from "./test-timer"; -import * as Result from "./test-timer"; +import * as TestTimer from "./test/test-timer"; +import * as Result from "./test/test-timer"; diff --git a/src/js/misc.js b/src/js/misc.js index bd0dc0dfe..12af727d3 100644 --- a/src/js/misc.js +++ b/src/js/misc.js @@ -1,6 +1,6 @@ import * as Loader from "./loader"; import Config from "./config"; -import * as TestLogic from "./test-logic"; +import * as TestLogic from "./test/test-logic"; export function getuid() { console.error("Only share this uid with Miodec and nobody else!"); diff --git a/src/js/simple-popups.js b/src/js/simple-popups.js index 621420d5a..d8c2a4f20 100644 --- a/src/js/simple-popups.js +++ b/src/js/simple-popups.js @@ -1,5 +1,5 @@ -import * as Loader from "./loader"; -import * as Notifications from "./notifications"; +import * as Loader from "./elements/loader"; +import * as Notifications from "./elements/notifications"; import * as AccountController from "./account-controller"; import * as DB from "./db"; import * as Settings from "./settings"; @@ -64,12 +64,14 @@ class SimplePopup { if (this.type === "number") { this.inputs.forEach((input) => { el.find(".inputs").append(` - - `); + } + autocomplete="off"> + `); }); } else if (this.type === "text") { this.inputs.forEach((input) => { diff --git a/static/languages/german_10k.json b/static/languages/german_10k.json index 2b4f141bd..4d3bcb89a 100644 --- a/static/languages/german_10k.json +++ b/static/languages/german_10k.json @@ -1,4 +1,4 @@ -{ +{ "name": "german_10k", "_comment": "Sourced from: https://wortschatz.uni-leipzig.de/de/download/German and https://en.wiktionary.org/wiki/Wiktionary:Frequency_lists#German", "leftToRight": true,