From 4949829e205117d9902fae1e6d0c0bbadc1e8aab Mon Sep 17 00:00:00 2001 From: Samuel Degueldre Date: Tue, 2 Aug 2022 07:10:49 +0000 Subject: [PATCH] [IMP] web: enable prefer-const and curly rules in eslint config The prefer-const rule disallows using const on variables that are never reassigned, this improves readability by allowing the reader to know in advance that all variables that are declared with const are never reassigned and all variables declared with let will eventually be reassigned. The curly rule disallows braceless if/else, for and while which is a rule we have thus far been enforcing by hand. Part-of: odoo/odoo#97286 --- addons/web/tooling/_eslintrc.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/web/tooling/_eslintrc.json b/addons/web/tooling/_eslintrc.json index e4c6cfcb82b..e7e71183518 100644 --- a/addons/web/tooling/_eslintrc.json +++ b/addons/web/tooling/_eslintrc.json @@ -19,7 +19,9 @@ "no-unsafe-negation": ["error"], "no-duplicate-imports": ["error"], "valid-typeof": ["error"], - "no-unused-vars": ["error", { "vars": "all", "args": "none", "ignoreRestSiblings": false, "caughtErrors": "all", "caughtErrorsIgnorePattern": "^_" }] + "no-unused-vars": ["error", { "vars": "all", "args": "none", "ignoreRestSiblings": false, "caughtErrors": "all", "caughtErrorsIgnorePattern": "^_" }], + "curly": ["error", "all"], + "prefer-const": ["error"] }, "globals": { "owl": "readonly",