diff --git a/tests/lib/rules/forbid-prop-types.js b/tests/lib/rules/forbid-prop-types.js index 63eff5087a..714e6c8dbc 100644 --- a/tests/lib/rules/forbid-prop-types.js +++ b/tests/lib/rules/forbid-prop-types.js @@ -572,6 +572,19 @@ ruleTester.run('forbid-prop-types', rule, { ' preview: PropTypes.bool,', '}, componentApi, teaserListProps);' ].join('\n') + }, { + code: [ + 'var First = createReactClass({', + ' propTypes: {', + ' s: PropTypes.shape({', + ' o: PropTypes.object', + ' })', + ' },', + ' render: function() {', + ' return
;', + ' }', + '});' + ].join('\n') }], invalid: [{ @@ -713,7 +726,7 @@ ruleTester.run('forbid-prop-types', rule, { code: [ 'var First = createReactClass({', ' propTypes: {', - ' s: PropTypes.shape({,', + ' s: PropTypes.shape({', ' o: PropTypes.object', ' })', ' },', diff --git a/tests/lib/rules/jsx-closing-bracket-location.js b/tests/lib/rules/jsx-closing-bracket-location.js index 1127af8d89..cafcd9ebfd 100644 --- a/tests/lib/rules/jsx-closing-bracket-location.js +++ b/tests/lib/rules/jsx-closing-bracket-location.js @@ -1161,7 +1161,7 @@ ruleTester.run('jsx-closing-bracket-location', rule, { ')' ].join('\n'), options: [{location: 'line-aligned'}], - errors: [MESSAGE_AFTER_TAG] + errors: MESSAGE_AFTER_TAG }, { code: [ '
`, errors: [{message: missingCurlyMessage}], - options: [{props: 'always'}] + options: [{props: 'always'}], + output: `` }, { code: 'foo · bar', errors: [{message: missingCurlyMessage}], - options: [{children: 'always'}] + options: [{children: 'always'}], + output: '{"foo · bar"}' }, { code: `{'foo "bar"'}`, @@ -689,7 +691,18 @@ ruleTester.run('jsx-curly-brace-presence', rule, { errors: [ {message: missingCurlyMessage}, {message: missingCurlyMessage} ], - options: ['always'] + options: ['always'], + output: [ + '', + ' {"a"}', + ' {"b c "}', + ' {"d "}', + '' + ].join('\n') }, { code: [ @@ -706,7 +719,18 @@ ruleTester.run('jsx-curly-brace-presence', rule, { errors: [ {message: missingCurlyMessage}, {message: missingCurlyMessage} ], - options: ['always'] + options: ['always'], + output: [ + ``, + ' {"a"}', + ' {"b c "}', + ' {"d "}', + '' + ].join('\n') }, { code: ` diff --git a/tests/lib/rules/jsx-indent.js b/tests/lib/rules/jsx-indent.js index 5969c1a3aa..ca199e55b4 100644 --- a/tests/lib/rules/jsx-indent.js +++ b/tests/lib/rules/jsx-indent.js @@ -1120,7 +1120,12 @@ const Component = () => ( ].join('\n'), options: [2], errors: [{message: 'Expected indentation of 2 space characters but found 4.'}] - }, { + }, /* + // The detection logic only thinks is indented wrong, not the other + // two lines following. I *think* because it incorrectly uses 's indention + // as the baseline for the next two, instead of the realizing the entire three + // lines are wrong together. See #608 + { code: [ 'function App() {', ' return (', @@ -1130,22 +1135,9 @@ const Component = () => ( ' );', '}' ].join('\n'), - // The detection logic only thinks is indented wrong, not the other - // two lines following. I *think* because it incorrectly uses 's indention - // as the baseline for the next two, instead of the realizing the entire three - // lines are wrong together. See #608 - /* output: [ - 'function App() {', - ' return (', - ' ', - ' ', - ' ', - ' );', - '}' - ].join('\n'), */ options: [2], errors: [{message: 'Expected indentation of 4 space characters but found 0.'}] - }, { + }, */ { code: [ '', ' {test}', @@ -1781,7 +1773,14 @@ const Component = () => ( ].join('\n'), errors: [ {message: 'Expected indentation of 4 space characters but found 2.'} - ] + ], + output: [ + '

', + '

', + ' Text', + '
', + '

' + ].join('\n') }, { code: ` const Component = () => ( diff --git a/tests/lib/rules/jsx-sort-props.js b/tests/lib/rules/jsx-sort-props.js index 4a58b1ca43..3d64788e3a 100644 --- a/tests/lib/rules/jsx-sort-props.js +++ b/tests/lib/rules/jsx-sort-props.js @@ -401,7 +401,7 @@ ruleTester.run('jsx-sort-props', rule, { }, { code: ';', - errors: [shorthandAndCallbackLastArgs], + errors: [expectedError], options: shorthandLastArgs, output: ';' }, diff --git a/tests/lib/rules/jsx-uses-vars.js b/tests/lib/rules/jsx-uses-vars.js index efac09331b..b93e7c3547 100644 --- a/tests/lib/rules/jsx-uses-vars.js +++ b/tests/lib/rules/jsx-uses-vars.js @@ -215,13 +215,23 @@ ruleTester.run('prefer-const', rulePreferConst, { let App =
; ; `, - errors: [{message: '\'App\' is never reassigned. Use \'const\' instead.'}] + errors: [{message: '\'App\' is never reassigned. Use \'const\' instead.'}], + output: ` + /* eslint jsx-uses-vars:1 */ + const App =
; + ; + ` }, { code: ` /* eslint jsx-uses-vars:1 */ let filters = 'foo';
{filters}
; `, - errors: [{message: '\'filters\' is never reassigned. Use \'const\' instead.'}] + errors: [{message: '\'filters\' is never reassigned. Use \'const\' instead.'}], + output: ` + /* eslint jsx-uses-vars:1 */ + const filters = 'foo'; +
{filters}
; + ` }] }); diff --git a/tests/lib/rules/no-typos.js b/tests/lib/rules/no-typos.js index 9a7b6f751c..62c156e125 100644 --- a/tests/lib/rules/no-typos.js +++ b/tests/lib/rules/no-typos.js @@ -944,7 +944,7 @@ ruleTester.run('no-typos', rule, { type: 'MethodDefinition' }, { message: ERROR_MESSAGE_LIFECYCLE_METHOD('Render', 'render'), - nodeType: 'MethodDefinition' + type: 'MethodDefinition' }] }, { code: ` @@ -1616,7 +1616,7 @@ ruleTester.run('no-typos', rule, { parserOptions, errors: [{ message: ERROR_MESSAGE_STATIC('getDerivedStateFromProps'), - nodeType: 'MethodDefinition' + type: 'MethodDefinition' }] }, { code: ` @@ -1628,10 +1628,10 @@ ruleTester.run('no-typos', rule, { parserOptions, errors: [{ message: ERROR_MESSAGE_STATIC('GetDerivedStateFromProps'), - nodeType: 'MethodDefinition' + type: 'MethodDefinition' }, { message: ERROR_MESSAGE_LIFECYCLE_METHOD('GetDerivedStateFromProps', 'getDerivedStateFromProps'), - nodeType: 'MethodDefinition' + type: 'MethodDefinition' }] }, { code: ` diff --git a/tests/lib/rules/no-unknown-property.js b/tests/lib/rules/no-unknown-property.js index 8bfdd9d61a..21197a4e06 100644 --- a/tests/lib/rules/no-unknown-property.js +++ b/tests/lib/rules/no-unknown-property.js @@ -85,10 +85,12 @@ ruleTester.run('no-unknown-property', rule, { errors: [{message: 'Unknown property \'clip-path\' found, use \'clipPath\' instead'}] }, { code: '