mirror of
https://github.com/bendtherules/eslint-plugin-no-classname-with-stylename.git
synced 2026-08-18 22:03:28 +00:00
Fix tests and attr type check
This commit is contained in:
@@ -38,14 +38,16 @@ module.exports = {
|
||||
|
||||
return {
|
||||
"JSXOpeningElement": function (node) {
|
||||
console.log(node.attributes);
|
||||
|
||||
const hasClassNameWithoutExpr = node.attributes.some((attr) => (
|
||||
attr.type === "JSXIdentifier" && attr.name.name === "className" &&
|
||||
attr.name.type === "JSXIdentifier" && attr.name.name === "className" &&
|
||||
(attr.value === null || attr.value.type !== 'JSXExpressionContainer')
|
||||
));
|
||||
const hasStyleName = node.attributes.some((attr) => attr.type === "JSXIdentifier" && attr.name.name === "styleName");
|
||||
const hasStyleName = node.attributes.some((attr) => attr.name.type === "JSXIdentifier" && attr.name.name === "styleName");
|
||||
|
||||
if (hasClassNameWithoutExpr && hasStyleName) {
|
||||
const nodeAttrClassName = node.attributes.find((attr) => attr.type === "JSXIdentifier" && attr.name.name === "className");
|
||||
const nodeAttrClassName = node.attributes.find((attr) => attr.name.type === "JSXIdentifier" && attr.name.name === "className");
|
||||
context.report(nodeAttrClassName, reportText);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user