Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ export default [
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'typeLike',
format: ['PascalCase'],
leadingUnderscore: 'forbid',
trailingUnderscore: 'forbid',
},
{
selector: 'accessor',
format: ['camelCase', 'PascalCase'],
Expand All @@ -127,12 +133,6 @@ export default [
leadingUnderscore: 'forbid',
trailingUnderscore: 'forbid',
},
{
selector: 'interface',
format: ['PascalCase'],
leadingUnderscore: 'forbid',
trailingUnderscore: 'forbid',
},
{
selector: 'variable',
format: ['camelCase', 'UPPER_CASE'],
Expand Down
41 changes: 41 additions & 0 deletions src/script/Background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,47 @@ import Translation from '@APF/Translation';
import WebConfig from '@APF/WebConfig';
import { formatNumber } from '@APF/lib/helper';
import Logger from '@APF/lib/Logger';
import type { Summary } from '@APF/WebFilter';

export interface BackgroundData {
disabledTab?: boolean;
}

export interface BackgroundStorage {
tabs?: {
[tabId: number]: TabStorageOptions;
};
}

export interface Message {
advanced?: boolean;
backgroundData?: boolean;
counter?: number;
deep?: boolean;
destination: string;
disabled?: boolean;
enableTab?: boolean;
forceUpdate?: boolean;
getStatus?: boolean;
globalVariable?: string;
iframe?: boolean;
popup?: boolean;
source: string;
status?: number;
summary?: Summary;
tabId?: number;
updateContextMenus?: boolean;
urlUpdate?: string;
}

export interface TabStorageOptions {
counters?: { number?: number };
disabled?: boolean;
disabledOnce?: number; // NOT_SET: 0, DISABLED: 1, WILL_DISABLE: 2
id?: number;
registeredAt?: number;
status?: number;
}

export default class Background {
//#region Class reference helpers
Expand Down
2 changes: 2 additions & 0 deletions src/script/BookmarkletFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import Domain from '@APF/Domain';
import Filter from '@APF/lib/Filter';
import Page from '@APF/Page';
import WebConfig from '@APF/WebConfig';
import type { BackgroundData, Message } from '@APF/Background';
import type { Statistics } from '@APF/WebFilter';

export default class BookmarkletFilter extends Filter {
buildMessage: (destination: string, data?: object) => Message; // Bookmarklet: Not used - Needed to match signature of WebFilter
Expand Down
10 changes: 9 additions & 1 deletion src/script/DataMigration.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import Constants from '@APF/lib/Constants';
import { booleanToNumber, getVersion, isVersionOlder } from '@APF/lib/helper';
import WebConfig from '@APF/WebConfig';
import type { WordOptions } from '@APF/lib/Word';

export interface Migration {
async?: boolean;
name: string;
runOnImport: boolean;
version: string;
}

export default class DataMigration {
cfg: WebConfig;
Expand Down Expand Up @@ -91,7 +99,7 @@ export default class DataMigration {

// This will look at the version (from before the update) and perform data migrations if necessary
async byVersion(oldVersion: string) {
const version = getVersion(oldVersion) as Version;
const version = getVersion(oldVersion);
let migrated = false;
for (const migration of (this.constructor as typeof DataMigration).migrations) {
if (isVersionOlder(version, getVersion(migration.version))) {
Expand Down
10 changes: 10 additions & 0 deletions src/script/Domain.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
import Constants from '@APF/lib/Constants';
import type WebConfig from '@APF/WebConfig';

export interface DomainCfg {
adv?: boolean;
deep?: boolean;
disabled?: boolean;
enabled?: boolean;
framesOff?: boolean;
framesOn?: boolean;
wordlist?: number;
}

export default class Domain {
advanced: boolean;
cfg: DomainCfg;
Expand Down
Loading