Skip to content

Commit

Permalink
front: turn on @typescript-eslint/no-unnecessary-type-assertion lint
Browse files Browse the repository at this point in the history
First part of #8772

Enable typed hinting so that ESLint has information about types
and can provide more feedback. Only enable a single typed lint
rule for now (rest will be a lot more work to fix).

The rule @typescript-eslint/no-unnecessary-type-assertion prevents
unnecessary type assertions (casting a string to a string).
Reducing type assertions is nice because type assertions override
type checking and thus may hide type mismatches.

Signed-off-by: Simon Ser <[email protected]>
  • Loading branch information
emersion committed Sep 10, 2024
1 parent 94cf1ac commit cf049a3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions front/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
"airbnb",
"plugin:import/recommended",
"plugin:import/typescript",
"prettier"
"prettier",
"plugin:@typescript-eslint/base"
],
"plugins": ["import", "only-warn", "prettier", "react", "react-hooks", "vitest"],
"parserOptions": {
"ecmaVersion": "latest"
"ecmaVersion": "latest",
"project": true
},
"rules": {
"import/order": [
Expand All @@ -41,6 +43,7 @@
"@typescript-eslint/consistent-type-imports": ["error", { "fixStyle": "inline-type-imports" }],
"@typescript-eslint/no-shadow": "error",
"@typescript-eslint/no-use-before-define": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",

"@typescript-eslint/ban-types": [
"error",
Expand Down

0 comments on commit cf049a3

Please sign in to comment.