Merge pull request #9332 from Microsoft/object-whitespace-rule

Object whitespace rule
This commit is contained in:
Wesley Wigham 2016-06-23 14:02:36 -07:00 committed by GitHub
commit 9cd1f786c3
8 changed files with 112 additions and 67 deletions

View File

@ -229,7 +229,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("."));
});
}
@ -580,7 +580,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("."));
});
@ -746,7 +746,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())
@ -771,7 +771,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("."));
});
@ -960,7 +960,8 @@ const tslintRules = [
"booleanTriviaRule",
"typeOperatorSpacingRule",
"noInOperatorRule",
"noIncrementDecrementRule"
"noIncrementDecrementRule",
"objectLiteralSurroundingSpaceRule",
];
const tslintRulesFiles = tslintRules.map(function(p) {
return path.join(tslintRuleDir, p + ".ts");
@ -968,7 +969,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())

View File

@ -992,7 +992,8 @@ var tslintRules = [
"booleanTriviaRule",
"typeOperatorSpacingRule",
"noInOperatorRule",
"noIncrementDecrementRule"
"noIncrementDecrementRule",
"objectLiteralSurroundingSpaceRule",
];
var tslintRulesFiles = tslintRules.map(function(p) {
return path.join(tslintRuleDir, p + ".ts");

View File

@ -0,0 +1,42 @@
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 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()));
}
}
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(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);
}
}

View File

@ -1123,7 +1123,7 @@ namespace ts.server {
[CommandNames.Reload]: (request: protocol.Request) => {
const reloadArgs = <protocol.ReloadRequestArgs>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 = <protocol.SavetoRequestArgs>request.arguments;

View File

@ -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);
}
});

View File

@ -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());

View File

@ -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 }
});
});
}

View File

@ -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
}
}