Skip to content

Latest commit

 

History

History
21 lines (14 loc) · 593 Bytes

File metadata and controls

21 lines (14 loc) · 593 Bytes

Disallow usage of page.$eval and page.$$eval (no-eval)

Rule Details

Examples of incorrect code for this rule:

const searchValue = await page.$eval('#search', (el) => el.value)

const divCounts = await page.$$eval('div', (divs, min) => divs.length >= min, 10)

await page.$eval('#search', (el) => el.value)
await page.$$eval('#search', (el) => el.value)

Example of correct code for this rule:

await page.locator('button').evaluate((node) => node.innerText)
await page.locator('div').evaluateAll((divs, min) => divs.length >= min, 10)