diff --git a/lib/util/ast.js b/lib/util/ast.js index 374e766e..e420ef18 100644 --- a/lib/util/ast.js +++ b/lib/util/ast.js @@ -289,6 +289,11 @@ function parseNodeRecursive(rootNode, childNode, cb, skipConditional = false, is childNode.properties.forEach((prop) => { const isUsedByClassNamesPlugin = rootNode.callee && rootNode.callee.name === 'classnames'; + if (prop.type === 'SpreadElement') { + // Ignore spread elements + return; + } + if (prop.key.type === 'Identifier' && ignoredKeys.includes(prop.key.name)) { // Ignore specific keys defined in settings return; diff --git a/tests/lib/rules/no-custom-classname.js b/tests/lib/rules/no-custom-classname.js index 534c0a01..d4bcda57 100644 --- a/tests/lib/rules/no-custom-classname.js +++ b/tests/lib/rules/no-custom-classname.js @@ -985,6 +985,14 @@ ruleTester.run("no-custom-classname", rule, { }, ], }, + { + code: ` + const obj = { a: 12 }; +
Spread inside classname object
+ `, + }, ], invalid: [