Enable interface-over-type-literal lint rule (#17733)

This commit is contained in:
Andy 2017-09-07 09:14:59 -07:00 committed by GitHub
parent be0633825c
commit 193f4be355
7 changed files with 20 additions and 14 deletions

View File

@ -21516,7 +21516,7 @@ namespace ts {
return true;
}
type InheritanceInfoMap = { prop: Symbol; containingType: Type };
interface InheritanceInfoMap { prop: Symbol; containingType: Type; }
const seen = createUnderscoreEscapedMap<InheritanceInfoMap>();
forEach(resolveDeclaredMembers(type).declaredProperties, p => { seen.set(p.escapedName, { prop: p, containingType: type }); });
let ok = true;

View File

@ -2,7 +2,7 @@
/// <reference path="..\..\compiler\commandLineParser.ts" />
namespace ts {
type ExpectedResult = { typeAcquisition: TypeAcquisition, errors: Diagnostic[] };
interface ExpectedResult { typeAcquisition: TypeAcquisition; errors: Diagnostic[]; }
describe("convertTypeAcquisitionFromJson", () => {
function assertTypeAcquisition(json: any, configFileName: string, expectedResult: ExpectedResult) {
assertTypeAcquisitionWithJson(json, configFileName, expectedResult);

View File

@ -466,7 +466,7 @@ namespace ts.server.protocol {
* Represents a single refactoring action - for example, the "Extract Method..." refactor might
* offer several actions, each corresponding to a surround class or closure to extract into.
*/
export type RefactorActionInfo = {
export interface RefactorActionInfo {
/**
* The programmatic name of the refactoring action
*/
@ -478,7 +478,7 @@ namespace ts.server.protocol {
* so this description should make sense by itself if the parent is inlineable=true
*/
description: string;
};
}
export interface GetEditsForRefactorRequest extends Request {
command: CommandTypes.GetEditsForRefactor;
@ -501,7 +501,7 @@ namespace ts.server.protocol {
body?: RefactorEditInfo;
}
export type RefactorEditInfo = {
export interface RefactorEditInfo {
edits: FileCodeEdits[];
/**
@ -510,7 +510,7 @@ namespace ts.server.protocol {
*/
renameLocation?: Location;
renameFilename?: string;
};
}
/**
* Request for the available codefixes at a specific position.

View File

@ -73,12 +73,12 @@ namespace ts.server.typingsInstaller {
}
export type RequestCompletedAction = (success: boolean) => void;
type PendingRequest = {
interface PendingRequest {
requestId: number;
args: string[];
cwd: string;
onRequestCompleted: RequestCompletedAction;
};
}
export abstract class TypingsInstaller {
private readonly packageNameToTypingLocation: Map<string> = createMap<string>();

View File

@ -1,6 +1,12 @@
/* @internal */
namespace ts.NavigateTo {
type RawNavigateToItem = { name: string; fileName: string; matchKind: PatternMatchKind; isCaseSensitive: boolean; declaration: Declaration };
interface RawNavigateToItem {
name: string;
fileName: string;
matchKind: PatternMatchKind;
isCaseSensitive: boolean;
declaration: Declaration;
}
export function getNavigateToItems(sourceFiles: ReadonlyArray<SourceFile>, checker: TypeChecker, cancellationToken: CancellationToken, searchValue: string, maxResultCount: number, excludeDtsFiles: boolean): NavigateToItem[] {
const patternMatcher = createPatternMatcher(searchValue);

View File

@ -394,7 +394,7 @@ namespace ts {
* Represents a single refactoring action - for example, the "Extract Method..." refactor might
* offer several actions, each corresponding to a surround class or closure to extract into.
*/
export type RefactorActionInfo = {
export interface RefactorActionInfo {
/**
* The programmatic name of the refactoring action
*/
@ -406,18 +406,17 @@ namespace ts {
* so this description should make sense by itself if the parent is inlineable=true
*/
description: string;
};
}
/**
* A set of edits to make in response to a refactor action, plus an optional
* location where renaming should be invoked from
*/
export type RefactorEditInfo = {
export interface RefactorEditInfo {
edits: FileTextChanges[];
renameFilename?: string;
renameLocation?: number;
};
}
export interface TextInsertion {
newText: string;

View File

@ -11,6 +11,7 @@
"indent": [true,
"spaces"
],
"interface-over-type-literal": true,
"jsdoc-format": true,
"linebreak-style": [true, "CRLF"],
"next-line": [true,