From 1c5d8344be9770230f3207ab2549c9c71911c520 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 23 Jun 2016 12:32:14 -0700 Subject: [PATCH 1/4] Add new lint rule --- Gulpfile.ts | 3 +- Jakefile.js | 3 +- .../objectLiteralSurroundingSpaceRule.ts | 32 +++++++++++++++++++ tslint.json | 3 +- 4 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 scripts/tslint/objectLiteralSurroundingSpaceRule.ts diff --git a/Gulpfile.ts b/Gulpfile.ts index ddc0dce8552..f173457dddc 100644 --- a/Gulpfile.ts +++ b/Gulpfile.ts @@ -957,7 +957,8 @@ const tslintRules = [ "booleanTriviaRule", "typeOperatorSpacingRule", "noInOperatorRule", - "noIncrementDecrementRule" + "noIncrementDecrementRule", + "objectLiteralSurroundingSpaceRule", ]; const tslintRulesFiles = tslintRules.map(function(p) { return path.join(tslintRuleDir, p + ".ts"); diff --git a/Jakefile.js b/Jakefile.js index e5c3648d5f1..7db91abcfcc 100644 --- a/Jakefile.js +++ b/Jakefile.js @@ -992,7 +992,8 @@ var tslintRules = [ "booleanTriviaRule", "typeOperatorSpacingRule", "noInOperatorRule", - "noIncrementDecrementRule" + "noIncrementDecrementRule", + "objectLiteralSurroundingSpaceRule", ]; var tslintRulesFiles = tslintRules.map(function(p) { return path.join(tslintRuleDir, p + ".ts"); diff --git a/scripts/tslint/objectLiteralSurroundingSpaceRule.ts b/scripts/tslint/objectLiteralSurroundingSpaceRule.ts new file mode 100644 index 00000000000..4178ee99515 --- /dev/null +++ b/scripts/tslint/objectLiteralSurroundingSpaceRule.ts @@ -0,0 +1,32 @@ +import * as Lint from "tslint/lib/lint"; +import * as ts from "typescript"; + + +export class Rule extends Lint.Rules.AbstractRule { + public static LEADING_FAILURE_STRING = "No leading whitespace found on single-line object literal."; + public static TRAILING_FAILURE_STRING = "No trailing whitespace found on single-line object literal."; + + public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { + return this.applyWithWalker(new ObjectLiteralSpaceWalker(sourceFile, this.getOptions())); + } +} + +class ObjectLiteralSpaceWalker extends Lint.RuleWalker { + public visitNode(node: ts.Node) { + if (node.kind === ts.SyntaxKind.ObjectLiteralExpression) { + const literal = node as ts.ObjectLiteralExpression; + const text = literal.getText(); + if (text.match(/^{[^\n]+}$/g)) { + if (text.charAt(1) !== " ") { + const failure = this.createFailure(node.pos, node.getWidth(), Rule.LEADING_FAILURE_STRING); + this.addFailure(failure); + } + if (text.charAt(text.length - 2) !== " ") { + const failure = this.createFailure(node.pos, node.getWidth(), Rule.TRAILING_FAILURE_STRING); + this.addFailure(failure); + } + } + } + super.visitNode(node); + } +} diff --git a/tslint.json b/tslint.json index f789af46cea..ee116c6fcb0 100644 --- a/tslint.json +++ b/tslint.json @@ -44,6 +44,7 @@ "type-operator-spacing": true, "prefer-const": true, "no-in-operator": true, - "no-increment-decrement": true + "no-increment-decrement": true, + "object-literal-surrounding-space": true } } From 59ae2ff8ef4a6b4b338b38565ae3580c620c41b4 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 23 Jun 2016 12:39:20 -0700 Subject: [PATCH 2/4] Fix object whitespace lints --- Gulpfile.ts | 10 +++++----- src/server/session.ts | 2 +- tests/cases/unittests/moduleResolution.ts | 14 +++++++------- tests/cases/unittests/session.ts | 6 +++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Gulpfile.ts b/Gulpfile.ts index f173457dddc..dcb5faa1a39 100644 --- a/Gulpfile.ts +++ b/Gulpfile.ts @@ -226,7 +226,7 @@ for (const i in libraryTargets) { gulp.task(target, false, [], function() { return gulp.src(sources) .pipe(newer(target)) - .pipe(concat(target, {newLine: ""})) + .pipe(concat(target, { newLine: "" })) .pipe(gulp.dest(".")); }); } @@ -577,7 +577,7 @@ gulp.task(run, false, [servicesFile], () => { .pipe(newer(run)) .pipe(sourcemaps.init()) .pipe(tsc(settings)) - .pipe(sourcemaps.write(".", {includeContent: false, sourceRoot: "../../"})) + .pipe(sourcemaps.write(".", { includeContent: false, sourceRoot: "../../" })) .pipe(gulp.dest(".")); }); @@ -743,7 +743,7 @@ gulp.task("runtests", const nodeServerOutFile = "tests/webTestServer.js"; const nodeServerInFile = "tests/webTestServer.ts"; gulp.task(nodeServerOutFile, false, [servicesFile], () => { - const settings: tsc.Settings = getCompilerSettings({module: "commonjs"}, /*useBuiltCompiler*/ true); + const settings: tsc.Settings = getCompilerSettings({ module: "commonjs" }, /*useBuiltCompiler*/ true); return gulp.src(nodeServerInFile) .pipe(newer(nodeServerOutFile)) .pipe(sourcemaps.init()) @@ -768,7 +768,7 @@ gulp.task("browserify", "Runs browserify on run.js to produce a file suitable fo next(undefined, file); }); })) - .pipe(sourcemaps.write(".", {includeContent: false, sourceRoot: "../../"})) + .pipe(sourcemaps.write(".", { includeContent: false, sourceRoot: "../../" })) .pipe(gulp.dest(".")); }); @@ -966,7 +966,7 @@ const tslintRulesFiles = tslintRules.map(function(p) { const tslintRulesOutFiles = tslintRules.map(function(p, i) { const pathname = path.join(builtLocalDirectory, "tslint", p + ".js"); gulp.task(pathname, false, [], () => { - const settings: tsc.Settings = getCompilerSettings({module: "commonjs"}, /*useBuiltCompiler*/ false); + const settings: tsc.Settings = getCompilerSettings({ module: "commonjs" }, /*useBuiltCompiler*/ false); return gulp.src(tslintRulesFiles[i]) .pipe(newer(pathname)) .pipe(sourcemaps.init()) diff --git a/src/server/session.ts b/src/server/session.ts index aafc02a2b0b..54815300c74 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -1123,7 +1123,7 @@ namespace ts.server { [CommandNames.Reload]: (request: protocol.Request) => { const reloadArgs = request.arguments; this.reload(reloadArgs.file, reloadArgs.tmpfile, request.seq); - return {response: { reloadFinished: true }, responseRequired: true}; + return { response: { reloadFinished: true }, responseRequired: true }; }, [CommandNames.Saveto]: (request: protocol.Request) => { const savetoArgs = request.arguments; diff --git a/tests/cases/unittests/moduleResolution.ts b/tests/cases/unittests/moduleResolution.ts index 16fc7df8d70..70cb4715c48 100644 --- a/tests/cases/unittests/moduleResolution.ts +++ b/tests/cases/unittests/moduleResolution.ts @@ -589,7 +589,7 @@ import b = require("./moduleB.ts"); const file1: File = { name: "/root/folder1/file1.ts" }; const file2: File = { name: "/root/generated/folder1/file2.ts" }; // load remapped file as module const file3: File = { name: "/root/generated/folder2/file3/index.d.ts" }; // load folder a module - const file4Typings: File = { name: "/root/generated/folder2/file4/package.json", content: JSON.stringify({ typings: "dist/types.d.ts" })}; + const file4Typings: File = { name: "/root/generated/folder2/file4/package.json", content: JSON.stringify({ typings: "dist/types.d.ts" }) }; const file4: File = { name: "/root/generated/folder2/file4/dist/types.d.ts" }; // load file pointed by typings const file5: File = { name: "/root/someanotherfolder/file5/index.d.ts" }; // load remapped module from folder const file6: File = { name: "/root/node_modules/file6.ts" }; // fallback to node @@ -957,7 +957,7 @@ import b = require("./moduleB.ts"); describe("Type reference directive resolution: ", () => { function test(typesRoot: string, typeDirective: string, primary: boolean, initialFile: File, targetFile: File, ...otherFiles: File[]) { const host = createModuleResolutionHost(/*hasDirectoryExists*/ false, ...[initialFile, targetFile].concat(...otherFiles)); - const result = resolveTypeReferenceDirective(typeDirective, initialFile.name, {typeRoots: [typesRoot]}, host); + const result = resolveTypeReferenceDirective(typeDirective, initialFile.name, { typeRoots: [typesRoot] }, host); assert(result.resolvedTypeReferenceDirective.resolvedFileName !== undefined, "expected type directive to be resolved"); assert.equal(result.resolvedTypeReferenceDirective.resolvedFileName, targetFile.name, "unexpected result of type reference resolution"); assert.equal(result.resolvedTypeReferenceDirective.primary, primary, "unexpected 'primary' value"); @@ -972,7 +972,7 @@ import b = require("./moduleB.ts"); { const f1 = { name: "/root/src/app.ts" }; const f2 = { name: "/root/src/types/lib/typings/lib.d.ts" }; - const package = { name: "/root/src/types/lib/package.json", content: JSON.stringify({types: "typings/lib.d.ts"}) }; + const package = { name: "/root/src/types/lib/package.json", content: JSON.stringify({ types: "typings/lib.d.ts" }) }; test(/*typesRoot*/"/root/src/types", /* typeDirective */"lib", /*primary*/ true, f1, f2, package); } { @@ -983,7 +983,7 @@ import b = require("./moduleB.ts"); { const f1 = { name: "/root/src/app.ts" }; const f2 = { name: "/root/src/node_modules/lib/typings/lib.d.ts" }; - const package = { name: "/root/src/node_modules/lib/package.json", content: JSON.stringify({types: "typings/lib.d.ts"}) }; + const package = { name: "/root/src/node_modules/lib/package.json", content: JSON.stringify({ types: "typings/lib.d.ts" }) }; test(/*typesRoot*/"/root/src/types", /* typeDirective */"lib", /*primary*/ false, f1, f2, package); } { @@ -994,7 +994,7 @@ import b = require("./moduleB.ts"); { const f1 = { name: "/root/src/app.ts" }; const f2 = { name: "/root/src/node_modules/@types/lib/typings/lib.d.ts" }; - const package = { name: "/root/src/node_modules/@types/lib/package.json", content: JSON.stringify({types: "typings/lib.d.ts"}) }; + const package = { name: "/root/src/node_modules/@types/lib/package.json", content: JSON.stringify({ types: "typings/lib.d.ts" }) }; test(/*typesRoot*/"/root/src/types", /* typeDirective */"lib", /*primary*/ false, f1, f2, package); } }); @@ -1012,7 +1012,7 @@ import b = require("./moduleB.ts"); { const f1 = { name: "/root/src/app.ts" }; const f2 = { name: "/root/node_modules/lib/typings/lib.d.ts" }; - const package = { name: "/root/node_modules/lib/package.json", content: JSON.stringify({typings: "typings/lib.d.ts"}) }; + const package = { name: "/root/node_modules/lib/package.json", content: JSON.stringify({ typings: "typings/lib.d.ts" }) }; test(/*typesRoot*/"/root/src/types", /* typeDirective */"lib", /*primary*/ false, f1, f2, package); } { @@ -1023,7 +1023,7 @@ import b = require("./moduleB.ts"); { const f1 = { name: "/root/src/app.ts" }; const f2 = { name: "/root/node_modules/@types/lib/typings/lib.d.ts" }; - const package = { name: "/root/node_modules/@types/lib/package.json", content: JSON.stringify({typings: "typings/lib.d.ts"}) }; + const package = { name: "/root/node_modules/@types/lib/package.json", content: JSON.stringify({ typings: "typings/lib.d.ts" }) }; test(/*typesRoot*/"/root/src/types", /* typeDirective */"lib", /*primary*/ false, f1, f2, package); } }); diff --git a/tests/cases/unittests/session.ts b/tests/cases/unittests/session.ts index a2edb05b39b..b9073365d91 100644 --- a/tests/cases/unittests/session.ts +++ b/tests/cases/unittests/session.ts @@ -170,7 +170,7 @@ namespace ts.server { describe("send", () => { it("is an overrideable handle which sends protocol messages over the wire", () => { - const msg = {seq: 0, type: "none"}; + const msg = { seq: 0, type: "none" }; const strmsg = JSON.stringify(msg); const len = 1 + Utils.byteLength(strmsg, "utf8"); const resultMsg = `Content-Length: ${len}\r\n\r\n${strmsg}\n`; @@ -266,7 +266,7 @@ namespace ts.server { constructor() { super(mockHost, Utils.byteLength, process.hrtime, mockLogger); this.addProtocolHandler(this.customHandler, () => { - return {response: undefined, responseRequired: true}; + return { response: undefined, responseRequired: true }; }); } send(msg: protocol.Message) { @@ -340,7 +340,7 @@ namespace ts.server { handleRequest(msg: protocol.Request) { let response: protocol.Response; try { - ({response} = this.executeCommand(msg)); + ({ response } = this.executeCommand(msg)); } catch (e) { this.output(undefined, msg.command, msg.seq, e.toString()); From 998acce592a1f7d3966009b0c375b4fbc4645fe1 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 23 Jun 2016 13:35:29 -0700 Subject: [PATCH 3/4] Check for exactly one space --- scripts/tslint/objectLiteralSurroundingSpaceRule.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/tslint/objectLiteralSurroundingSpaceRule.ts b/scripts/tslint/objectLiteralSurroundingSpaceRule.ts index 4178ee99515..b527746bf51 100644 --- a/scripts/tslint/objectLiteralSurroundingSpaceRule.ts +++ b/scripts/tslint/objectLiteralSurroundingSpaceRule.ts @@ -5,6 +5,8 @@ import * as ts from "typescript"; export class Rule extends Lint.Rules.AbstractRule { public static LEADING_FAILURE_STRING = "No leading whitespace found on single-line object literal."; public static TRAILING_FAILURE_STRING = "No trailing whitespace found on single-line object literal."; + public static LEADING_EXCESS_FAILURE_STRING = "Excess leading whitespace found on single-line object literal."; + public static TRAILING_EXCESS_FAILURE_STRING = "Excess trailing whitespace found on single-line object literal."; public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { return this.applyWithWalker(new ObjectLiteralSpaceWalker(sourceFile, this.getOptions())); @@ -21,10 +23,18 @@ class ObjectLiteralSpaceWalker extends Lint.RuleWalker { const failure = this.createFailure(node.pos, node.getWidth(), Rule.LEADING_FAILURE_STRING); this.addFailure(failure); } + if (text.charAt(2) === " ") { + const failure = this.createFailure(node.pos + 2, 1, Rule.LEADING_EXCESS_FAILURE_STRING); + this.addFailure(failure); + } if (text.charAt(text.length - 2) !== " ") { const failure = this.createFailure(node.pos, node.getWidth(), Rule.TRAILING_FAILURE_STRING); this.addFailure(failure); } + if (text.charAt(text.length - 3) === " ") { + const failure = this.createFailure(node.pos + node.getWidth() - 3, 1, Rule.TRAILING_EXCESS_FAILURE_STRING); + this.addFailure(failure); + } } } super.visitNode(node); From 8cc8293d078569c4f1ee9ee523d6f7fc0a44a8c4 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Thu, 23 Jun 2016 13:39:04 -0700 Subject: [PATCH 4/4] Fix excess whitespace issues --- tests/cases/unittests/transpile.ts | 96 +++++++++++++++--------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/tests/cases/unittests/transpile.ts b/tests/cases/unittests/transpile.ts index 5900a29bb5d..206f69142a5 100644 --- a/tests/cases/unittests/transpile.ts +++ b/tests/cases/unittests/transpile.ts @@ -239,195 +239,195 @@ var x = 0;`, { }); transpilesCorrectly("Supports setting 'allowJs'", "x;", { - options: { compilerOptions: { allowJs: true }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { allowJs: true }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'allowSyntheticDefaultImports'", "x;", { - options: { compilerOptions: { allowSyntheticDefaultImports: true }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { allowSyntheticDefaultImports: true }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'allowUnreachableCode'", "x;", { - options: { compilerOptions: { allowUnreachableCode: true }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { allowUnreachableCode: true }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'allowUnusedLabels'", "x;", { - options: { compilerOptions: { allowUnusedLabels: true }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { allowUnusedLabels: true }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'baseUrl'", "x;", { - options: { compilerOptions: { baseUrl: "./folder/baseUrl" }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { baseUrl: "./folder/baseUrl" }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'charset'", "x;", { - options: { compilerOptions: { charset: "en-us" }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { charset: "en-us" }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'declaration'", "x;", { - options: { compilerOptions: { declaration: true }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { declaration: true }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'declarationDir'", "x;", { - options: { compilerOptions: { declarationDir: "out/declarations" }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { declarationDir: "out/declarations" }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'emitBOM'", "x;", { - options: { compilerOptions: { emitBOM: true }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { emitBOM: true }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'emitDecoratorMetadata'", "x;", { - options: { compilerOptions: { emitDecoratorMetadata: true, experimentalDecorators: true }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { emitDecoratorMetadata: true, experimentalDecorators: true }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'experimentalDecorators'", "x;", { - options: { compilerOptions: { experimentalDecorators: true }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { experimentalDecorators: true }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'forceConsistentCasingInFileNames'", "x;", { - options: { compilerOptions: { forceConsistentCasingInFileNames: true }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { forceConsistentCasingInFileNames: true }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'isolatedModules'", "x;", { - options: { compilerOptions: { isolatedModules: true }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { isolatedModules: true }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'jsx'", "x;", { - options: { compilerOptions: { jsx: 1 }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { jsx: 1 }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'lib'", "x;", { - options: { compilerOptions: { lib: ["es2015", "dom"] }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { lib: ["es2015", "dom"] }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'locale'", "x;", { - options: { compilerOptions: { locale: "en-us" }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { locale: "en-us" }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'module'", "x;", { - options: { compilerOptions: { module: ModuleKind.CommonJS }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { module: ModuleKind.CommonJS }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'moduleResolution'", "x;", { - options: { compilerOptions: { moduleResolution: ModuleResolutionKind.NodeJs }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { moduleResolution: ModuleResolutionKind.NodeJs }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'newLine'", "x;", { - options: { compilerOptions: { newLine: NewLineKind.CarriageReturnLineFeed }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { newLine: NewLineKind.CarriageReturnLineFeed }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'noEmit'", "x;", { - options: { compilerOptions: { noEmit: true }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { noEmit: true }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'noEmitHelpers'", "x;", { - options: { compilerOptions: { noEmitHelpers: true }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { noEmitHelpers: true }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'noEmitOnError'", "x;", { - options: { compilerOptions: { noEmitOnError: true }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { noEmitOnError: true }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'noErrorTruncation'", "x;", { - options: { compilerOptions: { noErrorTruncation: true }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { noErrorTruncation: true }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'noFallthroughCasesInSwitch'", "x;", { - options: { compilerOptions: { noFallthroughCasesInSwitch: true }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { noFallthroughCasesInSwitch: true }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'noImplicitAny'", "x;", { - options: { compilerOptions: { noImplicitAny: true }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { noImplicitAny: true }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'noImplicitReturns'", "x;", { - options: { compilerOptions: { noImplicitReturns: true }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { noImplicitReturns: true }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'noImplicitThis'", "x;", { - options: { compilerOptions: { noImplicitThis: true }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { noImplicitThis: true }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'noImplicitUseStrict'", "x;", { - options: { compilerOptions: { noImplicitUseStrict: true }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { noImplicitUseStrict: true }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'noLib'", "x;", { - options: { compilerOptions: { noLib: true }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { noLib: true }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'noResolve'", "x;", { - options: { compilerOptions: { noResolve: true }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { noResolve: true }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'out'", "x;", { - options: { compilerOptions: { out: "./out" }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { out: "./out" }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'outDir'", "x;", { - options: { compilerOptions: { outDir: "./outDir" }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { outDir: "./outDir" }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'outFile'", "x;", { - options: { compilerOptions: { outFile: "./outFile" }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { outFile: "./outFile" }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'paths'", "x;", { - options: { compilerOptions: { paths: { "*": ["./generated*"] } }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { paths: { "*": ["./generated*"] } }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'preserveConstEnums'", "x;", { - options: { compilerOptions: { preserveConstEnums: true }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { preserveConstEnums: true }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'reactNamespace'", "x;", { - options: { compilerOptions: { reactNamespace: "react" }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { reactNamespace: "react" }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'removeComments'", "x;", { - options: { compilerOptions: { removeComments: true }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { removeComments: true }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'rootDir'", "x;", { - options: { compilerOptions: { rootDir: "./rootDir" }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { rootDir: "./rootDir" }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'rootDirs'", "x;", { - options: { compilerOptions: { rootDirs: ["./a", "./b"] }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { rootDirs: ["./a", "./b"] }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'skipLibCheck'", "x;", { - options: { compilerOptions: { skipLibCheck: true }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { skipLibCheck: true }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'skipDefaultLibCheck'", "x;", { - options: { compilerOptions: { skipDefaultLibCheck: true }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { skipDefaultLibCheck: true }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'strictNullChecks'", "x;", { - options: { compilerOptions: { strictNullChecks: true }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { strictNullChecks: true }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'stripInternal'", "x;", { - options: { compilerOptions: { stripInternal: true }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { stripInternal: true }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'suppressExcessPropertyErrors'", "x;", { - options: { compilerOptions: { suppressExcessPropertyErrors: true }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { suppressExcessPropertyErrors: true }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'suppressImplicitAnyIndexErrors'", "x;", { - options: { compilerOptions: { suppressImplicitAnyIndexErrors: true }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { suppressImplicitAnyIndexErrors: true }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'target'", "x;", { - options: { compilerOptions: { target: 2 }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { target: 2 }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'types'", "x;", { - options: { compilerOptions: { types: ["jquery", "jasmine"] }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { types: ["jquery", "jasmine"] }, fileName: "input.js", reportDiagnostics: true } }); transpilesCorrectly("Supports setting 'typeRoots'", "x;", { - options: { compilerOptions: { typeRoots: ["./folder"] }, fileName: "input.js", reportDiagnostics: true } + options: { compilerOptions: { typeRoots: ["./folder"] }, fileName: "input.js", reportDiagnostics: true } }); }); }