Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: convert to typescript #112

Merged
merged 4 commits into from
Nov 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .env.vault
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#################################################################################
# #
# This file uniquely identifies your project in Dotenv Vault. #
# You SHOULD commit this file to source control. #
# #
# Generated with `npx dotenv-vault new` #
# #
# Learn more at https://dotenv.org/env-vault #
# #
#################################################################################

DOTENV_VAULT=vlt_e765b1d155339f086dc33c557228c0bad3fab2f3a5f226095968419333819868
DOTENV_VAULT_DEVELOPMENT="8MR2MLEFP9ZILBW1GPAzAttfjI3MM0IzMHP26GA1nK8SeYNttt6bz9g8G6FsMt2+PxgI8J3jHKLLl/Qe54pIOUM9sbHz3nqDVWOCIsbg9EFrc1QYB9CWbmsSJSy3x0yGIO5IzLFLNkPdfqUrSNNN4SOr537ui+3em/Xl/Kh6xJUWTtR5n9s5vku0fCUKs5NV7SusPWWFjVzBgIN+B0nnKZ+XpahScy6MaFPPN6AlatbsxKxq5t5+lRGkMqwhitaSL56EbKq/idb/rwBZS+4whprx4yyZbmD382H9kDqyNwnuNIeFhVQIVC0u8Bp+yn7M0XogQm7+SyBMjVewa3PTcH2ATQuIckiTChrgAWEzJQVB5Ve1QXJQRjnB6mtsQSoKOHs0oVtu/CfdFRikfCRNK8rHFordubiHBpTX1Rgb7VkMVMIKJa0k0uEU435yVHeU3dLph59EhmgoT2qykLkQNhI/ydLV4HMaZeTDzn/YYLYpRlqjNoiwpWBqw/SwdES1dyM+b6k/0zByHEmA6J4gvKCdmiFB8lkElbNeqsq5LQgW2UhFVm6LIr+D9t0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pRRT1doVgNopW9edkCcu1Umg14RK/lFwnq3lJDGWLVp+vyF9GC5bWrg+e+Wp7VFonUL41W33Ll52/mCRRJjvUjgepl3QNN1q42A83/3mPCvJ7lqncRG4+mK2q93FLcJQZHdIYpa1VUYaoRnLiI+GvLviMmsyu5ZrYDuQjpKoJBbESs98DRnKPeUkbNxkfO0v2im9cWEVwM0FeAPV9hFjO2/1CbmuE2z62iK3gxZwKW+LNPvyM+TOr2ActQ7MbTbgdxeZjmtGBdWYj5rIQ0KUFHhz5zjd3+d11hzxW3lKduWr7ybFXfO/wSaZJRXtCocuAjiNwonlvRlkcR6adrLpCMQGiQFxKKNRjWVPKdGcfQf8668JYXnLjITmqM6gONzf+cWmg+Rp1vnPLroMXf6noL/P3oAnRIN+bOLzwVBQrmgRioNqPmhpdzwjsSvCxQHdEn0jOlKnvaSVnUaRbw9l9Hbp6EtVcOhI7Q1Siy+YBnfr+LR2WDmoTS5bTt52GqQsXYHxGFe6RantSzq2XXOLmyz4ovF1wnpnLfkJu/p7ILAJ2IBIBYTVNqggD6tOMHBxQhwINeUUIpvWE62DXbKZpu/Pfo3Vr05A+liy3LqgUNXF8alYZlp86omzGMxIELC9Voiyo71LbQYhFwJhZ0N5r31vd6YvUK9eG8srtba2R+gF5WxUVy8X6DiPpoa0nPjWeZdfkFP9Eyw43vP0WGiNqnzmPzGDE2ehBQhy3hONSBoCGFq+voxjXUcT+QSkk="
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
77 changes: 58 additions & 19 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,42 @@
{
"extends": "eslint:recommended",
"env": {
"node": true,
"es6": true
"es6": true,
"node": true
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2021
"ecmaVersion": 2022,
"sourceType": "module"
},
"plugins": ["@typescript-eslint", "prettier"],
"rules": {
"array-bracket-newline": ["error", "consistent"],
"arrow-body-style": ["error", "as-needed"],
"arrow-parens": ["error", "as-needed"],
"arrow-spacing": "error",
"block-spacing": "error",
"brace-style": "error",
"camelcase": "error",
"comma-dangle": "error",
"comma-spacing": "error",
"comma-style": ["error", "last"],
"curly": ["error", "all"],
"default-case-last": "error",
"dot-location": ["error", "property"],
"dot-notation": "error",
"eqeqeq": ["error", "always"],
"eol-last": ["error", "always"],
"eqeqeq": ["error", "always"],
"func-call-spacing": ["error", "never"],
"function-call-argument-newline": ["error", "never"],
"implicit-arrow-linebreak": ["error", "beside"],
"indent": ["error", 2, { "SwitchCase": 1 }],
"keyword-spacing": "error",
"line-comment-position": ["error", { "position": "above" }],
"lines-around-comment": "error",
"no-alert": "error",
"no-await-in-loop": "error",
"no-case-declarations": "off",
"no-confusing-arrow": "error",
"no-duplicate-imports": ["error", { "includeExports": true }],
"no-else-return": ["error", { "allowElseIf": false }],
"no-empty-function": "error",
"no-extra-label": "error",
"no-extra-parens": "error",
"no-floating-decimal": "error",
"no-implicit-coercion": "error",
"no-implied-eval": "error",
Expand All @@ -50,13 +48,30 @@
"no-multiple-empty-lines": "error",
"no-negated-condition": "error",
"no-nested-ternary": "error",
"no-new": "error",
"no-new-wrappers": "error",
"no-octal-escape": "error",
"no-restricted-globals": [
"error",
{
"name": "Buffer",
"message": "Import Buffer from `node:buffer` instead"
},
{
"name": "process",
"message": "Import process from `node:process` instead"
},
{
"name": "__dirname",
"message": "Import getDirname from `#util` instead"
},
{
"name": "__filename",
"message": "Import getFilename from `#util` instead"
}
],
"no-return-await": "error",
"no-sequences": ["error", { "allowInParentheses": false }],
"no-shadow": ["error", { "hoist": "all" }],
"no-tabs": "error",
"no-shadow": ["off"],
"no-template-curly-in-string": "error",
"no-trailing-spaces": "error",
"no-undef-init": "error",
Expand All @@ -70,7 +85,6 @@
"no-useless-return": "error",
"no-var": "error",
"no-whitespace-before-property": "error",
"nonblock-statement-body-position": ["error", "beside"],
"object-curly-newline": ["error", { "consistent": true }],
"object-shorthand": "error",
"one-var": ["error", "never"],
Expand All @@ -83,21 +97,46 @@
"prefer-rest-params": "error",
"prefer-spread": "error",
"prefer-template": "error",
"quotes": ["error", "single"],
"prettier/prettier": ["error", { "endOfLine": "auto" }, { "usePrettierrc": true }],
"require-atomic-updates": "error",
"require-unicode-regexp": "error",
"rest-spread-spacing": ["error", "never"],
"semi": "error",
"semi-spacing": "error",
"semi-style": ["error", "last"],
"space-before-function-paren": ["error", { "anonymous": "never", "named": "never", "asyncArrow": "always" }],
"space-before-function-paren": [
"error",
{
"anonymous": "never",
"asyncArrow": "always",
"named": "never"
}
],
"space-in-parens": ["error", "never"],
"space-infix-ops": "error",
"space-unary-ops": ["error", { "words": true, "nonwords": false }],
"space-unary-ops": ["error", { "nonwords": false, "words": true }],
"spaced-comment": "error",
"switch-colon-spacing": "error",
"template-curly-spacing": ["error", "never"],
"unicode-bom": ["error", "never"],
"yoda": "error"
}
},
"overrides": [
{
"files": ["*.ts"],
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
"parserOptions": {
"project": ["./tsconfig.json"]
},
"rules": {
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/restrict-template-expressions": "off"
}
}
]
}
29 changes: 0 additions & 29 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

19 changes: 0 additions & 19 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

18 changes: 18 additions & 0 deletions .github/tsc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"problemMatcher": [
{
"owner": "tsc",
"pattern": [
{
"regexp": "^(?:\\s+\\d+\\>)?([^\\s].*)\\((\\d+),(\\d+)\\)\\s*:\\s+(error|warning|info)\\s+(\\w{1,2}\\d+)\\s*:\\s*(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"code": 5,
"message": 6
}
]
}
]
}
30 changes: 28 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Testing
on: [push, pull_request]
name: Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
lint:
name: ESLint
Expand All @@ -19,3 +23,25 @@ jobs:

- name: Run ESLint
run: npm run lint

typescript:
name: TypeScript
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install Node v18
uses: actions/setup-node@v3
with:
node-version: 18
cache: npm

- name: Install dependencies
run: npm ci

- name: Register Problem Matcher
run: echo "##[add-matcher].github/tsc.json"

- name: Run TypeScript compiler
run: npm run test:ts
11 changes: 9 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
/node_modules
eval.js
database.sqlite3
/dist
eval.*
database.*
/backup

# Env
.env
.env*
.flaskenv*
!.env.project
!.env.vault

# General
.DS_Store
Expand Down
8 changes: 8 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"trailingComma": "none",
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"printWidth": 120,
"arrowParens": "avoid"
}
22 changes: 0 additions & 22 deletions commands/bot/changelog.js

This file was deleted.

22 changes: 0 additions & 22 deletions commands/bot/credits.js

This file was deleted.

Loading