Skip to content

Commit

Permalink
Merge branch 'feature/AG-40132' into feature/AG-40132-enable-max-len
Browse files Browse the repository at this point in the history
  • Loading branch information
Artem Manushenkov committed Feb 21, 2025
2 parents c535f45 + 006c3e0 commit 72e050e
Show file tree
Hide file tree
Showing 135 changed files with 312 additions and 303 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ module.exports = {
'@typescript-eslint/indent': 'off',
'@typescript-eslint/no-shadow': 'off',
'@typescript-eslint/dot-notation': 'off',
'@typescript-eslint/consistent-type-imports': [
'error', {
fixStyle: 'inline-type-imports',
},
],
'import/no-extraneous-dependencies': 'off',
'import/no-cycle': 'off',
'import/prefer-default-export': 'off',
Expand Down Expand Up @@ -171,6 +176,7 @@ module.exports = {
'wrap-iife': 'off',
'func-names': 'off',
'prefer-destructuring': 'off',
'brace-style': ['error', '1tbs', { 'allowSingleLine': false }],
'consistent-return': 'off',
'curly': ['error', 'all'],
'dot-notation': 'off',
Expand Down
8 changes: 4 additions & 4 deletions Extension/src/background/api/filtering-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
* You should have received a copy of the GNU General Public License
* along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
*/
import { Tabs } from 'webextension-polyfill';
import { type Tabs } from 'webextension-polyfill';

import { RuleGenerator } from '@adguard/agtree/generator';
import { RULE_INDEX_NONE } from '@adguard/tsurlfilter';

import {
BACKGROUND_TAB_ID,
ContentType,
CookieEvent,
type ContentType,
type CookieEvent,
isExtensionUrl,
StealthActionEvent,
type StealthActionEvent,
getDomain,
getRuleSourceText,
getRuleSourceIndex,
Expand Down
16 changes: 8 additions & 8 deletions Extension/src/background/api/filters/categories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ import {
customFilterMetadataStorage,
} from '../../storages';
import {
GroupMetadata,
TagMetadata,
RegularFilterMetadata,
GroupStateData,
FilterStateData,
FilterVersionData,
CustomFilterMetadata,
type GroupMetadata,
type TagMetadata,
type RegularFilterMetadata,
type GroupStateData,
type FilterStateData,
type FilterVersionData,
type CustomFilterMetadata,
} from '../../schema';
import { logger } from '../../../common/logger';
import { CustomFilterHelper } from '../../../common/custom-filter-helper';

import { CommonFilterApi } from './common';
import { FilterMetadata, FiltersApi } from './main';
import { type FilterMetadata, FiltersApi } from './main';
import { FilterUpdateApi } from './update';

/**
Expand Down
4 changes: 2 additions & 2 deletions Extension/src/background/api/filters/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import browser from 'webextension-polyfill';
import { BrowserUtils } from '../../utils/browser-utils';
import { logger } from '../../../common/logger';
import { UserAgent } from '../../../common/user-agent';
import { SettingOption, RegularFilterMetadata } from '../../schema';
import { SettingOption, type RegularFilterMetadata } from '../../schema';
import { AntiBannerFiltersId } from '../../../common/constants';
import {
metadataStorage,
Expand All @@ -34,7 +34,7 @@ import { network } from '../network';

import { CustomFilterApi } from './custom';
import { FiltersApi } from './main';
import type { FilterUpdateOptions } from './update';
import { type FilterUpdateOptions } from './update';
import { FilterParser } from './parser';

/**
Expand Down
8 changes: 4 additions & 4 deletions Extension/src/background/api/filters/custom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
*/
import MD5 from 'crypto-js/md5';

import { DownloadResult } from '@adguard/filters-downloader/browser';
import { type DownloadResult } from '@adguard/filters-downloader/browser';

import { BrowserUtils } from '../../utils/browser-utils';
import { AntibannerGroupsId, CUSTOM_FILTERS_START_ID } from '../../../common/constants';
import { logger } from '../../../common/logger';
import { CustomFilterMetadata, customFilterMetadataStorageDataValidator } from '../../schema';
import { type CustomFilterMetadata, customFilterMetadataStorageDataValidator } from '../../schema';
import { customFilterMetadataStorage } from '../../storages/custom-filter-metadata';
import { filterStateStorage } from '../../storages/filter-state';
import { groupStateStorage } from '../../storages/group-state';
Expand All @@ -33,8 +33,8 @@ import { type Network } from '../network/main';
import { CustomFilterHelper } from '../../../common/custom-filter-helper';
import { createPromiseWithTimeout } from '../../utils/timeouts';

import type { FilterUpdateOptions } from './update';
import { FilterParsedData, FilterParser } from './parser';
import { type FilterUpdateOptions } from './update';
import { type FilterParsedData, FilterParser } from './parser';
import { type FilterMetadata } from './main';
import { CustomFilterLoader } from './custom/loader';

Expand Down
4 changes: 2 additions & 2 deletions Extension/src/background/api/filters/hit-stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import { logger } from '../../../common/logger';
import { hitStatsStorageDataValidator } from '../../schema';
import { filterVersionStorage, hitStatsStorage } from '../../storages';
import {
FilterHitStats,
FiltersHitStats,
type FilterHitStats,
type FiltersHitStats,
network,
} from '../network';
import { getErrorMessage } from '../../../common/error';
Expand Down
6 changes: 3 additions & 3 deletions Extension/src/background/api/filters/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
import { filterVersionStorage, settingsStorage } from '../../storages';
import {
SettingOption,
RegularFilterMetadata,
CustomFilterMetadata,
type RegularFilterMetadata,
type CustomFilterMetadata,
} from '../../schema';
import { DEFAULT_FILTERS_UPDATE_PERIOD } from '../../../common/settings';
import { logger } from '../../../common/logger';
import { FiltersUpdateTime } from '../../../common/constants';
import { engine } from '../../engine';
import { getErrorMessage } from '../../../common/error';

import { FilterMetadata, FiltersApi } from './main';
import { type FilterMetadata, FiltersApi } from './main';
import { CustomFilterApi } from './custom';
import { CommonFilterApi } from './common';

Expand Down
4 changes: 2 additions & 2 deletions Extension/src/background/api/filters/userrules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
* You should have received a copy of the GNU General Public License
* along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
*/
import { AnyRule, InputByteBuffer } from '@adguard/agtree';
import { type AnyRule, InputByteBuffer } from '@adguard/agtree';
import { RuleParser } from '@adguard/agtree/parser';
import { RuleDeserializer } from '@adguard/agtree/deserializer';
import {
FilterListPreprocessor,
PreprocessedFilterList,
type PreprocessedFilterList,
RuleSyntaxUtils,
} from '@adguard/tsurlfilter';

Expand Down
2 changes: 1 addition & 1 deletion Extension/src/background/api/install/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
} from '../../../common/constants';
import { defaultSettings } from '../../../common/settings';
import { browserStorage } from '../../storages';
import { RunInfo } from '../../utils';
import { type RunInfo } from '../../utils';

/**
* The Install API should set the base version of the schema and application,
Expand Down
2 changes: 1 addition & 1 deletion Extension/src/background/api/network/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import browser from 'webextension-polyfill';
import { FiltersApi } from '@adguard/tswebextension/mv3';
import {
FiltersDownloader,
DefinedExpressions,
type DefinedExpressions,
type DownloadResult,
} from '@adguard/filters-downloader/browser';
import { getRuleSetPath } from '@adguard/tsurlfilter/es/declarative-converter-utils';
Expand Down
2 changes: 1 addition & 1 deletion Extension/src/background/api/safebrowsing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { SAFEBROWSING_OUTPUT } from '../../../../constants';
import {
type ExtensionXMLHttpRequest,
network,
ResponseLikeXMLHttpRequest,
type ResponseLikeXMLHttpRequest,
} from './network/main';

/**
Expand Down
16 changes: 8 additions & 8 deletions Extension/src/background/api/settings/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,25 @@ import { type SettingsConfig as SettingsConfigMV2 } from '@adguard/tswebextensio
import { logger } from '../../../common/logger';
import { type AppearanceTheme, defaultSettings } from '../../../common/settings';
import {
AllowlistConfig,
type AllowlistConfig,
AllowlistOption,
configValidator,
ExtensionSpecificSettingsConfig,
type ExtensionSpecificSettingsConfig,
ExtensionSpecificSettingsOption,
FiltersConfig,
type FiltersConfig,
FiltersOption,
GeneralSettingsConfig,
type GeneralSettingsConfig,
GeneralSettingsOption,
RootOption,
PROTOCOL_VERSION,
StealthConfig,
type StealthConfig,
StealthOption,
UserFilterConfig,
type UserFilterConfig,
UserFilterOption,
SettingOption,
Settings,
type Settings,
settingsValidator,
Config,
type Config,
} from '../../schema';
import {
filterStateStorage,
Expand Down
4 changes: 2 additions & 2 deletions Extension/src/background/api/ui/context-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
*/
import browser, { Menus } from 'webextension-polyfill';
import browser, { type Menus } from 'webextension-polyfill';
import { nanoid } from 'nanoid';
import { throttle } from 'lodash-es';

Expand All @@ -29,7 +29,7 @@ import { SettingOption } from '../../schema';
import { SettingsApi } from '../settings';
import { OPTIONS_PAGE } from '../../../common/constants';

import { FrameData } from './frames';
import { type FrameData } from './frames';

export type AddMenuItemOptions = Menus.CreateCreatePropertiesType & {
messageArgs?: { [key: string]: unknown },
Expand Down
9 changes: 6 additions & 3 deletions Extension/src/background/api/ui/icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@ import browser from 'webextension-polyfill';

import { RulesLimitsService } from 'rules-limits-service';

import { settingsStorage } from '../../storages';
import {
settingsStorage,
type IconData,
type IconVariants,
} from '../../storages';
import { SettingOption } from '../../schema';
import { getIconImageData } from '../../../common/api/extension';
import type { IconData, IconVariants } from '../../storages';
import { logger } from '../../../common/logger';

import { FrameData } from './frames';
import { type FrameData } from './frames';
import { promoNotificationApi } from './promo-notification';
import { browserAction } from './browser-action';

Expand Down
2 changes: 1 addition & 1 deletion Extension/src/background/api/ui/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { TabsApi } from '../../../common/api/extension';
import { logger } from '../../../common/logger';

import { ContextMenuApi } from './context-menu';
import { FrameData, FramesApi } from './frames';
import { type FrameData, FramesApi } from './frames';
import { iconsApi } from './icons';

/**
Expand Down
2 changes: 1 addition & 1 deletion Extension/src/background/api/ui/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
Forward,
ForwardAction,
ForwardFrom,
ForwardParams,
type ForwardParams,
} from '../../../common/forward';
import { UrlUtils } from '../../utils/url';
import {
Expand Down
2 changes: 1 addition & 1 deletion Extension/src/background/api/ui/promo-notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
notificationStorage,
browserStorage,
} from '../../storages';
import { NotificationTextRecord } from '../../schema';
import { type NotificationTextRecord } from '../../schema';
import { LAST_NOTIFICATION_TIME_KEY, VIEWED_NOTIFICATIONS_KEY } from '../../../common/constants';
import { I18n } from '../../utils';

Expand Down
2 changes: 1 addition & 1 deletion Extension/src/background/api/ui/toasts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { BrowserUtils } from '../../utils/browser-utils';
import { translator } from '../../../common/translators/translator';
import { notificationTextRecordValidator } from '../../schema';
import { TabsApi } from '../../../common/api/extension';
import { FilterMetadata } from '../filters';
import { type FilterMetadata } from '../filters';
import { sendTabMessage, MessageType } from '../../../common/messages';
import {
Forward,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
import browser from 'webextension-polyfill';

import { ExtendedStorageInterface } from '../../../../common/storage';
import { type ExtendedStorageInterface } from '../../../../common/storage';

/**
* Wrapper for browser.storage.local with dev-friendly interface.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { nanoid } from 'nanoid';
import * as idb from 'idb';
import { isObject } from 'lodash-es';

import { ExtendedStorageInterface } from '../../../../common/storage';
import { type ExtendedStorageInterface } from '../../../../common/storage';

import { BrowserStorage } from './old-browser-storage-v1';
import { IDBStorage } from './old-idb-storage-v1';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as idb from 'idb';

import { logger } from '../../../../common/logger';
import { getErrorMessage } from '../../../../common/error';
import { ExtendedStorageInterface } from '../../../../common/storage';
import { type ExtendedStorageInterface } from '../../../../common/storage';

const DEFAULT_STORE_NAME = 'defaultStore';
const DEFAULT_IDB_NAME = 'adguardIDB';
Expand Down
2 changes: 1 addition & 1 deletion Extension/src/background/api/update/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import {
SchemaPreprocessor,
SettingOption,
} from '../../schema';
import type { RunInfo } from '../../utils/run-info';
import { type RunInfo } from '../../utils/run-info';
import { IDBUtils } from '../../utils/indexed-db';
import { defaultSettings } from '../../../common/settings';
import { InstallApi } from '../install';
Expand Down
2 changes: 1 addition & 1 deletion Extension/src/background/connection-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
*/
import browser, { Runtime } from 'webextension-polyfill';
import browser, { type Runtime } from 'webextension-polyfill';

import { KEEP_ALIVE_PORT_NAME } from '../common/constants';
import {
Expand Down
2 changes: 1 addition & 1 deletion Extension/src/background/engine/engine-mv2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { debounce } from 'lodash-es';
// Because this file is already MV2 replacement module, we can import directly
// from basic MV2 tswebextension without using aliases.
import {
ConfigurationMV2,
type ConfigurationMV2,
MESSAGE_HANDLER_NAME,
createTsWebExtension,
type Message as EngineMessage,
Expand Down
2 changes: 1 addition & 1 deletion Extension/src/background/engine/engine-mv3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { debounce } from 'lodash-es';
// from mv3 tswebextension without using aliases.
import {
MESSAGE_HANDLER_NAME,
Configuration,
type Configuration,
TsWebExtension,
type MessageHandler,
type Message as EngineMessage,
Expand Down
2 changes: 1 addition & 1 deletion Extension/src/background/events/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
*/
import { SettingOption, Settings } from '../schema';
import { type SettingOption, type Settings } from '../schema';

export type SettingsListener<T extends keyof Settings> = (value: Settings[T]) => void | Promise<void>;

Expand Down
4 changes: 2 additions & 2 deletions Extension/src/background/message-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
* You should have received a copy of the GNU General Public License
* along with AdGuard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
*/
import { Runtime } from 'webextension-polyfill';
import { type Runtime } from 'webextension-polyfill';

import { Engine, type EngineMessage } from 'engine';

import {
Message,
type Message,
APP_MESSAGE_HANDLER_NAME,
MessageHandler,
} from '../common/messages';
Expand Down
6 changes: 3 additions & 3 deletions Extension/src/background/services/allowlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
import { logger } from '../../common/logger';
import {
MessageType,
SaveAllowlistDomainsMessage,
AddAllowlistDomainMessage,
RemoveAllowlistDomainMessage,
type SaveAllowlistDomainsMessage,
type AddAllowlistDomainMessage,
type RemoveAllowlistDomainMessage,
} from '../../common/messages';
import { messageHandler } from '../message-handler';
import { engine } from '../engine';
Expand Down
Loading

0 comments on commit 72e050e

Please sign in to comment.