sindresorhus / eslint-plugin-unicorn

More than 100 powerful ESLint rules

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

prefer-dom-node-dataset: bad fix for playwright

mmkal opened this issue · comments

Playwright's Locator class has a getAttribute method. Using this with a data-foo attribute gets autofixed to .dataset.foo which is wrong.

rule: unicorn/prefer-dom-node-dataset

await page.locator('text=Hello').getAttribute('data-foo')

Suggestion: find some smart way of detecting when it's a playwright locator (hard) and/or downgrade the fix to a suggestion (easy). Either way I don't think it's good for the lint plugin to transform correct code into incorrect code automatically.