Skip to content

Commit 41b1bd7

Browse files
authoredApr 2, 2020
Set indent rule for TS files too (#451)
1 parent 28902f0 commit 41b1bd7

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed
 

Diff for: ‎lib/options-manager.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,10 @@ const buildXOConfig = options => config => {
282282
}
283283

284284
if (options.space && !options.prettier) {
285+
config.rules.indent = ['error', spaces, {SwitchCase: 1}];
286+
285287
if (options.ts) {
286288
config.rules['@typescript-eslint/indent'] = ['error', spaces, {SwitchCase: 1}];
287-
} else {
288-
config.rules.indent = ['error', spaces, {SwitchCase: 1}];
289289
}
290290

291291
// Only apply if the user has the React plugin

Diff for: ‎test/options-manager.js

+6
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ test('buildConfig: space: 4', t => {
6767
t.deepEqual(config.rules.indent, ['error', 4, {SwitchCase: 1}]);
6868
});
6969

70+
test('buildConfig: space: 4 (ts file)', t => {
71+
const config = manager.buildConfig({space: 4, ts: true});
72+
t.deepEqual(config.rules.indent, ['error', 4, {SwitchCase: 1}]);
73+
t.deepEqual(config.rules['@typescript-eslint/indent'], ['error', 4, {SwitchCase: 1}]);
74+
});
75+
7076
test('buildConfig: semicolon', t => {
7177
const config = manager.buildConfig({semicolon: false, nodeVersion: '12'});
7278
t.deepEqual(config.rules.semi, ['error', 'never']);

0 commit comments

Comments
 (0)
Please sign in to comment.