Skip to content

Commit 0f480f6

Browse files
brettdhljharb
authored andcommitted
Add commented-out createClass tests
These two tests fail on master as well as this branch, so they expose a pre-existing bug with the no-typos rule.
1 parent 830fc3d commit 0f480f6

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

tests/lib/rules/no-typos.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,4 +1061,55 @@ ruleTester.run('no-typos', rule, {
10611061
message: 'Typo in declared prop type: objectof'
10621062
}]
10631063
}]
1064+
/*
1065+
// createClass tests below fail, so they're commented out
1066+
// ---------
1067+
}, {
1068+
code: `
1069+
import React from 'react';
1070+
import PropTypes from 'prop-types';
1071+
const Component = React.createClass({
1072+
propTypes: {
1073+
a: PropTypes.string.isrequired,
1074+
b: PropTypes.shape({
1075+
c: PropTypes.number
1076+
}).isrequired
1077+
}
1078+
});
1079+
`,
1080+
parser: 'babel-eslint',
1081+
parserOptions: parserOptions,
1082+
errors: [{
1083+
message: 'Typo in prop type chain qualifier: isrequired'
1084+
}, {
1085+
message: 'Typo in prop type chain qualifier: isrequired'
1086+
}]
1087+
}, {
1088+
code: `
1089+
import React from 'react';
1090+
import PropTypes from 'prop-types';
1091+
const Component = React.createClass({
1092+
childContextTypes: {
1093+
a: PropTypes.bools,
1094+
b: PropTypes.Array,
1095+
c: PropTypes.function,
1096+
d: PropTypes.objectof,
1097+
}
1098+
});
1099+
`,
1100+
parser: 'babel-eslint',
1101+
parserOptions: parserOptions,
1102+
errors: [{
1103+
message: 'Typo in declared prop type: bools'
1104+
}, {
1105+
message: 'Typo in declared prop type: Array'
1106+
}, {
1107+
message: 'Typo in declared prop type: function'
1108+
}, {
1109+
message: 'Typo in declared prop type: objectof'
1110+
}]
1111+
}]
1112+
// ---------
1113+
// createClass tests above fail, so they're commented out
1114+
*/
10641115
});

0 commit comments

Comments
 (0)