chore:: lint

This commit is contained in:
karishmas6
2024-06-06 05:14:18 +05:30
parent cded3fead6
commit bdc37a188f

View File

@@ -38,7 +38,8 @@ export const getRect = async (page: Page, coordinates: Coordinates) => {
left: rectangle.left,
};
}
}},
}
},
{ x: coordinates.x, y: coordinates.y },
);
return rect;
@@ -65,7 +66,7 @@ export const getElementInformation = async (
const elementInfo = await page.evaluate(
async ({ x, y }) => {
const el = document.elementFromPoint(x, y) as HTMLElement;
if ( el ) {
if (el) {
const { parentElement } = el;
// Match the logic in recorder.ts for link clicks
const element = parentElement?.tagName === 'A' ? parentElement : el;
@@ -100,7 +101,7 @@ export const getElementInformation = async (
*/
export const getSelectors = async (page: Page, coordinates: Coordinates) => {
try {
const selectors : any = await page.evaluate(async ({ x, y }) => {
const selectors: any = await page.evaluate(async ({ x, y }) => {
// version @medv/finder
// https://github.com/antonmedv/finder/blob/master/finder.ts
@@ -558,7 +559,7 @@ export const getSelectors = async (page: Page, coordinates: Coordinates) => {
const genSelectors = (element: HTMLElement | null) =>{
const genSelectors = (element: HTMLElement | null) => {
if (element == null) {
return null;
}
@@ -639,7 +640,7 @@ export const getSelectors = async (page: Page, coordinates: Coordinates) => {
return genAttributeSet(element, attributes).size > 0;
}
// Gets all attributes that aren't null and empty
// Gets all attributes that aren't null and empty
function genValidAttributeFilter(element: HTMLElement, attributes: string[]) {
const attrSet = genAttributeSet(element, attributes);
@@ -655,12 +656,12 @@ export const getSelectors = async (page: Page, coordinates: Coordinates) => {
attr: genValidAttributeFilter(element, attributes),
})
: null;
} catch (e) {}
} catch (e) { }
return selector;
}
// isCharacterNumber
// isCharacterNumber
function isCharacterNumber(char: string) {
return char.length === 1 && char.match(/[0-9]/);
}
@@ -711,11 +712,11 @@ export const selectorAlreadyInWorkflow = (selector: string, workflow: Workflow)
* @param page The page to use for the validation.
* @category WorkflowManagement
*/
export const isRuleOvershadowing = async(selectors: string[], page:Page): Promise<boolean> => {
for (const selector of selectors){
export const isRuleOvershadowing = async (selectors: string[], page: Page): Promise<boolean> => {
for (const selector of selectors) {
const areElsVisible = await page.$$eval(selector,
(elems) => {
const isVisible = ( elem: HTMLElement | SVGElement ) => {
const isVisible = (elem: HTMLElement | SVGElement) => {
if (elem instanceof HTMLElement) {
return !!(elem.offsetWidth
|| elem.offsetHeight
@@ -735,7 +736,7 @@ export const isRuleOvershadowing = async(selectors: string[], page:Page): Promis
return false
}
if (areElsVisible.includes(false)){
if (areElsVisible.includes(false)) {
return false;
}
}