Thanks to visit codestin.com
Credit goes to github.com

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
1 change: 0 additions & 1 deletion extension/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ export default tseslint.config(
"unicorn/no-unreadable-new-expression": "warn",
"unicorn/require-array-sort-compare": "warn",
"unicorn/prefer-uint8array-base64": "warn",
"unicorn/no-declarations-before-early-exit": "warn",
// no-global-object-property-assignment stays at its recommended `error`
// for production code; it's disabled only for tests (which legitimately
// assign globals to set up mocks) in the test-files block below.
Expand Down
8 changes: 4 additions & 4 deletions extension/scripts/load-default-overrides.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,6 @@
): z.core.$ZodIssue[] {
const out: z.core.$ZodIssue[] = [];
for (const issue of issues) {
const prefixedIssue =
prefix.length === 0
? issue
: { ...issue, path: [...prefix, ...issue.path] };
if (
issue.code === "invalid_union" &&
"errors" in issue &&
Expand All @@ -199,6 +195,10 @@
continue;
}
}
const prefixedIssue =
prefix.length === 0
? issue
: { ...issue, path: [...prefix, ...issue.path] };
out.push(prefixedIssue);
}
return out;
Expand Down Expand Up @@ -241,7 +241,7 @@
switch (key) {
case "optionsButton": {
out.optionsButton = value as boolean;
break;

Check warning on line 244 in extension/scripts/load-default-overrides.ts

View workflow job for this annotation

GitHub Actions / Extension (lint / typecheck / test / build)

Move this nested loop or switch into a function instead of using `break` here
}
case "runOnInactiveTabs": {
out.runOnInactiveTabs = value as boolean;
Expand Down
19 changes: 10 additions & 9 deletions extension/src/lib/checkout-checkbox-defense-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,6 @@ export function installCheckoutCheckboxDefense(this: Window): void {
}
defenseWindow[FLAG] = true;

// Mirror of CHECKOUT_CHECKBOX_CLEARED_ATTR from lib/dom-markers.ts.
// Hard-coded because this function runs in the page world with no
// module imports; the isolated-world rule and the markers registry
// share the same literal, asserted by a unit test. The lint rule that
// bans inline `data-abs-*` literals exists to keep the registry the
// single source of truth — this is the one principled exception.
// eslint-disable-next-line no-restricted-syntax
const CLEARED_ATTR = "data-abs-cleared";

// Mirror of the URLPattern set in lib/checkout-url.ts as a single
// anchored regex. `/cart`, `/cart/`, `/cart/sub` match; `/cartx`,
// `/products/cart-bag`, `/orders` do not. Asserted against the rule's
Expand Down Expand Up @@ -87,6 +78,16 @@ export function installCheckoutCheckboxDefense(this: Window): void {
// disable the defense rather than block the page.
return;
}

// Mirror of CHECKOUT_CHECKBOX_CLEARED_ATTR from lib/dom-markers.ts.
// Hard-coded because this function runs in the page world with no
// module imports; the isolated-world rule and the markers registry
// share the same literal, asserted by a unit test. The lint rule that
// bans inline `data-abs-*` literals exists to keep the registry the
// single source of truth — this is the one principled exception.
// eslint-disable-next-line no-restricted-syntax
const CLEARED_ATTR = "data-abs-cleared";

const nativeSetter = descriptor.set;
const nativeGetter = descriptor.get;

Expand Down
8 changes: 0 additions & 8 deletions extension/src/lib/yielding-text-walk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,6 @@ export function walkTextNodesChunked(
shouldSkipParent ? { minLength, shouldSkipParent } : { minLength },
);

if (signal?.aborted) {
return;
}

let index = 0;

function runFinalize(): void {
Expand Down Expand Up @@ -197,10 +193,6 @@ export function walkTextNodeGroupsChunked(
shouldSkipParent ? { minLength, shouldSkipParent } : { minLength },
);

if (signal?.aborted) {
return;
}

let index = 0;

function runFinalize(): void {
Expand Down
3 changes: 3 additions & 0 deletions extension/src/popup/Popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ export function Popup() {
});
}, []);

// Hooks must run unconditionally before any early return, so this cannot
// move below the loading guard (would violate react-hooks/rules-of-hooks).
// eslint-disable-next-line unicorn/no-declarations-before-early-exit -- React hook ordering
const trace = useTabDebugTrace(debugTraceEnabled ? activeTabId : null);

if (enforcementEnabled === null || debugTraceEnabled === null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ describe("matchFeePhrase precision (property)", () => {
fc.constantFrom(...PHRASES),
fc.stringMatching(/^[A-Za-z][A-Za-z ]{0,30}$/),
(phrase, suffix) => {
const text = `${phrase} ${suffix}`;
// Guard the rare case where fast-check picks a suffix that
// happens to start with another phrase from the set — the
// resulting concatenation could still legitimately match.
if (PHRASES.has(`${phrase} ${suffix}`.toLowerCase())) {
return;
}
const text = `${phrase} ${suffix}`;
expect(matchFeePhrase(text)).toBeNull();
},
),
Expand Down
2 changes: 1 addition & 1 deletion extension/src/rules/hidden-text-strip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,10 @@ function hasStructuralSrOnlyPattern(style: CSSStyleDeclaration): boolean {
return false;
}
const width = parsePixelLength(style.width);
const height = parsePixelLength(style.height);
if (width === null || width > SR_ONLY_MAX_SIZE_PX) {
return false;
}
const height = parsePixelLength(style.height);
if (height === null || height > SR_ONLY_MAX_SIZE_PX) {
return false;
}
Expand Down
Loading