Skip to content

Commit 1db64d8

Browse files
committed
Rebase and merge conflicts
1 parent 67f1dd2 commit 1db64d8

File tree

2 files changed

+55
-2
lines changed

2 files changed

+55
-2
lines changed

lib/rules/jsx-indent.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ module.exports = {
3939
category: 'Stylistic Issues',
4040
recommended: false
4141
},
42+
// fixer will fix whitespace and tabs indentation.
43+
// It won't replace tabs with whitespaces and vice-versa.
4244
fixable: 'whitespace',
4345
schema: [{
4446
oneOf: [{
@@ -69,7 +71,7 @@ module.exports = {
6971
}
7072
}
7173

72-
var indentChar = indentType === 'space' ? ' ' : '\u0009';
74+
var indentChar = indentType === 'space' ? ' ' : '\t';
7375

7476
/**
7577
* Responsible for fixing the indentation issue fix

tests/lib/rules/jsx-indent.js

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,57 @@ ruleTester.run('jsx-indent', rule, {
236236
errors: [
237237
{message: 'Expected indentation of 3 tab characters but found 2.'}
238238
]
239-
}]
239+
}, {
240+
code: [
241+
'<App>\n',
242+
'<Foo />\n',
243+
'</App>'
244+
].join('\n'),
245+
output: [
246+
'<App>\n',
247+
'\t<Foo />\n',
248+
'</App>'
249+
].join('\n'),
250+
parserOptions: parserOptions,
251+
options: ['tab'],
252+
errors: [
253+
{message: 'Expected indentation of 1 tab character but found 0.'}
254+
]
255+
}
256+
// Tests for future work. See the comment on line 42-43 in the rule near to fixable: 'whitespace' meta property,
257+
// Right now fixer function doesn't support replacing tabs with whitespaces and vice-versa.
258+
/* , {
259+
code: [
260+
'<App>\n',
261+
' <Foo />\n',
262+
'</App>'
263+
].join('\n'),
264+
output: [
265+
'<App>\n',
266+
'\t<Foo />\n',
267+
'</App>'
268+
].join('\n'),
269+
parserOptions: parserOptions,
270+
options: ['tab'],
271+
errors: [
272+
{message: 'Expected indentation of 1 tab character but found 0.'}
273+
]
274+
}, {
275+
code: [
276+
'<App>\n',
277+
'\t<Foo />\n',
278+
'</App>'
279+
].join('\n'),
280+
output: [
281+
'<App>\n',
282+
' <Foo />\n',
283+
'</App>'
284+
].join('\n'),
285+
parserOptions: parserOptions,
286+
options: [2],
287+
errors: [
288+
{message: 'Expected indentation of 2 space characters but found 0.'}
289+
]
290+
}*/]
240291
});
241292

0 commit comments

Comments
 (0)