From 1107e182345d7d9e424deb6099532e7e852798f1 Mon Sep 17 00:00:00 2001 From: Samuel Degueldre Date: Wed, 3 Aug 2022 11:35:46 +0000 Subject: [PATCH] [IMP] web: configure prefer-const eslint rule to be more lax We recently added the prefer-const eslint rule, but the default configuration of this rule disallows some things that we often do and which we do not think are bad practice such as declaring a variable with let so that it's available to a function defined below, but assign it only once later, we also sometimes destructure variables with let where some of the variables could be const but not all, in those cases we accept that some variables will be mutable even though it's not strictly necessary in favour of conciseness. closes odoo/odoo#97384 Signed-off-by: Lucas Perais (lpe) --- addons/web/tooling/_eslintrc.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/web/tooling/_eslintrc.json b/addons/web/tooling/_eslintrc.json index e7e71183518..e48bce8037f 100644 --- a/addons/web/tooling/_eslintrc.json +++ b/addons/web/tooling/_eslintrc.json @@ -21,7 +21,10 @@ "valid-typeof": ["error"], "no-unused-vars": ["error", { "vars": "all", "args": "none", "ignoreRestSiblings": false, "caughtErrors": "all", "caughtErrorsIgnorePattern": "^_" }], "curly": ["error", "all"], - "prefer-const": ["error"] + "prefer-const": ["error", { + "destructuring": "all", + "ignoreReadBeforeAssign": true + }] }, "globals": { "owl": "readonly",