',
@@ -211,17 +213,6 @@ ruleTester.run('jsx-indent', rule, {
''
].join('\n'),
parserOptions: parserOptions
- }, {
- // Literals indentation is not touched
- code: [
- '',
- 'bar
',
- ' bar',
- ' bar {foo}',
- 'bar
',
- '
'
- ].join('\n'),
- parserOptions: parserOptions
}, {
// Multiline ternary
// (colon at the end of the first expression)
@@ -459,6 +450,39 @@ 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 3 tab characters but found 0.'},
+ {message: 'Expected indentation of 2 tab characters but found 0.'}
+ ]
}, {
code: [
'function App() {',
@@ -505,11 +529,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 +537,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: [
'',