Код: Выделить всё
'no-restricted-syntax': [
'error',
{
selector: 'JSXElement JSXAttribute JSXIdentifier[name="className"] + Literal[value="bg-red"]',
message: 'Do not set background colors directly.',
},
],
Код: Выделить всё
export function TestComponent() {
return Click me;
}
Код: Выделить всё
// On the attribute
JSXElement JSXAttribute[name="className"][value="bg-red"]
// removing the + Literal
JSXElement JSXAttribute JSXIdentifier[name="className"][value="bg-red"]
p>
Если поможет, вот проводник ESLint
Подробнее здесь: https://stackoverflow.com/questions/793 ... particular
Мобильная версия