',
@@ -459,6 +461,38 @@ ruleTester.run('jsx-indent', rule, {
options: ['tab'],
parserOptions: parserOptions,
errors: [{message: 'Expected indentation of 1 tab character but found 0.'}]
+ }, {
+ code: [
+ 'function MyComponent(props) {',
+ '\treturn (',
+ ' ',
+ ' Hello world!',
+ '
',
+ '\t)',
+ '}'
+ ].join('\n'),
+ output: [
+ 'function MyComponent(props) {',
+ '\treturn (',
+ '\t\t',
+ '\t\t\tHello world!',
+ '\t\t
',
+ '\t)',
+ '}'
+ ].join('\n'),
+ options: ['tab'],
+ parserOptions: parserOptions,
+ errors: [
+ {message: 'Expected indentation of 2 tab characters but found 0.'},
+ {message: 'Expected indentation of 2 tab characters but found 0.'},
+ {message: 'Expected indentation of 2 tab characters but found 0.'}
+ ]
}, {
code: [
'function App() {',
@@ -505,11 +539,7 @@ ruleTester.run('jsx-indent', rule, {
' );',
'}'
].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: [
+ output: [
'function App() {',
' return (',
' ',
@@ -517,10 +547,14 @@ ruleTester.run('jsx-indent', rule, {
' ',
' );',
'}'
- ].join('\n'), */
+ ].join('\n'),
options: [2],
parserOptions: parserOptions,
- errors: [{message: 'Expected indentation of 4 space characters but found 0.'}]
+ errors: [
+ {message: 'Expected indentation of 4 space characters but found 0.'},
+ {message: 'Expected indentation of 6 space characters but found 2.'},
+ {message: 'Expected indentation of 4 space characters but found 0.'}
+ ]
}, {
code: [
'',