From 70711fa02824bbccdadaf0ba35339ec7615b3aaa Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 12 Dec 2023 09:08:17 +0100 Subject: [PATCH] enforce strict typescript --- .eslintignore | 4 ++++ .eslintrc.json | 22 ++++++++++++++++++++++ package.json | 2 +- 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 .eslintignore diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..7f89fa5 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,4 @@ +node_modules/ +build/ +coverage/ +.vuepress/ diff --git a/.eslintrc.json b/.eslintrc.json index f72f654..3e95956 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -118,6 +118,28 @@ "promise/no-multiple-resolved": "error" }, "overrides": [ + { + "files": ["*.ts", "*.tsx"], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "tsconfigRootDir": ".", + "project": ["./tsconfig.json", "**/tsconfig.json"], + "ecmaVersion": "latest", + "parser": "@typescript-eslint/parser", + "sourceType": "module" + }, + "plugins": ["@typescript-eslint"], + "extends": [ + "plugin:@typescript-eslint/recommended", + "plugin:@typescript-eslint/recommended-requiring-type-checking", + "plugin:@typescript-eslint/strict" + ], + "rules": { + // allow explicitly defined dangling promises + "@typescript-eslint/no-floating-promises": ["error", { "ignoreVoid": true }], + "no-void": ["error", { "allowAsStatement": true }] + } + }, { "files": ["!*.json"], "plugins": ["prettier"], diff --git a/package.json b/package.json index 2876e8e..f8c4319 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "db:reset": "TZ=UTC npx prisma migrate reset --force", "db:seed": "TZ=UTC npx prisma db seed", "test:lint": "npm run test:lint:eslint && npm run test:lint:remark", - "test:lint:eslint": "eslint --ext .ts,.tsx,.js,.jsx,.json,.yml,.yaml --max-warnings 0 --ignore-path .gitignore .", + "test:lint:eslint": "eslint --ext .ts,.tsx,.js,.jsx,.json,.yml,.yaml --max-warnings 0 .", "test:lint:remark": "remark . --quiet --frail", "test:unit": "TZ=UTC jest --runInBand --forceExit --detectOpenHandles", "test": "npm run test:lint && npm run test:unit",