Skip to content

Commit ac50111

Browse files
committed
moving fnc to file level
1 parent 9628ef7 commit ac50111

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

lib/util/Components.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const usedPropTypesAreEquivalent = (propA, propB) => {
1414
if (propA.name === propB.name) {
1515
if (!propA.allNames && !propB.allNames) {
1616
return true;
17-
} else if (propA.allNames.join('') === propB.allNames.join('')) {
17+
} else if (Array.isArray(propA.allNames) && Array.isArray(propB.allNames) && propA.allNames.join('') === propB.allNames.join('')) {
1818
return true;
1919
}
2020
return false;

tests/lib/rules/no-unused-prop-types.js

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1914,10 +1914,32 @@ ruleTester.run('no-unused-prop-types', rule, {
19141914
' test: React.PropTypes.bool',
19151915
'};'
19161916
].join('\n')
1917+
}, {
1918+
// issue 1268
1919+
code: [
1920+
'export default function SampleComp(props) {',
1921+
' function buildText(text) {',
1922+
' return (',
1923+
' <span>',
1924+
' {text}',
1925+
' {props.append}',
1926+
' </span>',
1927+
' );',
1928+
' }',
1929+
' return (',
1930+
' <div>',
1931+
' {buildText(props.text)}',
1932+
' </div>',
1933+
' );',
1934+
' }',
1935+
'SampleComp.propTypes = {',
1936+
' text: PropTypes.string,',
1937+
' append: PropTypes.string',
1938+
'};'
1939+
].join('\n')
19171940
}
19181941
],
19191942

1920-
19211943
invalid: [
19221944
{
19231945
code: [

0 commit comments

Comments
 (0)