Feature/set up stylisticTypeChecked rule in eslint configuration (#3878)
* Set up stylisticTypeChecked rule in eslint configuration * Update changelog --------- Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
parent
f48ce4e1ae
commit
f0f67cdacb
@ -34,9 +34,11 @@
|
|||||||
{
|
{
|
||||||
"files": ["*.ts"],
|
"files": ["*.ts"],
|
||||||
"plugins": ["eslint-plugin-import", "@typescript-eslint"],
|
"plugins": ["eslint-plugin-import", "@typescript-eslint"],
|
||||||
"extends": ["plugin:@typescript-eslint/recommended-type-checked"],
|
"extends": [
|
||||||
|
"plugin:@typescript-eslint/recommended-type-checked",
|
||||||
|
"plugin:@typescript-eslint/stylistic-type-checked"
|
||||||
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
"@typescript-eslint/consistent-type-definitions": "warn",
|
|
||||||
"@typescript-eslint/dot-notation": "off",
|
"@typescript-eslint/dot-notation": "off",
|
||||||
"@typescript-eslint/explicit-member-accessibility": [
|
"@typescript-eslint/explicit-member-accessibility": [
|
||||||
"off",
|
"off",
|
||||||
@ -45,8 +47,33 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"@typescript-eslint/member-ordering": "warn",
|
"@typescript-eslint/member-ordering": "warn",
|
||||||
"@typescript-eslint/naming-convention": "off",
|
"@typescript-eslint/naming-convention": [
|
||||||
"@typescript-eslint/no-empty-function": "off",
|
"off",
|
||||||
|
{
|
||||||
|
"selector": "default",
|
||||||
|
"format": ["camelCase"],
|
||||||
|
"leadingUnderscore": "allow",
|
||||||
|
"trailingUnderscore": "allow"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"selector": ["variable", "classProperty", "typeProperty"],
|
||||||
|
"format": ["camelCase", "UPPER_CASE"],
|
||||||
|
"leadingUnderscore": "allow",
|
||||||
|
"trailingUnderscore": "allow"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"selector": "objectLiteralProperty",
|
||||||
|
"format": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"selector": "enumMember",
|
||||||
|
"format": ["camelCase", "UPPER_CASE", "PascalCase"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"selector": "typeLike",
|
||||||
|
"format": ["PascalCase"]
|
||||||
|
}
|
||||||
|
],
|
||||||
"@typescript-eslint/no-empty-interface": "warn",
|
"@typescript-eslint/no-empty-interface": "warn",
|
||||||
"@typescript-eslint/no-inferrable-types": [
|
"@typescript-eslint/no-inferrable-types": [
|
||||||
"warn",
|
"warn",
|
||||||
@ -61,7 +88,6 @@
|
|||||||
"hoist": "all"
|
"hoist": "all"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"@typescript-eslint/prefer-function-type": "warn",
|
|
||||||
"@typescript-eslint/unified-signatures": "error",
|
"@typescript-eslint/unified-signatures": "error",
|
||||||
"@typescript-eslint/no-loss-of-precision": "warn",
|
"@typescript-eslint/no-loss-of-precision": "warn",
|
||||||
"@typescript-eslint/no-var-requires": "warn",
|
"@typescript-eslint/no-var-requires": "warn",
|
||||||
@ -114,7 +140,18 @@
|
|||||||
"@typescript-eslint/require-await": "warn",
|
"@typescript-eslint/require-await": "warn",
|
||||||
"@typescript-eslint/restrict-template-expressions": "warn",
|
"@typescript-eslint/restrict-template-expressions": "warn",
|
||||||
"@typescript-eslint/unbound-method": "warn",
|
"@typescript-eslint/unbound-method": "warn",
|
||||||
"prefer-const": "warn"
|
"prefer-const": "warn",
|
||||||
|
|
||||||
|
// The following rules are part of @typescript-eslint/stylistic-type-checked
|
||||||
|
// and can be remove once solved
|
||||||
|
"@typescript-eslint/consistent-type-definitions": "warn",
|
||||||
|
"@typescript-eslint/prefer-function-type": "warn",
|
||||||
|
"@typescript-eslint/no-empty-function": "warn",
|
||||||
|
"@typescript-eslint/prefer-nullish-coalescing": "warn", // TODO: Requires strictNullChecks: true
|
||||||
|
"@typescript-eslint/consistent-type-assertions": "warn",
|
||||||
|
"@typescript-eslint/prefer-optional-chain": "warn",
|
||||||
|
"@typescript-eslint/consistent-indexed-object-style": "warn",
|
||||||
|
"@typescript-eslint/consistent-generic-constructors": "warn"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
- Set up a git-hook via `husky` to lint and format the changes before a commit
|
- 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
|
- Added the `typescript-eslint/recommended-type-checked` rule to the `eslint` configuration
|
||||||
|
- Added the `typescript-eslint/stylistic-type-checked` rule to the `eslint` configuration
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
],
|
],
|
||||||
"angularCompilerOptions": {
|
"angularCompilerOptions": {
|
||||||
"strictInjectionParameters": true,
|
"strictInjectionParameters": true,
|
||||||
|
// TODO: Enable stricter rules for this project
|
||||||
|
"strictInputAccessModifiers": false,
|
||||||
"strictTemplates": false
|
"strictTemplates": false
|
||||||
},
|
},
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
@ -14,11 +14,11 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"forceConsistentCasingInFileNames": true,
|
"target": "es2020",
|
||||||
|
// TODO: Remove once solved in tsconfig.base.json
|
||||||
"strict": false,
|
"strict": false,
|
||||||
"noImplicitReturns": true,
|
"noImplicitReturns": true,
|
||||||
"noFallthroughCasesInSwitch": true,
|
"noFallthroughCasesInSwitch": true
|
||||||
"target": "es2020"
|
|
||||||
},
|
},
|
||||||
"angularCompilerOptions": {
|
"angularCompilerOptions": {
|
||||||
"strictInjectionParameters": true,
|
"strictInjectionParameters": true,
|
||||||
|
@ -20,7 +20,20 @@
|
|||||||
"@ghostfolio/client/*": ["apps/client/src/app/*"],
|
"@ghostfolio/client/*": ["apps/client/src/app/*"],
|
||||||
"@ghostfolio/common/*": ["libs/common/src/lib/*"],
|
"@ghostfolio/common/*": ["libs/common/src/lib/*"],
|
||||||
"@ghostfolio/ui/*": ["libs/ui/src/lib/*"]
|
"@ghostfolio/ui/*": ["libs/ui/src/lib/*"]
|
||||||
}
|
},
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"strict": false,
|
||||||
|
"strictNullChecks": false,
|
||||||
|
"strictPropertyInitialization": false,
|
||||||
|
"noImplicitReturns": false,
|
||||||
|
"noImplicitAny": false,
|
||||||
|
"noImplicitThis": false,
|
||||||
|
"noImplicitOverride": false,
|
||||||
|
"noPropertyAccessFromIndexSignature": false,
|
||||||
|
"noUnusedLocals": false,
|
||||||
|
"noUnusedParameters": false,
|
||||||
|
"allowUnreachableCode": true
|
||||||
},
|
},
|
||||||
"exclude": ["node_modules", "tmp"]
|
"exclude": ["node_modules", "tmp"]
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user