[IMP] test_lint, *: activate no-duplicate-imports eslint rule
*: base_automation, hr, mail, web, web_tour, website_payment Previously, some modules were imported twice, this increases duplication and can make refactoring more difficult. This commit enables the no-duplicate-imports eslint rule and fixes offending modules to remove duplicates. closes odoo/odoo#84530 Related: odoo/enterprise#24319 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
@@ -13,10 +13,8 @@ import { makeFakeRPCService, makeFakeLocalizationService } from "@web/../tests/h
|
||||
import { RPCError } from "@web/core/network/rpc_service";
|
||||
|
||||
import { BaseAutomationErrorDialog } from "../src/js/base_automation_error_dialog";
|
||||
import { patchWithCleanup } from "@web/../tests/helpers/utils";
|
||||
import { patchWithCleanup,getFixture, mount, nextTick } from "@web/../tests/helpers/utils";
|
||||
import { DialogContainer } from "@web/core/dialog/dialog_container";
|
||||
import { getFixture, mount } from "@web/../tests/helpers/utils";
|
||||
import { nextTick } from "@web/../tests/helpers/utils";
|
||||
|
||||
const { onMounted } = owl;
|
||||
|
||||
|
||||
@@ -2,9 +2,13 @@
|
||||
|
||||
import fieldRegistry from 'web.field_registry';
|
||||
|
||||
import { Many2OneAvatarUser, KanbanMany2OneAvatarUser, KanbanMany2ManyAvatarUser, ListMany2ManyAvatarUser } from '@mail/js/m2x_avatar_user';
|
||||
import { Many2ManyAvatarUser } from '@mail/js/m2x_avatar_user';
|
||||
import { KanbanMany2ManyTagsAvatar, ListMany2ManyTagsAvatar } from 'web.relational_fields';
|
||||
import {
|
||||
Many2OneAvatarUser,
|
||||
KanbanMany2OneAvatarUser,
|
||||
KanbanMany2ManyAvatarUser,
|
||||
ListMany2ManyAvatarUser,
|
||||
Many2ManyAvatarUser,
|
||||
} from '@mail/js/m2x_avatar_user';
|
||||
|
||||
|
||||
// This module defines variants of the Many2OneAvatarUser and Many2ManyAvatarUser
|
||||
|
||||
@@ -6,8 +6,7 @@ import { MessagingService } from '@mail/services/messaging/messaging';
|
||||
import { SystrayService } from '@mail/services/systray_service/systray_service';
|
||||
import { DiscussWidget } from '@mail/widgets/discuss/discuss';
|
||||
|
||||
import { action_registry } from 'web.core';
|
||||
import { serviceRegistry } from 'web.core';
|
||||
import { serviceRegistry, action_registry } from 'web.core';
|
||||
|
||||
serviceRegistry.add('chat_window', ChatWindowService);
|
||||
serviceRegistry.add('dialog', DialogService);
|
||||
|
||||
@@ -5,10 +5,9 @@ import ActivityView from '@mail/js/views/activity/activity_view';
|
||||
import testUtils from 'web.test_utils';
|
||||
import domUtils from 'web.dom';
|
||||
|
||||
import { getFixture, legacyExtraNextTick, patchWithCleanup } from "@web/../tests/helpers/utils";
|
||||
import { getFixture, legacyExtraNextTick, patchWithCleanup, click } from "@web/../tests/helpers/utils";
|
||||
import { createWebClient, doAction } from "@web/../tests/webclient/helpers";
|
||||
import { session } from '@web/session';
|
||||
import { click } from "@web/../tests/helpers/utils";
|
||||
|
||||
let serverData;
|
||||
let target;
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { _lt } from "../l10n/translation";
|
||||
import { makeErrorFromResponse } from "@web/core/network/rpc_service";
|
||||
import { ConnectionLostError } from "@web/core/network/rpc_service";
|
||||
import { makeErrorFromResponse, ConnectionLostError } from "@web/core/network/rpc_service";
|
||||
import { browser } from "@web/core/browser/browser";
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -490,8 +489,8 @@ download._download = (options) => {
|
||||
const filename = header ? parse(header).parameters.filename : null;
|
||||
_download(xhr.response, filename, mimetype);
|
||||
return resolve(filename);
|
||||
|
||||
} else if (xhr.status === 502) { // If Odoo is behind another server (nginx)
|
||||
} else if (xhr.status === 502) {
|
||||
// If Odoo is behind another server (nginx)
|
||||
reject(new ConnectionLostError());
|
||||
} else {
|
||||
const decoder = new FileReader();
|
||||
@@ -502,18 +501,20 @@ download._download = (options) => {
|
||||
doc.body.children.length === 0 ? doc.body.childNodes : doc.body.children;
|
||||
|
||||
let error;
|
||||
try { // a Serialized python Error
|
||||
try {
|
||||
// a Serialized python Error
|
||||
const node = nodes[1] || nodes[0];
|
||||
error = JSON.parse(node.textContent);
|
||||
} catch (e) {
|
||||
error = {
|
||||
message: "Arbitrary Uncaught Python Exception",
|
||||
data: {
|
||||
debug: `${xhr.status}` + `\n` +
|
||||
`${nodes.length > 0 ? nodes[0].textContent : ""}
|
||||
${nodes.length > 1 ? nodes[1].textContent : ""}`
|
||||
debug:
|
||||
`${xhr.status}` +
|
||||
`\n` +
|
||||
`${nodes.length > 0 ? nodes[0].textContent : ""}
|
||||
${nodes.length > 1 ? nodes[1].textContent : ""}`,
|
||||
},
|
||||
|
||||
};
|
||||
}
|
||||
error = makeErrorFromResponse(error);
|
||||
|
||||
@@ -2,14 +2,13 @@
|
||||
|
||||
import ajax from 'web.ajax';
|
||||
import dom from 'web.dom';
|
||||
import env from 'web.public_env';
|
||||
import legacyEnv from 'web.public_env';
|
||||
import session from 'web.session';
|
||||
import utils from 'web.utils';
|
||||
import publicWidget from 'web.public.widget';
|
||||
import { registry } from '@web/core/registry';
|
||||
|
||||
import AbstractService from "web.AbstractService";
|
||||
import legacyEnv from "web.public_env";
|
||||
import lazyloader from "web.public.lazyloader";
|
||||
|
||||
import {
|
||||
@@ -68,7 +67,7 @@ export const PublicRoot = publicWidget.RootWidget.extend({
|
||||
*/
|
||||
init: function () {
|
||||
this._super.apply(this, arguments);
|
||||
this.env = env;
|
||||
this.env = legacyEnv;
|
||||
this.publicWidgets = [];
|
||||
},
|
||||
/**
|
||||
|
||||
@@ -5,8 +5,7 @@ import { DropdownItem } from "@web/core/dropdown/dropdown_item";
|
||||
import { ConfirmationDialog } from "@web/core/confirmation_dialog/confirmation_dialog";
|
||||
import { FACET_ICONS } from "../utils/misc";
|
||||
import { registry } from "@web/core/registry";
|
||||
import { useBus } from "@web/core/utils/hooks";
|
||||
import { useService } from "@web/core/utils/hooks";
|
||||
import { useBus, useService } from "@web/core/utils/hooks";
|
||||
|
||||
const { Component } = owl;
|
||||
const favoriteMenuRegistry = registry.category("favoriteMenu");
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { patchDate } from "@web/../tests/helpers/utils";
|
||||
import { patchDate, patchWithCleanup } from "@web/../tests/helpers/utils";
|
||||
import { makeWithSearch, setupControlPanelServiceRegistry } from "./helpers";
|
||||
import { patchWithCleanup } from "@web/../tests/helpers/utils";
|
||||
|
||||
const { Component, xml } = owl;
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import core from "web.core";
|
||||
import core, { _t } from "web.core";
|
||||
import session from "web.session";
|
||||
import { _t } from "web.core";
|
||||
import { browser, makeRAMLocalStorage } from "@web/core/browser/browser";
|
||||
import { patchWithCleanup } from "@web/../tests/helpers/utils";
|
||||
import { legacyProm } from "web.test_legacy";
|
||||
|
||||
@@ -9,9 +9,8 @@ import { uiService } from "@web/core/ui/ui_service";
|
||||
|
||||
import { click, getFixture, mount } from "@web/../tests/helpers/utils";
|
||||
import { makeTestEnv } from "@web/../tests/helpers/mock_env";
|
||||
import { makeFakeLocalizationService } from "@web/../tests/helpers/mock_services";
|
||||
import { makeFakeLocalizationService, fakeCommandService } from "@web/../tests/helpers/mock_services";
|
||||
import { DebugMenuParent } from "@web/../tests/core/debug/debug_manager_tests";
|
||||
import { fakeCommandService } from "@web/../tests/helpers/mock_services";
|
||||
|
||||
const debugRegistry = registry.category("debug");
|
||||
let target;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import core from 'web.core';
|
||||
import {_t} from 'web.core';
|
||||
import core, { _t } from 'web.core';
|
||||
import checkoutForm from 'payment.checkout_form';
|
||||
|
||||
checkoutForm.include({
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
"no-debugger": ["error"],
|
||||
"no-dupe-class-members": ["error"],
|
||||
"no-unsafe-negation": ["error"],
|
||||
"no-duplicate-imports": ["error"],
|
||||
"valid-typeof": ["error"]
|
||||
},
|
||||
"globals": {
|
||||
|
||||
Reference in New Issue
Block a user