fix: react-doctor label-has-associated-control (-15, nested-interactive -1)
Add htmlFor/id pairs to label/input pairs across ~24 files. Convert section-header labels (Role/Permissions/Visibility/Environment/ Send via/Quick messages/Campaign Type/When to Send/Preview) to <p>. Convert clickable divs to buttons (AbandonedCartDashboard → native dialog). Hoist regex patterns out of loops in ai-import.ts.
This commit is contained in:
@@ -259,10 +259,12 @@ function fallbackParse(
|
||||
};
|
||||
|
||||
const escapeRegex = (s: string) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||
const keywordPatterns: Record<string, RegExp> = {};
|
||||
for (const [etype, kws] of Object.entries(keywordMaps)) {
|
||||
keywordPatterns[etype] = new RegExp(kws.map(escapeRegex).join("|"));
|
||||
}
|
||||
const keywordPatterns: Record<string, RegExp> = {
|
||||
products: new RegExp(productKeywords.map(escapeRegex).join("|")),
|
||||
orders: new RegExp(orderKeywords.map(escapeRegex).join("|")),
|
||||
contacts: new RegExp(contactKeywords.map(escapeRegex).join("|")),
|
||||
stops: new RegExp(stopKeywords.map(escapeRegex).join("|")),
|
||||
};
|
||||
|
||||
for (const header of h) {
|
||||
for (const [etype, pattern] of Object.entries(keywordPatterns)) {
|
||||
@@ -314,10 +316,11 @@ function fallbackParse(
|
||||
notes: ["notes", "note", "special_instructions", "comments", "memo", "instruction"],
|
||||
};
|
||||
|
||||
const semanticPatterns: Record<string, RegExp> = {};
|
||||
for (const [field, kws] of Object.entries(semanticMap)) {
|
||||
semanticPatterns[field] = new RegExp(kws.map(escapeRegex).join("|"));
|
||||
}
|
||||
const buildPattern = (kws: readonly string[]) =>
|
||||
new RegExp(kws.map(escapeRegex).join("|"));
|
||||
const semanticPatterns: Record<string, RegExp> = Object.fromEntries(
|
||||
Object.entries(semanticMap).map(([field, kws]) => [field, buildPattern(kws)]),
|
||||
);
|
||||
|
||||
for (let i = 0; i < h.length; i++) {
|
||||
const header = h[i];
|
||||
|
||||
Reference in New Issue
Block a user