Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/util/Components.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,14 @@ class Components {
* Find a component in the list using its node
*
* @param {ASTNode} node The AST node being searched.
* @returns {Object} Component object, undefined if the component is not found
* @returns {Object} Component object, undefined if the component is not found or has confidence value of 0.
*/
get(node) {
const id = getId(node);
return this._list[id];
if (this._list[id] && this._list[id].confidence >= 1) {
return this._list[id];
}
return null;
}

/**
Expand Down
8 changes: 8 additions & 0 deletions tests/lib/rules/destructuring-assignment.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@ ruleTester.run('destructuring-assignment', rule, {
}
};`,
options: ['always']
}, {
code: [
'const div = styled.div`',
' & .button {',
' border-radius: ${props => props.borderRadius}px;',
' }',
'`'
].join('\n')
}],

invalid: [{
Expand Down