mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-14 19:16:17 -06:00
no-unused-expressions
This commit is contained in:
parent
fdfff3593e
commit
5902b327db
@ -107,7 +107,7 @@
|
||||
"no-trailing-spaces": "error",
|
||||
"no-undef-init": "error",
|
||||
"no-unsafe-finally": "error",
|
||||
"no-unused-expressions": "off",
|
||||
"no-unused-expressions": "error",
|
||||
"no-unused-labels": "error",
|
||||
"no-var": "off",
|
||||
"object-shorthand": "error",
|
||||
|
||||
@ -2942,7 +2942,7 @@ namespace ts {
|
||||
node.declarationMapPath = declarationMapPath;
|
||||
node.declarationMapText = declarationMapTextOrBuildInfoPath;
|
||||
node.javascriptPath = javascriptPath;
|
||||
node.declarationPath = declarationPath,
|
||||
node.declarationPath = declarationPath;
|
||||
node.buildInfoPath = buildInfoPath;
|
||||
node.buildInfo = buildInfo;
|
||||
node.oldFileOfCurrentEmit = oldFileOfCurrentEmit;
|
||||
|
||||
@ -331,7 +331,9 @@ namespace ts {
|
||||
export function createProgramHost<T extends BuilderProgram = EmitAndSemanticDiagnosticsBuilderProgram>(system: System, createProgram: CreateProgram<T> | undefined): ProgramHost<T> {
|
||||
const getDefaultLibLocation = memoize(() => getDirectoryPath(normalizePath(system.getExecutingFilePath())));
|
||||
let host: DirectoryStructureHost = system;
|
||||
host; // tslint:disable-line no-unused-expression (TODO: `host` is unused!)
|
||||
// TODO: `host` is unused!
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
host;
|
||||
return {
|
||||
useCaseSensitiveFileNames: () => system.useCaseSensitiveFileNames,
|
||||
getNewLine: () => system.newLine,
|
||||
|
||||
@ -214,11 +214,17 @@ namespace ts.refactor.generateGetAccessorAndSetAccessor {
|
||||
}
|
||||
|
||||
function insertAccessor(changeTracker: textChanges.ChangeTracker, file: SourceFile, accessor: AccessorDeclaration, declaration: AcceptedDeclaration, container: ContainerDeclaration) {
|
||||
isParameterPropertyDeclaration(declaration)
|
||||
? changeTracker.insertNodeAtClassStart(file, <ClassLikeDeclaration>container, accessor)
|
||||
: isPropertyAssignment(declaration)
|
||||
? changeTracker.insertNodeAfterComma(file, declaration, accessor)
|
||||
: changeTracker.insertNodeAfter(file, declaration, accessor);
|
||||
if (isParameterPropertyDeclaration(declaration)) {
|
||||
changeTracker.insertNodeAtClassStart(file, <ClassLikeDeclaration>container, accessor);
|
||||
}
|
||||
else {
|
||||
if (isPropertyAssignment(declaration)) {
|
||||
changeTracker.insertNodeAfterComma(file, declaration, accessor);
|
||||
}
|
||||
else {
|
||||
changeTracker.insertNodeAfter(file, declaration, accessor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function updateReadonlyPropertyInitializerStatementConstructor(changeTracker: textChanges.ChangeTracker, file: SourceFile, constructor: ConstructorDeclaration, fieldName: string, originalName: string) {
|
||||
|
||||
@ -125,7 +125,10 @@ namespace Harness.Parallel.Worker {
|
||||
}
|
||||
|
||||
function addTest(title: string | Mocha.Func | Mocha.AsyncFunc, fn: Mocha.Func | Mocha.AsyncFunc | undefined): Mocha.Test {
|
||||
if (typeof title === "function") fn = title, title = fn.name;
|
||||
if (typeof title === "function") {
|
||||
fn = title;
|
||||
title = fn.name;
|
||||
}
|
||||
const test = new Test(title, suites[0].pending ? undefined : fn);
|
||||
suites[0].addTest(test);
|
||||
return test;
|
||||
@ -297,4 +300,4 @@ namespace Harness.Parallel.Worker {
|
||||
|
||||
process.on("message", processHostMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ export function Component(x: Config): any;`
|
||||
},
|
||||
});
|
||||
const definitions = languageService.getDefinitionAtPosition("foo.ts", 160); // 160 is the latter `vueTemplateHtml` position
|
||||
expect(definitions).to.exist; // tslint:disable-line no-unused-expression
|
||||
expect(definitions).to.exist; // eslint-disable-line no-unused-expressions
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ describe("unittests:: services:: PreProcessFile:", () => {
|
||||
ambientExternalModules: undefined,
|
||||
isLibFile: false
|
||||
});
|
||||
}),
|
||||
});
|
||||
|
||||
it("Do not return reference path because of invalid triple-slash syntax", () => {
|
||||
test("///<reference path\"refFile1.ts\" />" + "\n" + "///<reference path =\"refFile2.ts\">" + "\n" + "///<referencepath=\"refFile3.ts\" />" + "\n" + "///<reference pat= \"refFile4d.ts\" />",
|
||||
@ -58,7 +58,7 @@ describe("unittests:: services:: PreProcessFile:", () => {
|
||||
ambientExternalModules: undefined,
|
||||
isLibFile: false
|
||||
});
|
||||
}),
|
||||
});
|
||||
|
||||
it("Do not return reference path of non-imports", () => {
|
||||
test("Quill.import('delta');",
|
||||
@ -72,7 +72,7 @@ describe("unittests:: services:: PreProcessFile:", () => {
|
||||
ambientExternalModules: undefined,
|
||||
isLibFile: false
|
||||
});
|
||||
}),
|
||||
});
|
||||
|
||||
it("Do not return reference path of nested non-imports", () => {
|
||||
test("a.b.import('c');",
|
||||
@ -86,7 +86,7 @@ describe("unittests:: services:: PreProcessFile:", () => {
|
||||
ambientExternalModules: undefined,
|
||||
isLibFile: false
|
||||
});
|
||||
}),
|
||||
});
|
||||
|
||||
it("Correctly return imported files", () => {
|
||||
test("import i1 = require(\"r1.ts\"); import i2 =require(\"r2.ts\"); import i3= require(\"r3.ts\"); import i4=require(\"r4.ts\"); import i5 = require (\"r5.ts\");",
|
||||
@ -101,7 +101,7 @@ describe("unittests:: services:: PreProcessFile:", () => {
|
||||
ambientExternalModules: undefined,
|
||||
isLibFile: false
|
||||
});
|
||||
}),
|
||||
});
|
||||
|
||||
it("Do not return imported files if readImportFiles argument is false", () => {
|
||||
test("import i1 = require(\"r1.ts\"); import i2 =require(\"r2.ts\"); import i3= require(\"r3.ts\"); import i4=require(\"r4.ts\"); import i5 = require (\"r5.ts\");",
|
||||
@ -115,7 +115,7 @@ describe("unittests:: services:: PreProcessFile:", () => {
|
||||
ambientExternalModules: undefined,
|
||||
isLibFile: false
|
||||
});
|
||||
}),
|
||||
});
|
||||
|
||||
it("Do not return import path because of invalid import syntax", () => {
|
||||
test("import i1 require(\"r1.ts\"); import = require(\"r2.ts\") import i3= require(\"r3.ts\"); import i5",
|
||||
@ -129,7 +129,7 @@ describe("unittests:: services:: PreProcessFile:", () => {
|
||||
ambientExternalModules: undefined,
|
||||
isLibFile: false
|
||||
});
|
||||
}),
|
||||
});
|
||||
|
||||
it("Correctly return referenced files and import files", () => {
|
||||
test("///<reference path=\"refFile1.ts\" />" + "\n" + "///<reference path =\"refFile2.ts\"/>" + "\n" + "import i1 = require(\"r1.ts\"); import i2 =require(\"r2.ts\");",
|
||||
@ -143,7 +143,7 @@ describe("unittests:: services:: PreProcessFile:", () => {
|
||||
ambientExternalModules: undefined,
|
||||
isLibFile: false
|
||||
});
|
||||
}),
|
||||
});
|
||||
|
||||
it("Correctly return referenced files and import files even with some invalid syntax", () => {
|
||||
test("///<reference path=\"refFile1.ts\" />" + "\n" + "///<reference path \"refFile2.ts\"/>" + "\n" + "import i1 = require(\"r1.ts\"); import = require(\"r2.ts\"); import i2 = require(\"r3.ts\");",
|
||||
|
||||
@ -337,7 +337,7 @@ namespace ts.server {
|
||||
|
||||
session.send = Session.prototype.send;
|
||||
assert(session.send);
|
||||
expect(session.send(msg)).to.not.exist; // tslint:disable-line no-unused-expression
|
||||
expect(session.send(msg)).to.not.exist; // eslint-disable-line no-unused-expressions
|
||||
expect(lastWrittenToHost).to.equal(resultMsg);
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user