Skip to content

Commit

Permalink
feat: db migrations, fix eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
Lemmmy committed Jun 27, 2024
1 parent 5030c6c commit 991e88c
Show file tree
Hide file tree
Showing 39 changed files with 6,270 additions and 3,918 deletions.
10 changes: 0 additions & 10 deletions .eslintignore

This file was deleted.

175 changes: 104 additions & 71 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,76 +1,109 @@
export default {
root: true,
parser: "@typescript-eslint/parser",
plugins: [
"@typescript-eslint"
],
parserOptions: {
project: "./tsconfig.json",
tsconfigRootDir: ".",
ecmaVersion: 2018,
sourceType: "module"
// @ts-check

import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
import mochaPlugin from "eslint-plugin-mocha";
import codegenPlugin from "eslint-plugin-codegen";

export default tseslint.config(
{
ignores: [
"node_modules",
"static",
"views",
"data",
"dist",
"coverage",
"mochawesome-report",
".nyc_output",
],
},
env: {
es6: true,
node: true,
mocha: true
eslint.configs.recommended,
...tseslint.configs.recommended,
mochaPlugin.configs.flat.recommended,
{
plugins: {
"@typescript-eslint": tseslint.plugin,
"codegen": codegenPlugin,
},
languageOptions: {
parser: tseslint.parser,
parserOptions: {
project: true
},
}
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
rules: {
quotes: ["error", "double", { allowTemplateLiterals: true }],
semi: "error",
indent: ["error", 2, {
FunctionDeclaration: { parameters: "first" }
}],
"prefer-arrow-callback": "warn",
"eol-last": ["error", "always"],
"object-shorthand": ["error", "always"],
"no-unused-vars": 0,
"no-lonely-if": "warn",
"no-trailing-spaces": "warn",
"no-whitespace-before-property": "warn",
"no-multiple-empty-lines": "warn",
"space-before-blocks": "warn",
"space-in-parens": ["warn", "never"],
"space-infix-ops": "warn",
"eqeqeq": "warn",
"no-shadow": ["error"],
"no-var": ["error"],
"prefer-const": ["error"],
"one-var": ["error", { separateRequires: true }],
{
files: [
"src/**/*.ts",
"test/**/*.ts",
],
rules: {
quotes: ["error", "double", { allowTemplateLiterals: true }],
semi: "error",
indent: ["error", 2, {
FunctionDeclaration: { parameters: "first" }
}],
"prefer-arrow-callback": "warn",
"eol-last": ["error", "always"],
"object-shorthand": ["error", "always"],
"no-unused-vars": 0,
"no-lonely-if": "warn",
"no-trailing-spaces": "warn",
"no-whitespace-before-property": "warn",
"no-multiple-empty-lines": "warn",
"space-before-blocks": "warn",
"space-in-parens": ["warn", "never"],
"space-infix-ops": "warn",
"eqeqeq": "warn",
"no-shadow": ["error"],
"no-var": ["error"],
"prefer-const": ["error"],
"one-var": ["error", { separateRequires: true }],

"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/explicit-module-boundary-types": ["warn", {
allowArgumentsExplicitlyTypedAsAny: true,
allowDirectConstAssertionInArrowFunctions: true,
allowedNames: [],
allowHigherOrderFunctions: true,
allowTypedFunctionExpressions: true
}],
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
"@typescript-eslint/member-delimiter-style": ["error", {
multiline: { delimiter: "semi", requireLast: true },
singleline: { delimiter: "semi", requireLast: false }
}],
"@typescript-eslint/no-unused-vars": ["warn", {
ignoreRestSiblings: true,
argsIgnorePattern: "^_"
}],
"@typescript-eslint/no-non-null-assertion": 0,
"@typescript-eslint/space-before-function-paren": ["warn", {
anonymous: "never",
named: "never",
asyncArrow: "always"
}],
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/explicit-module-boundary-types": ["warn", {
allowArgumentsExplicitlyTypedAsAny: true,
allowDirectConstAssertionInArrowFunctions: true,
allowedNames: [],
allowHigherOrderFunctions: true,
allowTypedFunctionExpressions: true
}],
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
"@typescript-eslint/member-delimiter-style": ["error", {
multiline: { delimiter: "semi", requireLast: true },
singleline: { delimiter: "semi", requireLast: false }
}],
"@typescript-eslint/no-unused-vars": ["warn", {
ignoreRestSiblings: true,
argsIgnorePattern: "^_"
}],
"@typescript-eslint/no-non-null-assertion": 0,
"@typescript-eslint/space-before-function-paren": ["warn", {
anonymous: "never",
named: "never",
asyncArrow: "always"
}],

"@typescript-eslint/naming-convention": [
"error",
{ selector: "typeLike", format: ["StrictPascalCase"] },
{ selector: "variable", format: ["strictCamelCase", "UPPER_CASE", "StrictPascalCase"] },
{ selector: "variable", modifiers: ["destructured"], format: null }
]
"@typescript-eslint/naming-convention": [
"error",
{ selector: "typeLike", format: ["StrictPascalCase"] },
{ selector: "variable", format: ["strictCamelCase", "UPPER_CASE", "StrictPascalCase"] },
{ selector: "variable", modifiers: ["destructured"], format: null }
],

"codegen/codegen": "error"
}
},
{
files: [
"test/**/*.ts"
],
rules: {
"prefer-arrow-callback": "off",
"mocha/no-identical-title": "off",
"mocha/no-setup-in-describe": "off",
"mocha/max-top-level-suites": "off",
}
}
}
);
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "krist",
"version": "3.4.3",
"version": "3.5.0",
"description": "The new Krist node written in TypeScript.",
"type": "module",
"scripts": {
Expand All @@ -10,7 +10,8 @@
"docs": "apidoc -v -t apidoc-template -i src -o static/docs",
"test": "cross-env TS_NODE_PROJECT='./tsconfig.test.json' NODE_ENV=test mocha 'test/**/*.test.ts'",
"test:coverage": "nyc pnpm run test",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"lint": "eslint src",
"lint:codegen": "eslint --fix src/database/migrations/barrel.ts || exit 0",
"preinstall": "npx only-allow pnpm"
},
"repository": {
Expand Down Expand Up @@ -52,16 +53,19 @@
"redis": "^4.6.14",
"reflect-metadata": "^0.2.2",
"sanitize-html": "^2.13.0",
"umzug": "^3.8.1",
"utility-types": "^3.11.0",
"uuid": "^10.0.0",
"why-is-node-running": "^2.2.2"
},
"devDependencies": {
"@eslint/js": "^9.5.0",
"@istanbuljs/nyc-config-typescript": "^1.0.2",
"@types/body-parser": "^1.19.5",
"@types/chai": "^4.3.16",
"@types/chai-http": "^4.2.0",
"@types/cors": "^2.8.17",
"@types/eslint__js": "^8.42.3",
"@types/express": "^4.17.21",
"@types/express-ws": "^3.0.4",
"@types/lodash-es": "^4.17.12",
Expand All @@ -81,12 +85,15 @@
"chai-http": "^4.4.0",
"cross-env": "^7.0.3",
"eslint": "^9.5.0",
"eslint-plugin-codegen": "^0.28.0",
"eslint-plugin-mocha": "^10.4.3",
"mocha": "^10.4.0",
"mochawesome": "^7.1.3",
"nyc": "^17.0.0",
"sinon": "^18.0.0",
"tsx": "^4.15.6",
"typescript": "^5.4.5",
"typescript-eslint": "^7.14.1",
"websocket": "^1.0.35",
"websocket-as-promised": "^2.0.1"
},
Expand Down
Loading

0 comments on commit 991e88c

Please sign in to comment.