From b34429b984c616e152ffd55677812b1cdffab1d2 Mon Sep 17 00:00:00 2001 From: Samuel Degueldre Date: Wed, 11 Jan 2023 14:20:22 +0000 Subject: [PATCH] [IMP] web, test_lint: forbid private class fields We don't want private class fields to be used in Odoo because they limit how classes can be patched from the outside, extensibility is one of Odoo's biggest strength and we do not want to limit it. This commit adds the `no-restricted-syntax` rule to eslint configs with a rule that forbids private class fields. closes odoo/odoo#109664 Signed-off-by: Simon Genin (ges@odoo) --- addons/web/tooling/_eslintrc.json | 1 + odoo/addons/test_lint/tests/eslintrc | 1 + 2 files changed, 2 insertions(+) diff --git a/addons/web/tooling/_eslintrc.json b/addons/web/tooling/_eslintrc.json index 308fb6eb1c8..69c1b8c27f5 100644 --- a/addons/web/tooling/_eslintrc.json +++ b/addons/web/tooling/_eslintrc.json @@ -30,6 +30,7 @@ "valid-typeof": ["error"], "no-unused-vars": ["error", { "vars": "all", "args": "none", "ignoreRestSiblings": false, "caughtErrors": "all" }], "curly": ["error", "all"], + "no-restricted-syntax": ["error", "PrivateIdentifier"], "prefer-const": ["error", { "destructuring": "all", "ignoreReadBeforeAssign": true diff --git a/odoo/addons/test_lint/tests/eslintrc b/odoo/addons/test_lint/tests/eslintrc index fa659db7f0d..168bc1f0918 100644 --- a/odoo/addons/test_lint/tests/eslintrc +++ b/odoo/addons/test_lint/tests/eslintrc @@ -19,6 +19,7 @@ "no-unsafe-negation": ["error"], "no-duplicate-imports": ["error"], "valid-typeof": ["error"], + "no-restricted-syntax": ["error", "PrivateIdentifier"], "no-unused-vars": ["error", { "vars": "all", "args": "none", "ignoreRestSiblings": false, "caughtErrors": "all" }] }, "globals": {