Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
mmkal opened this issue Apr 3, 2024 · 0 comments · Fixed by #2334
Closed

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

mmkal opened this issue Apr 3, 2024 · 0 comments · Fixed by #2334

Comments

@mmkal
Copy link
Contributor

mmkal commented Apr 3, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant