Skip to content

Commit f6a5006

Browse files
committed
@typescript-eslint/indent
1 parent a5857ac commit f6a5006

75 files changed

Lines changed: 1125 additions & 1137 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,13 @@
2424
"@typescript-eslint/explicit-member-accessibility": "off",
2525
"@typescript-eslint/import/order": "off",
2626
"indent": "off",
27-
"@typescript-eslint/indent": "off",
27+
"@typescript-eslint/indent": ["error", 4, {
28+
"flatTernaryExpressions": true,
29+
"FunctionDeclaration": { "parameters": 1, "body": 1 },
30+
"CallExpression": { "arguments": 1 },
31+
"ignoredNodes": ["TSTypeAnnotation"],
32+
"SwitchCase": 1
33+
}],
2834
"@typescript-eslint/interface-name-prefix": "error",
2935
"@typescript-eslint/member-ordering": "off",
3036
"@typescript-eslint/no-angle-bracket-type-assertion": "off",

scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.ts

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -63,42 +63,41 @@ function importDefinitelyTypedTest(tscPath: string, rwcTestPath: string, testCas
6363
maxBuffer: 1 * 1024 * 1024,
6464
cwd: testDirectoryPath
6565
}, (error, stdout, stderr) => {
66+
console.log("importing " + testCaseName + " ...");
67+
console.log(cmd);
68+
69+
if (error) {
6670
console.log("importing " + testCaseName + " ...");
6771
console.log(cmd);
68-
69-
if (error) {
70-
console.log("importing " + testCaseName + " ...");
71-
console.log(cmd);
72-
console.log("==> error " + JSON.stringify(error));
73-
console.log("==> stdout " + String(stdout));
74-
console.log("==> stderr " + String(stderr));
75-
console.log("\r\n");
76-
return;
77-
}
78-
79-
// copy generated file to output location
80-
const outputFilePath = path.join(testDirectoryPath, "iocapture0.json");
81-
const testCasePath = path.join(rwcTestPath, "DefinitelyTyped_" + testCaseName + ".json");
82-
copyFileSync(outputFilePath, testCasePath);
83-
84-
//console.log("output generated at: " + outputFilePath);
85-
86-
if (!fs.existsSync(testCasePath)) {
87-
throw new Error("could not find test case at: " + testCasePath);
88-
}
89-
else {
90-
fs.unlinkSync(outputFilePath);
91-
fs.rmdirSync(testDirectoryPath);
92-
//console.log("testcase generated at: " + testCasePath);
93-
//console.log("Done.");
94-
}
95-
//console.log("\r\n");
96-
97-
})
98-
.on("error", (error: any) => {
9972
console.log("==> error " + JSON.stringify(error));
73+
console.log("==> stdout " + String(stdout));
74+
console.log("==> stderr " + String(stderr));
10075
console.log("\r\n");
101-
});
76+
return;
77+
}
78+
79+
// copy generated file to output location
80+
const outputFilePath = path.join(testDirectoryPath, "iocapture0.json");
81+
const testCasePath = path.join(rwcTestPath, "DefinitelyTyped_" + testCaseName + ".json");
82+
copyFileSync(outputFilePath, testCasePath);
83+
84+
//console.log("output generated at: " + outputFilePath);
85+
86+
if (!fs.existsSync(testCasePath)) {
87+
throw new Error("could not find test case at: " + testCasePath);
88+
}
89+
else {
90+
fs.unlinkSync(outputFilePath);
91+
fs.rmdirSync(testDirectoryPath);
92+
//console.log("testcase generated at: " + testCasePath);
93+
//console.log("Done.");
94+
}
95+
//console.log("\r\n");
96+
97+
}).on("error", (error: any) => {
98+
console.log("==> error " + JSON.stringify(error));
99+
console.log("\r\n");
100+
});
102101
}
103102

104103
function importDefinitelyTypedTests(tscPath: string, rwcTestPath: string, definitelyTypedRoot: string): void {
@@ -147,7 +146,7 @@ function importDefinitelyTypedTests(tscPath: string, rwcTestPath: string, defini
147146
}
148147
}
149148
else {
150-
importDefinitelyTypedTest(tscPath, rwcTestPath, d, tsFiles, paramFile);
149+
importDefinitelyTypedTest(tscPath, rwcTestPath, d, tsFiles, paramFile);
151150
}
152151
}
153152
else {

src/compiler/checker.ts

Lines changed: 93 additions & 99 deletions
Large diffs are not rendered by default.

src/compiler/commandLineParser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2171,12 +2171,12 @@ namespace ts {
21712171
return result.fileNames.length === 0 && canJsonReportNoInutFiles && (!resolutionStack || resolutionStack.length === 0);
21722172
}
21732173

2174-
/*@internal*/
2174+
/*@internal*/
21752175
export function canJsonReportNoInutFiles(raw: any) {
21762176
return !hasProperty(raw, "files") && !hasProperty(raw, "references");
21772177
}
21782178

2179-
/*@internal*/
2179+
/*@internal*/
21802180
export function updateErrorForNoInputFiles(result: ExpandResult, configFileName: string, configFileSpecs: ConfigFileSpecs, configParseDiagnostics: Diagnostic[], canJsonReportNoInutFiles: boolean) {
21812181
const existingErrors = configParseDiagnostics.length;
21822182
if (shouldReportNoInputFiles(result, canJsonReportNoInutFiles)) {

src/compiler/emitter.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,6 @@ namespace ts {
11501150
return emitIdentifier(<Identifier>node);
11511151

11521152
// Parse tree nodes
1153-
11541153
// Names
11551154
case SyntaxKind.QualifiedName:
11561155
return emitQualifiedName(<QualifiedName>node);

src/compiler/factory.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3457,7 +3457,7 @@ namespace ts {
34573457

34583458
export function createMemberAccessForPropertyName(target: Expression, memberName: PropertyName, location?: TextRange): MemberExpression {
34593459
if (isComputedPropertyName(memberName)) {
3460-
return setTextRange(createElementAccess(target, memberName.expression), location);
3460+
return setTextRange(createElementAccess(target, memberName.expression), location);
34613461
}
34623462
else {
34633463
const expression = setTextRange(
@@ -4494,10 +4494,8 @@ namespace ts {
44944494
}
44954495

44964496
const leftKind = getLiteralKindOfBinaryPlusOperand((<BinaryExpression>node).left);
4497-
const literalKind = isLiteralKind(leftKind)
4498-
&& leftKind === getLiteralKindOfBinaryPlusOperand((<BinaryExpression>node).right)
4499-
? leftKind
4500-
: SyntaxKind.Unknown;
4497+
const literalKind = isLiteralKind(leftKind) && leftKind === getLiteralKindOfBinaryPlusOperand((<BinaryExpression>node).right) ? leftKind :
4498+
SyntaxKind.Unknown;
45014499

45024500
(<BinaryPlusExpression>node).cachedLiteralKind = literalKind;
45034501
return literalKind;

src/compiler/moduleSpecifiers.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ namespace ts.moduleSpecifiers {
3030
function getPreferencesForUpdate(compilerOptions: CompilerOptions, oldImportSpecifier: string): Preferences {
3131
return {
3232
relativePreference: isExternalModuleNameRelative(oldImportSpecifier) ? RelativePreference.Relative : RelativePreference.NonRelative,
33-
ending: hasJSOrJsonFileExtension(oldImportSpecifier) ? Ending.JsExtension
34-
: getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.NodeJs || endsWith(oldImportSpecifier, "index") ? Ending.Index : Ending.Minimal,
33+
ending: hasJSOrJsonFileExtension(oldImportSpecifier) ?
34+
Ending.JsExtension :
35+
getEmitModuleResolutionKind(compilerOptions) !== ModuleResolutionKind.NodeJs || endsWith(oldImportSpecifier, "index") ? Ending.Index : Ending.Minimal,
3536
};
3637
}
3738

src/compiler/parser.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4746,7 +4746,7 @@ namespace ts {
47464746
function parseArgumentOrArrayLiteralElement(): Expression {
47474747
return token() === SyntaxKind.DotDotDotToken ? parseSpreadElement() :
47484748
token() === SyntaxKind.CommaToken ? <Expression>createNode(SyntaxKind.OmittedExpression) :
4749-
parseAssignmentExpressionOrHigher();
4749+
parseAssignmentExpressionOrHigher();
47504750
}
47514751

47524752
function parseArgumentExpression(): Expression {
@@ -4848,9 +4848,9 @@ namespace ts {
48484848
const isAsync = hasModifier(node, ModifierFlags.Async) ? SignatureFlags.Await : SignatureFlags.None;
48494849
node.name =
48504850
isGenerator && isAsync ? doInYieldAndAwaitContext(parseOptionalIdentifier) :
4851-
isGenerator ? doInYieldContext(parseOptionalIdentifier) :
4852-
isAsync ? doInAwaitContext(parseOptionalIdentifier) :
4853-
parseOptionalIdentifier();
4851+
isGenerator ? doInYieldContext(parseOptionalIdentifier) :
4852+
isAsync ? doInAwaitContext(parseOptionalIdentifier) :
4853+
parseOptionalIdentifier();
48544854

48554855
fillSignature(SyntaxKind.ColonToken, isGenerator | isAsync, node);
48564856
node.body = parseFunctionBlock(isGenerator | isAsync);
@@ -5964,9 +5964,8 @@ namespace ts {
59645964
}
59655965

59665966
function tryParseTypeArguments(): NodeArray<TypeNode> | undefined {
5967-
return token() === SyntaxKind.LessThanToken
5968-
? parseBracketedList(ParsingContext.TypeArguments, parseType, SyntaxKind.LessThanToken, SyntaxKind.GreaterThanToken)
5969-
: undefined;
5967+
return token() === SyntaxKind.LessThanToken ?
5968+
parseBracketedList(ParsingContext.TypeArguments, parseType, SyntaxKind.LessThanToken, SyntaxKind.GreaterThanToken) : undefined;
59705969
}
59715970

59725971
function isHeritageClause(): boolean {
@@ -6312,9 +6311,7 @@ namespace ts {
63126311
|| node.kind === SyntaxKind.ImportEqualsDeclaration && (<ImportEqualsDeclaration>node).moduleReference.kind === SyntaxKind.ExternalModuleReference
63136312
|| node.kind === SyntaxKind.ImportDeclaration
63146313
|| node.kind === SyntaxKind.ExportAssignment
6315-
|| node.kind === SyntaxKind.ExportDeclaration
6316-
? node
6317-
: undefined;
6314+
|| node.kind === SyntaxKind.ExportDeclaration ? node : undefined;
63186315
}
63196316

63206317
function getImportMetaIfNecessary(sourceFile: SourceFile) {

0 commit comments

Comments
 (0)