From 3ff1f98f85dc5f37ec269082f179f900c4322b53 Mon Sep 17 00:00:00 2001 From: Philipp Zelinski <43653566+nieopierzony@users.noreply.github.com> Date: Thu, 14 Apr 2022 18:34:28 +0200 Subject: [PATCH 01/10] Create .editoreconfig --- .editoreconfig | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .editoreconfig diff --git a/.editoreconfig b/.editoreconfig new file mode 100644 index 0000000..dde7877 --- /dev/null +++ b/.editoreconfig @@ -0,0 +1,12 @@ +# http://editorconfig.org +root = true + +[*] +end_of_line = lf +charset = utf-8 +insert_final_newline = true +trim_trailing_whitespace = true + +[{*.js,*.mjs,*.ts,*.json,*.yml}] +indent_size = 2 +indent_style = space From 2201caf51eef5c90c085b95d3041f325fb9ca8de Mon Sep 17 00:00:00 2001 From: Philipp Zelinski <43653566+nieopierzony@users.noreply.github.com> Date: Thu, 14 Apr 2022 18:35:21 +0200 Subject: [PATCH 02/10] Rename .editoreconfig to .editorconfig --- .editoreconfig => .editorconfig | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .editoreconfig => .editorconfig (100%) diff --git a/.editoreconfig b/.editorconfig similarity index 100% rename from .editoreconfig rename to .editorconfig From 974dc9ffc88a27405898a23f18febb111632f620 Mon Sep 17 00:00:00 2001 From: Philipp Zelinski <43653566+nieopierzony@users.noreply.github.com> Date: Thu, 14 Apr 2022 18:35:56 +0200 Subject: [PATCH 03/10] Create .eslintignore --- .eslintignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .eslintignore diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..c2658d7 --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +node_modules/ From e68aff387ee7dfc70786d9714d080b0055aeee83 Mon Sep 17 00:00:00 2001 From: Philipp Zelinski <43653566+nieopierzony@users.noreply.github.com> Date: Thu, 14 Apr 2022 18:36:20 +0200 Subject: [PATCH 04/10] Create .eslintrc.json --- .eslintrc.json | 160 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 .eslintrc.json diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..d04439f --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,160 @@ +{ + "env": { + "browser": true, + "es6": true, + "node": true + }, + "extends": "eslint:recommended", + "parserOptions": { + "ecmaVersion": 2020 + }, + "globals": { + "BigInt": true, + "Metacom": true + }, + "rules": { + "indent": ["error", 2], + "linebreak-style": ["error", "unix"], + "quotes": ["error", "single"], + "semi": ["error", "always"], + "no-loop-func": ["error"], + "block-spacing": ["error", "always"], + "camelcase": ["error"], + "eqeqeq": ["error", "always"], + "strict": ["error", "global"], + "brace-style": [ + "error", + "1tbs", + { + "allowSingleLine": true + } + ], + "comma-style": ["error", "last"], + "comma-spacing": [ + "error", + { + "before": false, + "after": true + } + ], + "eol-last": ["error"], + "func-call-spacing": ["error", "never"], + "key-spacing": [ + "error", + { + "beforeColon": false, + "afterColon": true, + "mode": "minimum" + } + ], + "keyword-spacing": [ + "error", + { + "before": true, + "after": true, + "overrides": { + "function": { + "after": false + } + } + } + ], + "max-len": [ + "error", + { + "code": 80, + "ignoreUrls": true + } + ], + "max-nested-callbacks": [ + "error", + { + "max": 7 + } + ], + "new-cap": [ + "error", + { + "newIsCap": true, + "capIsNew": false, + "properties": true + } + ], + "new-parens": ["error"], + "no-lonely-if": ["error"], + "no-trailing-spaces": ["error"], + "no-unneeded-ternary": ["error"], + "no-whitespace-before-property": ["error"], + "object-curly-spacing": ["error", "always"], + "operator-assignment": ["error", "always"], + "operator-linebreak": ["error", "after"], + "semi-spacing": [ + "error", + { + "before": false, + "after": true + } + ], + "space-before-blocks": ["error", "always"], + "space-before-function-paren": [ + "error", + { + "anonymous": "never", + "named": "never", + "asyncArrow": "always" + } + ], + "space-in-parens": ["error", "never"], + "space-infix-ops": ["error"], + "space-unary-ops": [ + "error", + { + "words": true, + "nonwords": false, + "overrides": { + "typeof": false + } + } + ], + "no-unreachable": ["error"], + "no-global-assign": ["error"], + "no-self-compare": ["error"], + "no-unmodified-loop-condition": ["error"], + "no-constant-condition": [ + "error", + { + "checkLoops": false + } + ], + "no-console": ["off"], + "no-useless-concat": ["error"], + "no-useless-escape": ["error"], + "no-shadow-restricted-names": ["error"], + "no-use-before-define": [ + "error", + { + "functions": false + } + ], + "arrow-parens": ["error", "always"], + "arrow-body-style": ["error", "as-needed"], + "arrow-spacing": ["error"], + "no-confusing-arrow": [ + "error", + { + "allowParens": true + } + ], + "no-useless-computed-key": ["error"], + "no-useless-rename": ["error"], + "no-var": ["error"], + "object-shorthand": ["error", "always"], + "prefer-arrow-callback": ["error"], + "prefer-const": ["error"], + "prefer-numeric-literals": ["error"], + "prefer-rest-params": ["error"], + "prefer-spread": ["error"], + "rest-spread-spacing": ["error", "never"], + "template-curly-spacing": ["error", "never"] + } +} From ade1912607e8d0b93dc174501c709ed4ee592f2f Mon Sep 17 00:00:00 2001 From: Philipp Zelinski <43653566+nieopierzony@users.noreply.github.com> Date: Thu, 14 Apr 2022 18:37:20 +0200 Subject: [PATCH 05/10] Create .prettierrc --- .prettierrc | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .prettierrc diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..74d3eb4 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,10 @@ +{ + "singleQuote": true, + "trailingComma": "es5", + "overrides": [ + { + "files": ".prettierrc", + "options": { "parser": "json" } + } + ] +} From 45be06dd20a5594393f3170669c8a8c477a7a9f7 Mon Sep 17 00:00:00 2001 From: Philipp Zelinski <43653566+nieopierzony@users.noreply.github.com> Date: Thu, 14 Apr 2022 18:37:45 +0200 Subject: [PATCH 06/10] Create server.js --- server.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 server.js diff --git a/server.js b/server.js new file mode 100644 index 0000000..8a3c729 --- /dev/null +++ b/server.js @@ -0,0 +1,3 @@ +'use strict'; + +require('impress'); From 40f6c69a3a59a4b00448df00ab8094a1dd4cb7d9 Mon Sep 17 00:00:00 2001 From: Philipp Zelinski <43653566+nieopierzony@users.noreply.github.com> Date: Thu, 14 Apr 2022 18:38:00 +0200 Subject: [PATCH 07/10] Create tsconfig.json --- tsconfig.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 tsconfig.json diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..1625593 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "target": "ESNext", + "moduleResolution": "node", + "strict": true, + "baseUrl": ".", + "preserveWatchOutput": true, + "allowJs": true, + "noEmit": true, + "skipLibCheck": true + }, + "include": ["types/**/*.ts", "application/**/*"] +} From c99c10d4a25a6dafb53613b293b73a4b9e34c700 Mon Sep 17 00:00:00 2001 From: Philipp Zelinski <43653566+nieopierzony@users.noreply.github.com> Date: Thu, 14 Apr 2022 18:38:35 +0200 Subject: [PATCH 08/10] Create global.d.ts --- types/global.d.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 types/global.d.ts diff --git a/types/global.d.ts b/types/global.d.ts new file mode 100644 index 0000000..438e803 --- /dev/null +++ b/types/global.d.ts @@ -0,0 +1,20 @@ +import * as _impress from 'impress'; + +import * as _metasql from 'metasql'; +import { Database } from 'metasql'; + +declare global { + namespace metarhia { + const metasql: typeof _metasql; + } + + namespace api {} + + namespace lib {} + + namespace domain {} + + namespace db { + const pg: Database; + } +} From 3c5c17f8f8b0e919a8e822198a40f0ac8e03560e Mon Sep 17 00:00:00 2001 From: Philipp Zelinski <43653566+nieopierzony@users.noreply.github.com> Date: Thu, 14 Apr 2022 18:39:33 +0200 Subject: [PATCH 09/10] Create .eslintrc.json --- application/.eslintrc.json | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 application/.eslintrc.json diff --git a/application/.eslintrc.json b/application/.eslintrc.json new file mode 100644 index 0000000..b871c82 --- /dev/null +++ b/application/.eslintrc.json @@ -0,0 +1,19 @@ +{ + "parserOptions": { + "sourceType": "module" + }, + "rules": { + "id-denylist": [ + 2, + "application", + "node", + "npm", + "api", + "lib", + "db", + "domain", + "config", + "metarhia" + ] + } +} From 843980c01b7923b69e38d61dc723bb58284966dc Mon Sep 17 00:00:00 2001 From: Philipp Zelinski <43653566+nieopierzony@users.noreply.github.com> Date: Thu, 14 Apr 2022 18:40:29 +0200 Subject: [PATCH 10/10] Create introspect.js --- application/api/system.1/introspect.js | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 application/api/system.1/introspect.js diff --git a/application/api/system.1/introspect.js b/application/api/system.1/introspect.js new file mode 100644 index 0000000..d055e57 --- /dev/null +++ b/application/api/system.1/introspect.js @@ -0,0 +1,4 @@ +({ + access: 'public', + method: application.introspect, +});