prefer-dom-node-dataset: bad fix for playwright
mmkal opened this issue · comments
Misha Kaletsky commented
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.