From bc2c8d455d7c99057344ef86bce8ea660f91b248 Mon Sep 17 00:00:00 2001 From: Eric Traut Date: Sat, 15 Feb 2020 02:00:51 -0700 Subject: [PATCH] Added eslint plugin for enforcing and fixing import sort order and groupings. Fixed all source files that are nonconformant. --- .eslintrc.json | 4 +++- client/src/extension.ts | 7 +++---- client/src/progress.ts | 4 ++-- package-lock.json | 6 ++++++ package.json | 3 ++- server/copyTypeshedFallback.js | 2 +- server/src/analyzer/binder.ts | 2 +- server/src/analyzer/checker.ts | 2 +- server/src/analyzer/importStatementUtils.ts | 2 +- server/src/analyzer/parseTreeUtils.ts | 2 +- server/src/analyzer/sourceFile.ts | 4 ++-- server/src/analyzer/typeEvaluator.ts | 2 +- server/src/analyzer/typeUtils.ts | 2 +- server/src/analyzer/typeVarMap.ts | 2 +- server/src/commands/commandController.ts | 1 + server/src/commands/createTypeStub.ts | 1 + server/src/commands/quickActionCommand.ts | 1 + server/src/common/diagnosticSink.ts | 2 +- server/src/common/pathUtils.ts | 1 + server/src/common/positionUtils.ts | 2 +- server/src/common/stringUtils.ts | 1 + server/src/common/vfs.ts | 1 + server/src/languageServerBase.ts | 5 +++-- server/src/languageService/codeActionProvider.ts | 1 + server/src/languageService/completionProvider.ts | 6 +++--- server/src/languageService/hoverProvider.ts | 2 +- server/src/languageService/importSorter.ts | 2 +- server/src/languageService/referencesProvider.ts | 2 +- server/src/languageService/signatureHelpProvider.ts | 2 +- server/src/parser/characterStream.ts | 1 + server/src/server.ts | 1 + server/src/tests/collectionUtils.test.ts | 1 + server/src/tests/config.test.ts | 2 +- server/src/tests/debug.test.ts | 1 + server/src/tests/filesystem.test.ts | 3 ++- server/src/tests/fourSlashParser.test.ts | 1 + server/src/tests/fourSlashRunner.test.ts | 1 + server/src/tests/harness/fourslash/runner.ts | 1 + server/src/tests/harness/vfs/pathValidation.ts | 2 ++ server/src/tests/stringUtils.test.ts | 3 ++- server/src/tests/testState.test.ts | 1 + 41 files changed, 60 insertions(+), 32 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 93877533aa93..f37021fc70af 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -12,12 +12,14 @@ "sourceType": "module" }, "plugins": [ - "@typescript-eslint/eslint-plugin" + "@typescript-eslint/eslint-plugin", + "simple-import-sort" ], "rules": { "no-constant-condition": 0, "no-inner-declarations": 0, "no-undef": 0, + "simple-import-sort/sort": "error", "@typescript-eslint/explicit-function-return-type": 0, "@typescript-eslint/ban-types": 0, "@typescript-eslint/camelcase": 0, diff --git a/client/src/extension.ts b/client/src/extension.ts index d83c2321b95b..222a1a8f04e8 100644 --- a/client/src/extension.ts +++ b/client/src/extension.ts @@ -11,12 +11,11 @@ import * as fs from 'fs'; import * as path from 'path'; +import { commands, ExtensionContext, Position, Range, TextEditor, TextEditorEdit } from 'vscode'; +import { LanguageClient, LanguageClientOptions, ServerOptions, TextEdit,TransportKind } from 'vscode-languageclient'; -import { ExtensionContext, commands, TextEditor, Range, Position, TextEditorEdit } from 'vscode'; -import { LanguageClient, LanguageClientOptions, ServerOptions, TransportKind, - TextEdit } from 'vscode-languageclient'; -import { ProgressReporting } from './progress'; import { Commands } from '../../server/src/commands/commands'; +import { ProgressReporting } from './progress'; export function activate(context: ExtensionContext) { const bundlePath = context.asAbsolutePath(path.join('server', 'server.bundle.js')); diff --git a/client/src/progress.ts b/client/src/progress.ts index d7a1b0ae705a..dfe8d4cd2a84 100644 --- a/client/src/progress.ts +++ b/client/src/progress.ts @@ -11,7 +11,7 @@ import { Progress, ProgressLocation, window } from 'vscode'; import { Disposable, LanguageClient } from 'vscode-languageclient'; -const AnalysisTimeoutInMs: number = 60000; +const AnalysisTimeoutInMs = 60000; export class ProgressReporting implements Disposable { private _progress: Progress<{ message?: string; increment?: number }> | undefined; @@ -21,7 +21,7 @@ export class ProgressReporting implements Disposable { constructor(languageClient: LanguageClient) { languageClient.onReady().then(() => { languageClient.onNotification('pyright/beginProgress', async () => { - let progressPromise = new Promise(resolve => { + const progressPromise = new Promise(resolve => { this._resolveProgress = resolve; }); diff --git a/package-lock.json b/package-lock.json index 6b596a3c64b6..6412c3e5af99 100644 --- a/package-lock.json +++ b/package-lock.json @@ -544,6 +544,12 @@ } } }, + "eslint-plugin-simple-import-sort": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-5.0.1.tgz", + "integrity": "sha512-s6Hjp9rcIDYT1h7tuTulblbY7+XQNZK+014uUkNJSKRXEHZO2i7CTr16HOpfgD9HDnUOpl0fwphPsr0oxZqgGg==", + "dev": true + }, "eslint-scope": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz", diff --git a/package.json b/package.json index 383c5d71f5e9..68923e82daba 100644 --- a/package.json +++ b/package.json @@ -28,8 +28,9 @@ "@types/node": "^12.12.21", "@typescript-eslint/eslint-plugin": "^2.12.0", "@typescript-eslint/parser": "^2.12.0", - "eslint": "^6.8.0", "del-cli": "^3.0.0", + "eslint": "^6.8.0", + "eslint-plugin-simple-import-sort": "^5.0.1", "typescript": "^3.7.3" }, "main": "index.js", diff --git a/server/copyTypeshedFallback.js b/server/copyTypeshedFallback.js index 2a9987fc08ac..ea86a82466fb 100644 --- a/server/copyTypeshedFallback.js +++ b/server/copyTypeshedFallback.js @@ -3,7 +3,7 @@ // This script helps build the command-line version of pyright // by copying the typeshed-fallback directory to the dist directory. -var fsExtra = require('fs-extra'); +const fsExtra = require('fs-extra'); // Clean the dist directory fsExtra.emptyDirSync('../dist'); diff --git a/server/src/analyzer/binder.ts b/server/src/analyzer/binder.ts index 616a20030e31..862ad850e002 100644 --- a/server/src/analyzer/binder.ts +++ b/server/src/analyzer/binder.ts @@ -20,10 +20,10 @@ import { Commands } from '../commands/commands'; import { DiagnosticLevel } from '../common/configOptions'; import { assert, fail } from '../common/debug'; import { CreateTypeStubFileAction } from '../common/diagnostic'; -import { getEmptyRange } from '../common/textRange'; import { DiagnosticRule } from '../common/diagnosticRules'; import { convertOffsetsToRange } from '../common/positionUtils'; import { PythonVersion } from '../common/pythonVersion'; +import { getEmptyRange } from '../common/textRange'; import { TextRange } from '../common/textRange'; import { ArgumentCategory, AssertNode, AssignmentExpressionNode, AssignmentNode, AugmentedAssignmentNode, AwaitNode, BinaryOperationNode, BreakNode, diff --git a/server/src/analyzer/checker.ts b/server/src/analyzer/checker.ts index 14d58b450729..38e45a9678a5 100644 --- a/server/src/analyzer/checker.ts +++ b/server/src/analyzer/checker.ts @@ -27,6 +27,7 @@ import { AssertNode, AssignmentExpressionNode, AssignmentNode, AugmentedAssignme import { AnalyzerFileInfo } from './analyzerFileInfo'; import * as AnalyzerNodeInfo from './analyzerNodeInfo'; import { Declaration, DeclarationType } from './declaration'; +import { isFinalVariableDeclaration } from './declarationUtils'; import { getTopLevelImports } from './importStatementUtils'; import * as ParseTreeUtils from './parseTreeUtils'; import { ParseTreeWalker } from './parseTreeWalker'; @@ -40,7 +41,6 @@ import { ClassType, combineTypes, FunctionType, isAnyOrUnknown, isNoneOrNever, i import { containsUnknown, derivesFromClassRecursive, doForSubtypes, getDeclaredGeneratorReturnType, getDeclaredGeneratorYieldType, getSymbolFromBaseClasses, isNoReturnType, isProperty, specializeType, transformTypeObjectToClass } from './typeUtils'; -import { isFinalVariableDeclaration } from './declarationUtils'; export class Checker extends ParseTreeWalker { private readonly _moduleNode: ModuleNode; diff --git a/server/src/analyzer/importStatementUtils.ts b/server/src/analyzer/importStatementUtils.ts index 3dd2df215763..a64284ac41cb 100644 --- a/server/src/analyzer/importStatementUtils.ts +++ b/server/src/analyzer/importStatementUtils.ts @@ -8,9 +8,9 @@ * import statements in a python source file. */ -import { Position } from '../common/textRange'; import { TextEditAction } from '../common/editAction'; import { convertOffsetToPosition } from '../common/positionUtils'; +import { Position } from '../common/textRange'; import { TextRange } from '../common/textRange'; import { ImportAsNode, ImportFromAsNode, ImportFromNode, ImportNode, ModuleNameNode, ModuleNode, ParseNodeType } from '../parser/parseNodes'; diff --git a/server/src/analyzer/parseTreeUtils.ts b/server/src/analyzer/parseTreeUtils.ts index 1897dc303017..06e6f462c458 100644 --- a/server/src/analyzer/parseTreeUtils.ts +++ b/server/src/analyzer/parseTreeUtils.ts @@ -8,8 +8,8 @@ */ import { fail } from '../common/debug'; -import { Position } from '../common/textRange'; import { convertPositionToOffset } from '../common/positionUtils'; +import { Position } from '../common/textRange'; import { TextRange } from '../common/textRange'; import { TextRangeCollection } from '../common/textRangeCollection'; import { ArgumentCategory, AssignmentExpressionNode, ClassNode, EvaluationScopeNode, diff --git a/server/src/analyzer/sourceFile.ts b/server/src/analyzer/sourceFile.ts index 2e62bf29ddc4..5a1d609bef80 100644 --- a/server/src/analyzer/sourceFile.ts +++ b/server/src/analyzer/sourceFile.ts @@ -14,13 +14,13 @@ import { getDefaultDiagnosticSettings } from '../common/configOptions'; import { ConsoleInterface, StandardConsole } from '../common/console'; -import { Diagnostic, DiagnosticCategory } from '../common/diagnostic'; import { assert } from '../common/debug'; +import { Diagnostic, DiagnosticCategory } from '../common/diagnostic'; import { DiagnosticSink, TextRangeDiagnosticSink } from '../common/diagnosticSink'; import { TextEditAction } from '../common/editAction'; import { getFileName, normalizeSlashes } from '../common/pathUtils'; import * as StringUtils from '../common/stringUtils'; -import { TextRange, getEmptyRange, Position, DocumentRange } from '../common/textRange'; +import { DocumentRange,getEmptyRange, Position, TextRange } from '../common/textRange'; import { TextRangeCollection } from '../common/textRangeCollection'; import { timingStats } from '../common/timing'; import { VirtualFileSystem } from '../common/vfs'; diff --git a/server/src/analyzer/typeEvaluator.ts b/server/src/analyzer/typeEvaluator.ts index 5291a51f4df6..6e02070f07a6 100644 --- a/server/src/analyzer/typeEvaluator.ts +++ b/server/src/analyzer/typeEvaluator.ts @@ -18,10 +18,10 @@ import { Commands } from '../commands/commands'; import { DiagnosticLevel } from '../common/configOptions'; import { assert, fail } from '../common/debug'; import { AddMissingOptionalToParamAction, Diagnostic, DiagnosticAddendum } from '../common/diagnostic'; -import { getEmptyRange } from '../common/textRange'; import { DiagnosticRule } from '../common/diagnosticRules'; import { convertOffsetsToRange } from '../common/positionUtils'; import { PythonVersion } from '../common/pythonVersion'; +import { getEmptyRange } from '../common/textRange'; import { TextRange } from '../common/textRange'; import { ArgumentCategory, AssignmentNode, AugmentedAssignmentNode, BinaryOperationNode, CallNode, ClassNode, ConstantNode, DecoratorNode, DictionaryNode, ExceptNode, ExpressionNode, diff --git a/server/src/analyzer/typeUtils.ts b/server/src/analyzer/typeUtils.ts index d2872e927bca..a8abcd53c423 100644 --- a/server/src/analyzer/typeUtils.ts +++ b/server/src/analyzer/typeUtils.ts @@ -9,13 +9,13 @@ import { ParameterCategory } from '../parser/parseNodes'; import { ImportLookup } from './analyzerFileInfo'; +import { DeclarationType } from './declaration'; import { Symbol, SymbolFlags, SymbolTable } from './symbol'; import { isTypedDictMemberAccessedThroughIndex } from './symbolUtils'; import { AnyType, ClassType, combineTypes, FunctionType, isAnyOrUnknown, isNoneOrNever, isTypeSame, maxTypeRecursionCount, ModuleType, NeverType, ObjectType, OverloadedFunctionType, SpecializedFunctionTypes, Type, TypeCategory, TypeVarType, UnknownType } from './types'; -import { DeclarationType } from './declaration'; import { TypeVarMap } from './typeVarMap'; export interface ClassMember { diff --git a/server/src/analyzer/typeVarMap.ts b/server/src/analyzer/typeVarMap.ts index 842b3fa8a3b2..cdf194ec9ac1 100644 --- a/server/src/analyzer/typeVarMap.ts +++ b/server/src/analyzer/typeVarMap.ts @@ -9,8 +9,8 @@ * evaluator to "solve" for the type of each type variable. */ -import { Type } from "./types"; import { assert } from "../common/debug"; +import { Type } from "./types"; export class TypeVarMap { private _typeMap: Map; diff --git a/server/src/commands/commandController.ts b/server/src/commands/commandController.ts index 1de147407c23..d64f16f84431 100644 --- a/server/src/commands/commandController.ts +++ b/server/src/commands/commandController.ts @@ -5,6 +5,7 @@ */ import { ExecuteCommandParams, ResponseError } from 'vscode-languageserver'; + import { LanguageServerBase } from '../languageServerBase'; import { Commands } from './commands'; import { CreateTypeStubCommand } from './createTypeStub'; diff --git a/server/src/commands/createTypeStub.ts b/server/src/commands/createTypeStub.ts index 46ee33be52fe..71157f4daa07 100644 --- a/server/src/commands/createTypeStub.ts +++ b/server/src/commands/createTypeStub.ts @@ -5,6 +5,7 @@ */ import { ExecuteCommandParams } from 'vscode-languageserver'; + import { AnalyzerService } from '../analyzer/service'; import { convertPathToUri } from '../common/pathUtils'; import { LanguageServerBase, WorkspaceServiceInstance } from '../languageServerBase'; diff --git a/server/src/commands/quickActionCommand.ts b/server/src/commands/quickActionCommand.ts index cf87a9d07fc6..93a7a8a7733a 100644 --- a/server/src/commands/quickActionCommand.ts +++ b/server/src/commands/quickActionCommand.ts @@ -5,6 +5,7 @@ */ import { ExecuteCommandParams, TextEdit } from 'vscode-languageserver'; + import { convertUriToPath } from '../common/pathUtils'; import { LanguageServerBase } from '../languageServerBase'; import { ServerCommand } from './commandController'; diff --git a/server/src/common/diagnosticSink.ts b/server/src/common/diagnosticSink.ts index cbd6be437a1f..ba38fcb72b73 100644 --- a/server/src/common/diagnosticSink.ts +++ b/server/src/common/diagnosticSink.ts @@ -9,7 +9,7 @@ import { Diagnostic, DiagnosticCategory } from './diagnostic'; import { convertOffsetsToRange } from './positionUtils'; -import { TextRange, Range } from './textRange'; +import { Range,TextRange } from './textRange'; import { TextRangeCollection } from './textRangeCollection'; // Represents a collection of diagnostics within a file. diff --git a/server/src/common/pathUtils.ts b/server/src/common/pathUtils.ts index 8616ad96114b..a1cce74908dc 100644 --- a/server/src/common/pathUtils.ts +++ b/server/src/common/pathUtils.ts @@ -10,6 +10,7 @@ import * as path from 'path'; import Char from 'typescript-char'; import { URI } from 'vscode-uri'; + import { some } from './collectionUtils'; import { compareValues, Comparison, GetCanonicalFileName, identity } from './core'; import * as debug from './debug'; diff --git a/server/src/common/positionUtils.ts b/server/src/common/positionUtils.ts index fafee9e51381..356dd01bd1e9 100644 --- a/server/src/common/positionUtils.ts +++ b/server/src/common/positionUtils.ts @@ -8,9 +8,9 @@ * line/column positions. */ +import { assert } from './debug'; import { Position, Range, TextRange } from './textRange'; import { TextRangeCollection } from './textRangeCollection'; -import { assert } from './debug'; // Translates a file offset into a line/column pair. export function convertOffsetToPosition(offset: number, lines: TextRangeCollection): Position { diff --git a/server/src/common/stringUtils.ts b/server/src/common/stringUtils.ts index 2b2c9c6bb5cf..bf6672760410 100644 --- a/server/src/common/stringUtils.ts +++ b/server/src/common/stringUtils.ts @@ -8,6 +8,7 @@ */ import leven from 'leven'; + import { compareComparableValues, Comparison } from './core'; // Determines how closely a typed string matches a symbol diff --git a/server/src/common/vfs.ts b/server/src/common/vfs.ts index 8ae78824bfca..68f38ad304f5 100644 --- a/server/src/common/vfs.ts +++ b/server/src/common/vfs.ts @@ -12,6 +12,7 @@ // * NOTE * except tests, this should be only file that import "fs" import * as chokidar from 'chokidar'; import * as fs from 'fs'; + import { ConsoleInterface, NullConsole } from './console'; export type Listener = (eventName: 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir', path: string, stats?: Stats) => void; diff --git a/server/src/languageServerBase.ts b/server/src/languageServerBase.ts index 158c4d501409..dbb6abef6f08 100644 --- a/server/src/languageServerBase.ts +++ b/server/src/languageServerBase.ts @@ -4,6 +4,8 @@ * Implements common language server functionality. */ +import './common/extensions'; + import { CodeAction, CodeActionKind, CodeActionParams, Command, ConfigurationItem, createConnection, Diagnostic, DiagnosticRelatedInformation, @@ -15,10 +17,9 @@ import { import { ImportResolver } from './analyzer/importResolver'; import { AnalyzerService } from './analyzer/service'; import { CommandLineOptions } from './common/commandLineOptions'; +import { ConfigOptions } from './common/configOptions'; import { Diagnostic as AnalyzerDiagnostic, DiagnosticCategory } from './common/diagnostic'; -import './common/extensions'; import { combinePaths, convertPathToUri, convertUriToPath, normalizePath } from './common/pathUtils'; -import { ConfigOptions } from './common/configOptions'; import { Position } from './common/textRange'; import { createFromRealFileSystem, VirtualFileSystem } from './common/vfs'; import { CompletionItemData } from './languageService/completionProvider'; diff --git a/server/src/languageService/codeActionProvider.ts b/server/src/languageService/codeActionProvider.ts index 655053249003..f197bad69cfb 100644 --- a/server/src/languageService/codeActionProvider.ts +++ b/server/src/languageService/codeActionProvider.ts @@ -5,6 +5,7 @@ */ import { CodeAction, CodeActionKind, Command } from 'vscode-languageserver'; + import { Commands } from '../commands/commands'; import { AddMissingOptionalToParamAction, CreateTypeStubFileAction } from '../common/diagnostic'; import { Range } from '../common/textRange'; diff --git a/server/src/languageService/completionProvider.ts b/server/src/languageService/completionProvider.ts index ae6158a912b1..4681b92deca1 100644 --- a/server/src/languageService/completionProvider.ts +++ b/server/src/languageService/completionProvider.ts @@ -22,15 +22,15 @@ import * as ParseTreeUtils from '../analyzer/parseTreeUtils'; import { Symbol, SymbolTable } from '../analyzer/symbol'; import * as SymbolNameUtils from '../analyzer/symbolNameUtils'; import { getLastTypedDeclaredForSymbol } from '../analyzer/symbolUtils'; -import { TypeEvaluator, CallSignatureInfo } from '../analyzer/typeEvaluator'; -import { FunctionType, TypeCategory, ClassType, Type } from '../analyzer/types'; +import { CallSignatureInfo,TypeEvaluator } from '../analyzer/typeEvaluator'; +import { ClassType, FunctionType, Type,TypeCategory } from '../analyzer/types'; import { doForSubtypes, getMembersForClass, getMembersForModule } from '../analyzer/typeUtils'; import { ConfigOptions } from '../common/configOptions'; -import { comparePositions, Position } from '../common/textRange'; import { TextEditAction } from '../common/editAction'; import { combinePaths, getDirectoryPath, getFileName, stripFileExtension } from '../common/pathUtils'; import { convertOffsetToPosition, convertPositionToOffset } from '../common/positionUtils'; import * as StringUtils from '../common/stringUtils'; +import { comparePositions, Position } from '../common/textRange'; import { TextRange } from '../common/textRange'; import { ErrorExpressionCategory, ErrorNode, ExpressionNode, FunctionNode, ImportFromNode, isExpressionNode, ModuleNameNode, NameNode, diff --git a/server/src/languageService/hoverProvider.ts b/server/src/languageService/hoverProvider.ts index 1ef2c6e65ca4..f362fea69196 100644 --- a/server/src/languageService/hoverProvider.ts +++ b/server/src/languageService/hoverProvider.ts @@ -15,8 +15,8 @@ import * as ParseTreeUtils from '../analyzer/parseTreeUtils'; import { TypeEvaluator } from '../analyzer/typeEvaluator'; import { Type, TypeCategory, UnknownType } from '../analyzer/types'; import { isProperty } from '../analyzer/typeUtils'; -import { Position, Range } from '../common/textRange'; import { convertOffsetToPosition, convertPositionToOffset } from '../common/positionUtils'; +import { Position, Range } from '../common/textRange'; import { TextRange } from '../common/textRange'; import { NameNode, ParseNodeType } from '../parser/parseNodes'; import { ParseResults } from '../parser/parser'; diff --git a/server/src/languageService/importSorter.ts b/server/src/languageService/importSorter.ts index 3c0aad702bb6..d515d42d0943 100644 --- a/server/src/languageService/importSorter.ts +++ b/server/src/languageService/importSorter.ts @@ -10,9 +10,9 @@ import { ImportType } from '../analyzer/importResult'; import * as ImportStatementUtils from '../analyzer/importStatementUtils'; -import { Range } from '../common/textRange'; import { TextEditAction } from '../common/editAction'; import { convertOffsetToPosition } from '../common/positionUtils'; +import { Range } from '../common/textRange'; import { TextRange } from '../common/textRange'; import { ImportAsNode, ImportFromAsNode, ImportFromNode, ParseNodeType } from '../parser/parseNodes'; import { ParseResults } from '../parser/parser'; diff --git a/server/src/languageService/referencesProvider.ts b/server/src/languageService/referencesProvider.ts index d85bdad05859..0a7c8f4f8f79 100644 --- a/server/src/languageService/referencesProvider.ts +++ b/server/src/languageService/referencesProvider.ts @@ -14,8 +14,8 @@ import * as DeclarationUtils from '../analyzer/declarationUtils'; import * as ParseTreeUtils from '../analyzer/parseTreeUtils'; import { ParseTreeWalker } from '../analyzer/parseTreeWalker'; import { TypeEvaluator } from '../analyzer/typeEvaluator'; -import { Position, DocumentRange } from '../common/textRange'; import { convertOffsetToPosition, convertPositionToOffset } from '../common/positionUtils'; +import { DocumentRange,Position } from '../common/textRange'; import { TextRange } from '../common/textRange'; import { NameNode, ParseNode, ParseNodeType } from '../parser/parseNodes'; import { ParseResults } from '../parser/parser'; diff --git a/server/src/languageService/signatureHelpProvider.ts b/server/src/languageService/signatureHelpProvider.ts index 11dadcbb9ae2..aa4c77e27cef 100644 --- a/server/src/languageService/signatureHelpProvider.ts +++ b/server/src/languageService/signatureHelpProvider.ts @@ -13,8 +13,8 @@ import { extractParameterDocumentation } from '../analyzer/docStringUtils'; import * as ParseTreeUtils from '../analyzer/parseTreeUtils'; import { TypeEvaluator } from '../analyzer/typeEvaluator'; import { FunctionType } from '../analyzer/types'; -import { Position } from '../common/textRange'; import { convertPositionToOffset } from '../common/positionUtils'; +import { Position } from '../common/textRange'; import { ParseResults } from '../parser/parser'; export interface ParamInfo { diff --git a/server/src/parser/characterStream.ts b/server/src/parser/characterStream.ts index 966f5ea82109..2db11eb8603d 100644 --- a/server/src/parser/characterStream.ts +++ b/server/src/parser/characterStream.ts @@ -11,6 +11,7 @@ */ import Char from 'typescript-char'; + import { isLineBreak, isWhiteSpace } from './characters'; export class CharacterStream { diff --git a/server/src/server.ts b/server/src/server.ts index 27616768b46a..69e9b626fcc2 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -6,6 +6,7 @@ import { isArray } from 'util'; import { CodeAction, CodeActionParams, Command, ExecuteCommandParams } from 'vscode-languageserver'; + import { CommandController } from './commands/commandController'; import { convertUriToPath, getDirectoryPath, normalizeSlashes } from './common/pathUtils'; import { LanguageServerBase, ServerSettings, WorkspaceServiceInstance } from './languageServerBase'; diff --git a/server/src/tests/collectionUtils.test.ts b/server/src/tests/collectionUtils.test.ts index e232372f8aca..52004367abbc 100644 --- a/server/src/tests/collectionUtils.test.ts +++ b/server/src/tests/collectionUtils.test.ts @@ -5,6 +5,7 @@ */ import * as assert from 'assert'; + import * as utils from '../common/collectionUtils'; import { compareValues, isArray } from '../common/core'; diff --git a/server/src/tests/config.test.ts b/server/src/tests/config.test.ts index 8aa4ce7dea8e..542634100972 100644 --- a/server/src/tests/config.test.ts +++ b/server/src/tests/config.test.ts @@ -13,7 +13,7 @@ import { AnalyzerService } from '../analyzer/service'; import { CommandLineOptions } from '../common/commandLineOptions'; import { ConfigOptions, ExecutionEnvironment } from '../common/configOptions'; import { NullConsole } from '../common/console'; -import { combinePaths, normalizeSlashes, normalizePath } from '../common/pathUtils'; +import { combinePaths, normalizePath,normalizeSlashes } from '../common/pathUtils'; import { createFromRealFileSystem } from '../common/vfs'; test('FindFilesWithConfigFile', () => { diff --git a/server/src/tests/debug.test.ts b/server/src/tests/debug.test.ts index 20ceb015be6d..9ebe418a508b 100644 --- a/server/src/tests/debug.test.ts +++ b/server/src/tests/debug.test.ts @@ -5,6 +5,7 @@ */ import * as assert from 'assert'; + import * as debug from '../common/debug'; test('DebugAssertTrue', () => { diff --git a/server/src/tests/filesystem.test.ts b/server/src/tests/filesystem.test.ts index c4905c7f14d1..706dd16dd354 100644 --- a/server/src/tests/filesystem.test.ts +++ b/server/src/tests/filesystem.test.ts @@ -3,10 +3,11 @@ * Copyright (c) Microsoft Corporation. * Licensed under the MIT license. * - * Test and Show how to use virtual file system + * Test and show how to use virtual file system */ import * as assert from 'assert'; + import { combinePaths, normalizeSlashes } from '../common/pathUtils'; import * as host from './harness/host'; import * as factory from './harness/vfs/factory'; diff --git a/server/src/tests/fourSlashParser.test.ts b/server/src/tests/fourSlashParser.test.ts index 7abfbab2e0ac..9874e0ae9356 100644 --- a/server/src/tests/fourSlashParser.test.ts +++ b/server/src/tests/fourSlashParser.test.ts @@ -8,6 +8,7 @@ */ import * as assert from 'assert'; + import { combinePaths, getBaseFileName, normalizeSlashes } from '../common/pathUtils'; import { compareStringsCaseSensitive } from '../common/stringUtils'; import { parseTestData } from './harness/fourslash/fourSlashParser'; diff --git a/server/src/tests/fourSlashRunner.test.ts b/server/src/tests/fourSlashRunner.test.ts index d5db3837e574..d428ddb8fd50 100644 --- a/server/src/tests/fourSlashRunner.test.ts +++ b/server/src/tests/fourSlashRunner.test.ts @@ -8,6 +8,7 @@ */ import * as path from 'path'; + import { normalizeSlashes } from '../common/pathUtils'; import { runFourSlashTest } from './harness/fourslash/runner'; import * as host from './harness/host'; diff --git a/server/src/tests/harness/fourslash/runner.ts b/server/src/tests/harness/fourslash/runner.ts index 1c5865fe2fcd..6fea7fc673b1 100644 --- a/server/src/tests/harness/fourslash/runner.ts +++ b/server/src/tests/harness/fourslash/runner.ts @@ -7,6 +7,7 @@ */ import * as ts from 'typescript'; + import { ImportResolverFactory } from '../../../analyzer/importResolver'; import { combinePaths } from '../../../common/pathUtils'; import * as host from '../host'; diff --git a/server/src/tests/harness/vfs/pathValidation.ts b/server/src/tests/harness/vfs/pathValidation.ts index 763d6205c84b..fac869e54db8 100644 --- a/server/src/tests/harness/vfs/pathValidation.ts +++ b/server/src/tests/harness/vfs/pathValidation.ts @@ -3,7 +3,9 @@ * Copyright (c) Microsoft Corporation. * Licensed under the MIT license. */ + import { sep } from 'path'; + import * as pu from '../../../common/pathUtils'; import { createIOError } from '../utils'; diff --git a/server/src/tests/stringUtils.test.ts b/server/src/tests/stringUtils.test.ts index 31a93b07b766..0b0651f65a45 100644 --- a/server/src/tests/stringUtils.test.ts +++ b/server/src/tests/stringUtils.test.ts @@ -5,8 +5,9 @@ */ import * as assert from 'assert'; -import * as utils from '../common/stringUtils'; + import * as core from '../common/core'; +import * as utils from '../common/stringUtils'; test('CoreCompareStringsCaseInsensitive1', () => { assert.equal(utils.compareStringsCaseInsensitive("Hello", "hello"), core.Comparison.EqualTo); diff --git a/server/src/tests/testState.test.ts b/server/src/tests/testState.test.ts index cdd0123d400f..d5e384c646d1 100644 --- a/server/src/tests/testState.test.ts +++ b/server/src/tests/testState.test.ts @@ -7,6 +7,7 @@ */ import * as assert from 'assert'; + import { combinePaths, comparePathsCaseSensitive, getFileName, normalizeSlashes } from '../common/pathUtils'; import { compareStringsCaseSensitive } from '../common/stringUtils'; import { parseTestData } from './harness/fourslash/fourSlashParser';