unicorn/dom-node-dataset
eslint-plugin-unicorn
Safe autofix
eslint.config.js
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/dom-node-dataset": "error",
},
},
];const unicorn = element.getAttribute('data-unicorn');element.setAttribute('data-unicorn', '馃');element.removeAttribute('data-unicorn');const {unicorn} = element.dataset;element.dataset.unicorn = '馃';delete element.dataset.unicorn;Examples from the ESLint documentation.
unicorn/dom-node-dataset
eslint-plugin-unicorn
import unicorn from "eslint-plugin-unicorn";
export default [
{
plugins: { unicorn },
rules: {
"unicorn/dom-node-dataset": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Enforce consistent optional chaining for same-base member access.
Add expiration conditions to TODO comments.
Enforce consistent decorator position on exported classes.
Disallow .fill() after Array.from({length: 鈥).
Disallow useless concatenation of literals.
Disallow asynchronous callbacks in synchronous iterator helpers.