From 818063d52172e997dba0ac3f341dce3e92dec52e Mon Sep 17 00:00:00 2001 From: Adam Gastineau Date: Mon, 16 Dec 2024 12:12:16 -0800 Subject: [PATCH] Apply new ESLint rules for braces around ifs and unnecessary checks --- .eslintrc.js | 7 +++++-- tests/.eslintrc.js | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index a116a37036..4e18f960a0 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -4,6 +4,7 @@ module.exports = { parserOptions: { ecmaVersion: 9, sourceType: "module", + project: "./tsconfig.json" }, extends: [ "plugin:react/recommended", @@ -26,6 +27,8 @@ module.exports = { rules: { "@typescript-eslint/no-unused-vars": [2, {args: "none"}], "@typescript-eslint/consistent-type-imports": [2, {disallowTypeAnnotations: false}], + "@typescript-eslint/no-unnecessary-condition": [2], + /** * Enforced rules */ @@ -48,8 +51,8 @@ module.exports = { "getWithoutSet": false, "setWithoutGet": false }], - "brace-style": [2, "1tbs", {"allowSingleLine": true}], - "curly": [2, "multi-or-nest", "consistent"], + "brace-style": [2, "1tbs"], + "curly": [2, "all"], "new-parens": 2, "arrow-parens": [2, "as-needed"], "prefer-const": 2, diff --git a/tests/.eslintrc.js b/tests/.eslintrc.js index 2621e5234e..1de7c29770 100644 --- a/tests/.eslintrc.js +++ b/tests/.eslintrc.js @@ -12,5 +12,7 @@ module.exports = { rules: { '@typescript-eslint/no-floating-promises': 'error', "@typescript-eslint/no-unnecessary-boolean-literal-compare": 2, + // Not strictly necessary for tests and there are some config issues with it + "@typescript-eslint/no-unnecessary-condition": 0, }, };