Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Feature/set up recommendedTypeChecked rule in eslint configuration (#3876)

dw-0e2ae43bf28d8
diff --git a/.eslintrc.json b/.eslintrc.json
index fc591aab6f..59b7e8b894 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -34,6 +34,7 @@
{
"files": ["*.ts"],
"plugins": ["eslint-plugin-import", "@typescript-eslint"],
+ "extends": ["plugin:@typescript-eslint/recommended-type-checked"],
"rules": {
"@typescript-eslint/consistent-type-definitions": "warn",
"@typescript-eslint/dot-notation": "off",
@@ -53,7 +54,6 @@
"ignoreParameters": true
}
],
- "@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-shadow": [
"warn",
@@ -61,12 +61,10 @@
"hoist": "all"
}
],
- "@typescript-eslint/no-unused-expressions": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/unified-signatures": "error",
"@typescript-eslint/no-loss-of-precision": "warn",
"@typescript-eslint/no-var-requires": "warn",
- "@typescript-eslint/ban-ts-comment": "warn",
"@typescript-eslint/ban-types": "warn",
"arrow-body-style": "off",
"constructor-super": "error",
@@ -83,11 +81,9 @@
"no-fallthrough": "error",
"no-new-wrappers": "error",
"no-restricted-imports": ["error", "rxjs/Rx"],
- "no-throw-literal": "warn",
"no-undef-init": "error",
"no-underscore-dangle": "off",
"no-var": "error",
- "prefer-const": "warn",
"radix": "error",
"no-unsafe-optional-chaining": "warn",
"no-extra-boolean-cast": "warn",
@@ -96,7 +92,30 @@
"no-unsafe-finally": "warn",
"no-prototype-builtins": "warn",
"no-async-promise-executor": "warn",
- "no-constant-condition": "warn"
+ "no-constant-condition": "warn",
+
+ // The following rules are part of @typescript-eslint/recommended-type-checked
+ // and can be remove once solved
+ "@typescript-eslint/await-thenable": "warn",
+ "@typescript-eslint/ban-ts-comment": "warn",
+ "@typescript-eslint/no-base-to-string": "warn",
+ "@typescript-eslint/no-explicit-any": "warn",
+ "@typescript-eslint/no-floating-promises": "warn",
+ "@typescript-eslint/no-misused-promises": "warn",
+ "@typescript-eslint/no-redundant-type-constituents": "warn",
+ "@typescript-eslint/no-unnecessary-type-assertion": "warn",
+ "@typescript-eslint/no-unsafe-argument": "warn",
+ "@typescript-eslint/no-unsafe-assignment": "warn",
+ "@typescript-eslint/no-unsafe-enum-comparison": "warn",
+ "@typescript-eslint/no-unused-expressions": "warn",
+ "@typescript-eslint/no-unsafe-member-access": "warn",
+ "@typescript-eslint/no-unsafe-return": "warn",
+ "@typescript-eslint/no-unused-vars": "warn",
+ "@typescript-eslint/no-unsafe-call": "warn",
+ "@typescript-eslint/require-await": "warn",
+ "@typescript-eslint/restrict-template-expressions": "warn",
+ "@typescript-eslint/unbound-method": "warn",
+ "prefer-const": "warn"
}
}
],
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f2464c3509..1d940fcde6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Set up a git-hook via `husky` to lint and format the changes before a commit
+- Added the `typescript-eslint/recommended-type-checked` rule to the `eslint` configuration
### Fixed
diff --git a/apps/client-e2e/.eslintrc.json b/apps/client-e2e/.eslintrc.json
new file mode 100644
index 0000000000..dbedf6bd4f
--- /dev/null
+++ b/apps/client-e2e/.eslintrc.json
@@ -0,0 +1,20 @@
+{
+ "extends": ["plugin:cypress/recommended", "../../.eslintrc.json"],
+ "ignorePatterns": ["!**/*"],
+ "overrides": [
+ {
+ "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
+ "parserOptions": {
+ "project": ["apps/client-e2e/tsconfig.*?.json"]
+ },
+ "rules": {}
+ },
+ {
+ "files": ["src/plugins/index.js"],
+ "rules": {
+ "@typescript-eslint/no-var-requires": "off",
+ "no-undef": "off"
+ }
+ }
+ ]
+}
diff --git a/apps/ui-e2e/.eslintrc.json b/apps/ui-e2e/.eslintrc.json
index 4c5989b23b..e1ff28793d 100644
--- a/apps/ui-e2e/.eslintrc.json
+++ b/apps/ui-e2e/.eslintrc.json
@@ -4,6 +4,9 @@
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
+ "parserOptions": {
+ "project": ["apps/ui-e2e/tsconfig.json"]
+ },
"rules": {}
},
{
diff --git a/libs/ui/.eslintrc.json b/libs/ui/.eslintrc.json
index 2d3d3dcafc..6b88b020ec 100644
--- a/libs/ui/.eslintrc.json
+++ b/libs/ui/.eslintrc.json
@@ -1,9 +1,12 @@
{
"extends": ["../../.eslintrc.json"],
- "ignorePatterns": ["!**/*"],
+ "ignorePatterns": ["!**/*", "**/*.stories.ts"],
"overrides": [
{
- "files": ["*.ts"],
+ "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
+ "parserOptions": {
+ "project": ["libs/ui/tsconfig.*?.json"]
+ },
"extends": [
"plugin:@nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"