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) <lpe@odoo.com>
48 lines
1.3 KiB
JSON
48 lines
1.3 KiB
JSON
{
|
|
"extends": ["eslint:recommended", "plugin:prettier/recommended"],
|
|
"parserOptions": {
|
|
"sourceType": "module",
|
|
"ecmaVersion": 2019
|
|
},
|
|
"env": {
|
|
"browser": true,
|
|
"es2017": true,
|
|
"qunit": true
|
|
},
|
|
"rules": {
|
|
"prettier/prettier": "error",
|
|
"no-undef": "error",
|
|
"no-restricted-globals": ["error", "event", "self"],
|
|
"no-const-assign": ["error"],
|
|
"no-debugger": ["error"],
|
|
"no-dupe-class-members": ["error"],
|
|
"no-unsafe-negation": ["error"],
|
|
"no-duplicate-imports": ["error"],
|
|
"valid-typeof": ["error"],
|
|
"no-unused-vars": ["error", { "vars": "all", "args": "none", "ignoreRestSiblings": false, "caughtErrors": "all", "caughtErrorsIgnorePattern": "^_" }],
|
|
"curly": ["error", "all"],
|
|
"prefer-const": ["error", {
|
|
"destructuring": "all",
|
|
"ignoreReadBeforeAssign": true
|
|
}]
|
|
},
|
|
"globals": {
|
|
"owl": "readonly",
|
|
"odoo": "readonly",
|
|
"$": "readonly",
|
|
"jQuery": "readonly",
|
|
"_": "readonly",
|
|
"Chart": "readonly",
|
|
"fuzzy": "readonly",
|
|
"QWeb2": "readonly",
|
|
"Popover": "readonly",
|
|
"StackTrace": "readonly",
|
|
"QUnit": "readonly",
|
|
"luxon": "readonly",
|
|
"moment": "readonly",
|
|
"py": "readonly",
|
|
"ClipboardJS": "readonly",
|
|
"globalThis": "readonly"
|
|
}
|
|
}
|